I have a file of ip addresses called activeips.txt
What I'm trying to do is run a simple bash script that has a loop in it. The loop is a cat of the IP addresses in the file.
The goal is to run 2 nmap commands to give me outputs where each address in the list has an OS fingerprint and then a top 20 open ports scan.
The problem is that the script as written, not matter what I do, will run the nmap commands at the same time and they cycle through without waiting for each other. They literally run through the whole list of IPs independent of each other.
What I want to do is get the first address in the file, run the first nmap command, then the second nmap command and then go to the next address, run the first nmap, second nmap, next address....so on and so on.
All help is appreciated for a scripting NOOB
Thanks
DP
Here's the script:
Last edited by vgersh99; 04-04-2018 at 05:35 PM..
Reason: code tags, please!
The activeips.txt file already exists....from another script. It has the list of IPs for the nmaps to scan....so outputting to activeips.txt like you have as the last line is no quite correct
So using what you have above...would the loop look like this?
Last edited by vgersh99; 04-04-2018 at 06:07 PM..
Reason: start using code tags, please!
Ahhh ... I see what you're saying with the active ips file...I didn't pay attention to the < for input instead of output.
So I try it, and I get output of the discovery nmapping the first IP, then I get ports output of the first ip, and then it outputs the ports again for the next ip in the file, then it outputs the ports again for the next ip in the file, and then eventually the Discovery output comes out for the 2nd ip in the file. It's like the 2 functions are running independent of each other. The goal is Discovery for first IP, then Ports for First IP, then Discovery for 2nd, Ports for second...and so on.
The script you have is doing the same thing my original one is...where the 2 functions seem to run loops of their own without regard to each other
Say I have this line:
read -p "Enter 3 numbers: " num1 num2 num3;
I want to write a while loop that repeatedly asks for input if the number of inputs entered is not equal to 3.
I don't know the correct command to find the number of inputs entered. Help, please? (4 Replies)
Hello,
I am in a Unix class and have been out of town. I have been tasked to generate a couple of scripts and ahve never done it before. I have a virtual machine running Ubuntu. The task is below
Prompt the system administrator for all valid input parameters
Generate a menu to ask which... (1 Reply)
Hello,
I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below:
#/bin/bash
echo "Enter the IP address"
read ip
if
then
ping -c 1 $ip
if ;... (3 Replies)
I'm having some difficulty with convincing Expect to do what I need..
I have a loop that waits for input, a specific phrase of text followed by a single word. I need Expect to capture that word following the specific phrase. It should then store the word in a variable.
I'm fairly sure it's... (6 Replies)
have a script that calls child scripts depending on conditions. All of the child scripts source in a common file that contains shared functions.
At the moment each script has to source this file itself, is there a way for the master script to automagically source the file for them?
For... (3 Replies)
Hello. I'm attempting to create a shell script to assist me by saving time with one of my hobbies. I am an Android Enthusiast and currently build a few roms for one of the devices.
One of the roms I make is ported from a different device to mine (I get the original for the HTC Desire HD and... (3 Replies)
Hi I'm pretty new to scripting and I've been googling around looking for an answer but have yet to come up with a proper solution. I work with multiple android devices at a time and I'm looking to simplify my life with a script. Basically I'm looking for a script that takes the device ID's and then... (2 Replies)
Hi i am a total noob at shell scripting. i was wondering if somebody could help me with my script.
i want the script to search the dev folder for the burner file
because they are different between distrubutions? as i under stand it.
this i the script.
#!/bin/bash
echo "Script för att bränna 360... (4 Replies)
Hey,
So I've run into a problem, due to my limited knowledge of Bash scripting.
Basically I've got a long script and I want to understand it before I even try and edit it. As long as I don't understand the script, I will not bother editing it.
Anyway, the following variable confuses me... (5 Replies)
I'm writing a bash script to search the contents of a postfix log. To keep the script's output readable (since multiple lines from the log file need to be echo'ed) I am setting the IFS variable to an empty string so that the line breaks in my grep results are preserved. I am storing the results... (4 Replies)