1 / 10

Another Script Exercise….

Another Script Exercise…. Compiling Source Code. First step we need to get the software From the shell prompt type: scp <yourid@192.168.211.54:/home/whatmask.tgz . ^

kaemon
Télécharger la présentation

Another Script Exercise….

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Another Script Exercise….

  2. Compiling Source Code • First step we need to get the software • From the shell prompt type: scp <yourid@192.168.211.54:/home/whatmask.tgz . ^ (a space) While you are at it get this file too: scp <yourid@192.168.211.54:/home/ips.txt .

  3. Compiling Source Code • Now you should have in your $HOME directory two files. One called: whatmask.tgz and one called: ips.txt • Remember a simple ls command will confirm this. • Remember to download this files are your normal user ID and not as root.

  4. Compiling Source Code • Now we need to unzip the file so from the shell prompt type: tar –xzvf whatmask-1.2.tar.gz • Then change into the directory cd whatmask-1.2/

  5. Compiling Source Code • The first thing you want to do is get a directory listing so you know what you’re dealing with • Files to make note of are: • README, INSTALL, Makefile, configure, etc. • In this case we need to run the configure script ./configure

  6. Compiling Source Code • Once the configure script runs with no errors then we need to compile the program • To just compile type: make • It is best to run make as a normal user because you didn’t personally verify all the source code and config files did you? • To install type: make install

  7. Compiling Source Code • Now test your program by typing the following: whatmask 192.168.0.0/24 • Everyone knows what CIDR means – right? • Classless Inter-Domain Routing • It’s the /24 which is a 24-bit subnet mask or 255.255.255.0 so try it again… whatmask 192.168.0.0/255.255.255.0

  8. Now the Scenario… Your boss gives you a list of networks that the evildevelopers want opened up on Premise Sidewinder (UNIX) Firewall that you are responsible for. After looking over the list you come to the conclusion that it would expose your network to a very large number of IP addresses. You realize that in order to prove this to your boss you need to come up with the total number of IP addresses. So you decide to write a shell script get the answer.

  9. Tools you will need…. • Your trusty Linux server • A shell prompt • The worlds most powerful editor (vi) • The whatmask program you recently installed • The list of networks and subnet masks your boss gave you (ips.txt) • And the secret incantation that will add up all the totals y=$(($y+$x))

  10. And the answer is…… 8,568,800

More Related