Sponsored Content
Homework and Emergencies Homework & Coursework Questions How to scan IP range using nmap? Post 302993774 by sk151993 on Tuesday 14th of March 2017 08:55:18 AM
Old 03-14-2017
How to scan IP range using nmap?

Scripting language : Bash Shell Script

1. problem statement
I have to create function in which read IP addresses one by one from one file (iplist.txt) and scan these IP using nmap. This scan IP's output is saved in output.txt file and parse output.txt to save only open ports with particular IP in parse.txt file.
format of parse.txt file:

Code:
Code:
ip             port
x.x.x.x        x

2. My goal:
1. Find all ports open on a whole range.
2. Save only open ports with IP address in another file. Don't save filtered or closed ports in this file.

eg. Format of file:
IP_address Open_port
Code:
192.168.0.1         21
192.168.0.1         80
....

so I have write the script which scan IP range. I just want script of second option.
I have attached the script. Please help me if possible to implement second option. In second option, my script take open port/tcp and all other details but i want only ip address with open port.

Mumbai University, Mumbai, India and Information Technology




Moderator's Comments:
Mod Comment Seriously: Please use CODE tags as required by forum rules!

And, use homework form correctly and entirely.

Last edited by RudiC; 03-14-2017 at 10:07 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Cybersecurity

Nmap

I am pretty new at running nmap ,and i have some doubt about some o/ps the nmap shows I tried to scan my own system for UDP open ports I see that if i use one UDP port say 13 It shows that its in open state , etc But if i scan for the whole UDP ports in the nmap-services . I gives te... (2 Replies)
Discussion started by: DPAI
2 Replies

2. UNIX for Dummies Questions & Answers

nmap results

Hi, Whenever I tried to run nmap on my linux (red hat 6.2) boxes i got these outputs: 4444/tcp filtered krb524 6666/tcp filtered irc-serv 6699/tcp filtered napster 8888/tcp filtered sun-answerbook Can anybody please... (10 Replies)
Discussion started by: necro
10 Replies

3. Shell Programming and Scripting

Nmap PHP FE

Hi everyone! I've temporarily come out of hibernation (and will be gone for about two weeks after this post too) to ask for input on a small PHP script I have just completed. The script aims to be a remote front-end for Nmap - now for the safety of this post, I ask that any replies refrain from... (6 Replies)
Discussion started by: Karma
6 Replies

4. AIX

nmap on aix 5.2

I'm trying to compile nmap 4.11 on an aix 5.2 machine and get the following error when attempting the 'make' command; make "Makefile", line 1: make: 1254-055 Dependency line needs colon or double colon operator. "Makefile", line 14: make: 1254-055 Dependency line needs colon or double colon... (2 Replies)
Discussion started by: zuessh
2 Replies

5. Shell Programming and Scripting

print range between two patterns if it contains a pattern within the range

I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated. e.g. Pattern1 Bombay Calcutta Delhi Pattern2 Pattern1 Patna Madras Gwalior Delhi Pattern2 Pattern1... (2 Replies)
Discussion started by: joyan321
2 Replies

6. Solaris

Nmap error

I 'm getting following error when i run nmap for an ip .. what could be the reason for it ? #nmap 10.22.67.18 Starting Nmap 4.68 ( Nmap - Free Security Scanner For Network Exploration & Security Audits. ) at 2009-07-06 19:07 UTC Warning: Unable to open interface e1000g3301000 -- skipping it.... (2 Replies)
Discussion started by: fugitive
2 Replies

7. UNIX for Dummies Questions & Answers

nmap scan for survey command

Hello guys, i'm having a problem with nmap, what i'd like to do is a scan to find around 100 or so IP address that are up, and that correspond to sites. The command i need should basically find sites through ip address randomly generated, let's say i generate 2000 ip, i'd like to know how many of... (0 Replies)
Discussion started by: AscaL
0 Replies

8. Cybersecurity

Help with NMAP

I'm seeing a persistent address showing up on my firewall router logs. The address is 10.98.115.9:67, and is broadcasting to 255.255.255.255. I know that this would typically signal a BOOTP service, such as a bootp server announcing itself on the network. But I can't isolate which machine it... (3 Replies)
Discussion started by: renoir611
3 Replies

9. IP Networking

Why Nmap UDP need Root?

I was just wondering, why does Nmap need root when doing an -sU UDP Scan? Please and Thank You. (3 Replies)
Discussion started by: amreason
3 Replies

10. Shell Programming and Scripting

How to scan IP range using nmap?

Scripting language : Bash Shell Script I have to create function in which read IP addresses one by one from one file (ip.txt) and scan these IP using nmap. (4 Replies)
Discussion started by: sk151993
4 Replies
scanssh(1)						    BSD General Commands Manual 						scanssh(1)

NAME
scanssh -- scans the Internet for open proxies and SSH servers SYNOPSIS
scanssh [-VIERph] [-s scanners,...] [-n ports,...] [-e excludefile] addresses... DESCRIPTION
ScanSSH scans the given addresses and networks for running services. It mainly allows the detection of open proxies and Internet services. For known services, ScanSSH will query their version number and displays the results in a list. The adresses can be either specified as an IPv4 address or an CIDR like IP prefix, ipaddress/masklength. Ports can be appended by adding a colon at the end of address specification. Additionally, the following two commands can be prefixed to the address: random(n[,seed])/ The random command selects random address from the address range specified. The arguments are as follows: n is the number of address to randomly create in the given network and seed is a seed for the pseudo random number generator. split(s,e)/ The split command is used to split the address range in several unique components. This can be use to scan from serveral hosts in parallel. The arguments are as follows: e specifies the number of hosts scanning in parallel and s is the number of the host this particular scan runs on. The options are as follows: -V Causes scanssh to print its version number. -I Does not send a SSH identification string. -E Exit the program, if the file containing the addresses for exclusion can not be found. -R If addresses are generated at random, this flag causes the program to ignore excluded addresses from the exclude file. The default behaviour is to always exclude addresses. -p Specifies that ScanSSH should operate as a proxy detector. This flag sets the default modes and default scanners to detect open proxies. -h Displays the usage of the program. -n ports,... Specifies the port numbers to scan. Ports are separated by commas. Each specified scanner is run for each port in this list. The default is 22. -s scanners Specifies a number of scanners should be executed for each open port. Multiple scanners are separated by commas. The fol- lowing scanners are currently supported: ssh Finds versions for SSH, Web and SMTP servers. socks5 Detects if a SOCKS V5 proxy is running on the port. socks4 Detects if a SOCKS V4 proxy is running on the port. http-proxy Detects a HTTP get proxy. http-connect Detects a HTTP connect proxy. telnet-proxy Detects telnet based proxy servers. -e excludefile Specifies the file that contains the addresses to be excluded from the scan. The syntax is the same as for the addresses on the command line. The output from scanssh contains only IP addresses. However, the IP addresses can be converted to names with the logresolve(8) tool included in the Apache webserver. EXAMPLES
The following command scans the class C network 10.0.0.0 - 10.0.0.255 for open proxies: scanssh -p 10.0.0.0/24 The next command scans for ssh servers on port 22 only: scanssh -n 22 -s ssh 192.168.0.0/16 The following command can be used in a parallel scan. Two hosts scan the specified networks randomly, where this is the first host: scanssh 'random(0,rsd)/split(1,2)/(192.168.0.0/16 10.1.0.0/24):22,80' BUGS
At the moment, scanssh leaves a one line entry in the log file of the ssh server. It is probably not possible to avoid that. BSD
July 17, 2000 BSD
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy