Sponsored Content
Top Forums Programming Nmap shell script goes in infinite loop Post 302998110 by sk151993 on Thursday 25th of May 2017 07:58:29 AM
Old 05-25-2017
Nmap shell script goes in infinite loop

My script’s output goes in infinite loop

Below is my script:

Code:
Nmap()
{
while read -r line
do
name="$line"
echo "$name"
count=$line

nmap -oG output.txt -T4 -f -iL iplist.txt $line1
done < iplist.txt
}
Nmap

.................................................................

IPlist.txt contain so many ip’s. Whatever user is added ip’s in file, all ip’s are read one by one.

Problem:
This ip scan is goes in infinite loop.

Below source code contain problem:

Code:
while read -r line
do
name="$line"
echo "$name"
count=$line

nmap -oG output.txt -T4 -f -iL iplist.txt $line1
done < iplist.txt

How should I fix this? Please suggest.

Last edited by sk151993; 06-01-2017 at 02:54 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a script in INFINITE LOOP

Hi All, I have a requirement as below. I supposed to get a file from Source system once in a month. But we dont know when the source system will send the file. My script has to wait for that file in LOOP once it gets the file then it has to FTP the file. I thought of scheduling the job... (5 Replies)
Discussion started by: Raamc
5 Replies

2. Shell Programming and Scripting

Script to run infinite loop

Hi all, I have a script which triggers batch admin manager and gets the top 10 jobs and their status info. the output of this script is the list of all these jobs. I want to run this in infinite loop which will show top 100 jobs' status. the script is as follows #!/bin/sh exec &> capture1.txt... (1 Reply)
Discussion started by: digitalrg
1 Replies

3. Shell Programming and Scripting

Infinite while loop

what is the difference between while:,while true and while false? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

4. UNIX for Advanced & Expert Users

Procmail and infinite loop

I wanted to copy (not forward but copy) all incoming email to another address of mine. It worked, but now I encountered an infinite loop problem: When the second address doesn't like the content and bounces the message back, the bounce message will be sent back and forth. So, what I have in... (1 Reply)
Discussion started by: distill
1 Replies

5. Shell Programming and Scripting

Script with infinite loop stops after sometime

Hi I am working on a server that is set up and maintained by a third party. It seems whenever I run bash scripts in the background (with a &) with while loops in them they seem to me killed in around 2.5 hours. ( I am running them as a normal user with no special privileges ) . Is there a... (3 Replies)
Discussion started by: pkabali
3 Replies

6. Shell Programming and Scripting

My for loop decides to become an infinite loop?

Hi, I was debating if I should put this in the dummies or scripts section, I apologize in advance if I chose poorly. Fairly new to Unix and BASH scripting but I thought I made it fairly well given my limited understanding. However, the output indicates that it's looping and I'm ending up with a... (5 Replies)
Discussion started by: gotreef
5 Replies

7. Shell Programming and Scripting

Infinite while loop script shows more than one process

Hi, I have a script which triggers an infinite loop. #!bin/bash trig=`ls /home/trig.tch |wc -l` function callj { some commands... } while do callj & done The number of process after doing a ps -ef |grep Mon.sh returns processes even after the script is killed by deleting the... (4 Replies)
Discussion started by: chetan.c
4 Replies

8. Shell Programming and Scripting

Select command going to infinite loop after running the script

cd /opt/et/WAS/apps/8.0 find . -name "HostIntegration.properties" -o -name "HostSocket.properties" -o -name "environment.properties" 2> /dev/null | awk -F '' '{print $4}'|awk '!x++' | cat>/home/cbadmin/file1.txt cd /home/cbadmin/ PS3='Please enter a number from list of applications==>:' select... (3 Replies)
Discussion started by: bhas85
3 Replies

9. Shell Programming and Scripting

Calling a script from a shell that needs to cancel out of infinite loop

I am writing a shell script that calls this oracle utility to get some information about the DB that I need for the script https://docs.oracle.com/cd/B16240_01/doc/em.102/e15294/options.htm This is the command that I am running: $ORACLE_HOME/OPatch/opatch lsinventory -details | grep -i... (1 Reply)
Discussion started by: guessingo
1 Replies

10. Shell Programming and Scripting

Read function is going in infinite in another script having while loop

Hello Experts, I have created one user confirmation process that will ask for user input. I have created one func for it. The issue is if i call it as normal then it works fine but if i am calling it in another script(in while loop) . It is going in infinite loop and not asking for user input. ... (8 Replies)
Discussion started by: looney
8 Replies
GENLIST.MAN.1(1p)					User Contributed Perl Documentation					 GENLIST.MAN.1(1p)

NAME
Genlist - ping scanner SYNOPSIS
genlist [Input Type] [Scan Options] [General Options] DESCRIPTION
Genlist is a program that returns a list of hosts that responding to ping probes. Thus, this list can be used to perform an scan of these machines using PBNJ or Nmap. Apart of PBNJ 2.0 suite of tools to monitor changes on a network. OPTIONS
Usage: genlist [Input Type] [General Options] Input Type: -s --scan <target> Ping Target Range ex: 10.0.0.* Scan Options: -n --nmap <path> Path to Nmap executable --inter <interface> Perform scan using non default interface General Options: -v --version Display version -h --help Display this information Send Comments to Joshua D. Abraham ( jabra@ccs.neu.edu ) EXAMPLE OF GENLIST USED WITH PBNJ
$ ./genlist -s 10.0.0.* > iplist $ sudo ./scanpbnj -i iplist EXAMPLE OF GENLIST USED WITH NMAP
$ ./genlist -s 10.0.0.* > iplist $ sudo ./nmap -iL iplist INPUT TYPE
-s <target> Ping Target Range ex: 10.0.0.* The ping scan is a useful method of only scanning the host that are responding to ICMP echo requests. This scan basically takes the host that respond to ping and prints them. This is useful in combining the result with a PBNJ or Nmap scan because no time is wasted in scanning hosts that do not respond. SCAN OPTIONS
--interface <intface> This option sets an alternative interface for performing the scan. This is useful when you have multiple interfaces on a machine with restrictions on which devices can access certain IP ranges. -n --nmap <path> Use an alternative Nmap rather than Nmap located in the your path. This is useful if you have multiple version of Nmap installed on a system or if you are testing a new version of Nmap. Remember that if you are using a newly compiled version of Nmap that you need to export NMAPDIR to the location that Nmap was compiled in. Thus, if you have compiled Nmap in your homedir, use the following notation to run it with Genlist: $ export NMAPDIR=$HOME/nmap-VERSION/ $ sudo genlist -s 10.0.0.* --nmap $HOME/nmap-VERISON/ General Options: -v --version Prints the Genlist version number and exits. -h --help Display this information Prints a short help screen with the most common command flags. Running Genlist without any arguments does the same thing. FEATURE REQUESTS
Any feature requests should be reported to the online feature-request-tracking system available on the web at : http://sourceforge.net/tracker/?func=add&group_id=149390&atid=774489 Before requesting a feature, please check to see if the features has already been requested. BUG REPORTS
Any bugs found should be reported to the online bug-tracking system available on the web at : http://sourceforge.net/tracker/?func=add&group_id=149390&atid=774488. Before reporting bugs, please check to see if the bug has already been reported. When reporting PBNJ bugs, it is important to include a reliable way to reproduce the bug, version number of PBNJ and Nmap, OS name and version, and any relevant hardware specs. And of course, patches to rectify the bug are even better. SEE ALSO
scanpbnj(1) outputpbnj(1), nmap(1) AUTHORS
Joshua D. Abraham ( jabra@ccs.neu.edu ) LEGAL NOTICES
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details at http://www.gnu.org/copyleft/gpl.html, or in the COPYING file included with PBNJ. It should also be noted that PBNJ has occasionally been known to crash poorly written applications, TCP/IP stacks, and even operating systems. While this is extremely rare, it is important to keep in mind. PBNJ should never be run against mission critical systems unless you are prepared to suffer downtime. We acknowledge here that PBNJ may crash your systems or networks and we disclaim all liability for any damage or problems PBNJ could cause. perl v5.8.8 2006-11-06 GENLIST.MAN.1(1p)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy