Sponsored Content
Full Discussion: Running nmap via bash script
Top Forums Shell Programming and Scripting Running nmap via bash script Post 303026033 by hawkeyesc72 on Sunday 18th of November 2018 12:06:30 PM
Old 11-18-2018
Running nmap via bash script

Hello fellow scripters...

I am trying to set up a script for work that reads the contents of a file of IP address and network names, takes these and runs a given nmap scan against them and then saves the output to a file with the filename of the network name.

Such as...

IP file looks like this:
1.2.3.0/24 network1
2.3.4.0/24 network2

Script would cat the contents of this file, take the IP portion and put it in the nmap scan command and then the output of that nmap scan would be saved to a file called network1.nmap, network2.nmap, etc.

Is this possible? If so, how? It seems like I need to do *something* with the IP file so that the network address and name are saved/referenced separately I just can't figure out what I need to do to make this happen.

Thank you for any assistance and guidance you can offer!

------ Post updated at 05:06 PM ------

I am slightly new to scripting and volunteered to see if I could work this out to give myself some experience in both scripting and online research.
 

10 More Discussions You Might Find Interesting

1. Linux

Cannot running export database using bash script

Hi all, I'm new in linux. When I try to run a bash script, it doesn't execute and i receive the following error message 20070321:220002|ERROR||exportDatabase.bash|Another EXPORT process (pid=2799) is still running. If i kill this pid, i receive "No such process". This process was running... (5 Replies)
Discussion started by: tovohery
5 Replies

2. UNIX for Advanced & Expert Users

debugging an already running bash script

# ps -ef | grep rc root 13903 1 0 08:56 ? 00:00:00 /usr/sbin/automount --timeout=60 /archive file /etc/auto_archive root 10706 1 0 08:55 ? 00:00:00 /bin/bash /etc/rc.d/rc 3 root 2933 20071 0 19:38 pts/1 00:00:00 grep rc Is there any way to debug the... (1 Reply)
Discussion started by: marcpascual
1 Replies

3. Shell Programming and Scripting

Script running in bash 3.0 not in 3.2

I have wasted one working day writing this scripts. It compares two folders and make a good tabbed report about their differences. #!/bin/bash function DRAW_DEPTH () { ROUND=$1 while do printf %s " " ROUND=`expr $ROUND - 1` done printf %s "|- " } function MAIN () {... (9 Replies)
Discussion started by: trutoman
9 Replies

4. Shell Programming and Scripting

Validate BASH script before running it...

Hello, Is there some way to validate a bash script before running it. I want to make sure all of the syntax and everything is good so that I dont get a false return code. Thanks, tom (7 Replies)
Discussion started by: tjones1105
7 Replies

5. UNIX for Dummies Questions & Answers

Running Executable in Bash Script

Hey guys, so I've been trying to write a bash script called runSorter.sh that runs an executable that also takes in some parameters and outputs the results to a text file. The executable, sorter, takes in a number parameter. I want to make it so that you can input as many number parameters into... (4 Replies)
Discussion started by: Duo11
4 Replies

6. UNIX for Dummies Questions & Answers

Help Running a Check in Bash Script

Hey guys, so I wrote a small script that pretty much just takes in two numbers and counts from the first to the second, e.g. unknown-hacker|544> count.sh 1 3 1 2 3 My problem is I want to make it so that if you input invalid parameters, such as non-numerical characters, more than 2... (2 Replies)
Discussion started by: Duo11
2 Replies

7. Shell Programming and Scripting

bash script to check if a program is running

I'm a bit new to bash programming and I was assigned the job of writing a script that will check to see if a program server is running and to restart the program if it is not up. The script is supposed to check the program every hour (which I have looked up and I believe I know how to do) and send... (3 Replies)
Discussion started by: mcknz
3 Replies

8. Shell Programming and Scripting

script running by sh but not by bash

execute the attached script as, bash -x INFA_MAP_GEN_XML.sh "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/SOURCE" "INFA_TEMPLATE.csv" "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/TARGET" "UNIX" "/export/home/e120945/INFORMATICA_MAPPING_GENERATOR/SETUP"... (5 Replies)
Discussion started by: 120945
5 Replies

9. Shell Programming and Scripting

Bash shell script to check if script itself is running

hi guys we've had nagios spewing false alarm (for the umpteenth time) and finally the customer had enough so they're starting to question nagios. we had the check interval increased from 5 minutes to 2 minutes, but that's just temporary solution. I'm thinking of implementing a script on the... (8 Replies)
Discussion started by: hedkandi
8 Replies

10. Shell Programming and Scripting

Running options in bash script

Hello UNIX & Linux Forums community! Long time Linux daily user hobbyist, new to shell scripting.... I'm working on a script that does all the "work" in one script, and makes calls to a second script to display info to the user via mostly expanding variables in heredocs. I'm contemplating... (6 Replies)
Discussion started by: Cody Learner
6 Replies
ZENMAP(1)						      Zenmap Reference Guide							 ZENMAP(1)

NAME
zenmap - Graphical Nmap frontend and results viewer SYNOPSIS
zenmap [options] [results file] DESCRIPTION
Zenmap is a multi-platform graphical Nmap frontend and results viewer. Zenmap aims to make Nmap easy for beginners to use while giving experienced Nmap users advanced features. Frequently used scans can be saved as profiles to make them easy to run repeatedly. A command creator allows interactive creation of Nmap command lines. Scan results can be saved and viewed later. Saved scan results can be compared with one another to see how they differ. The results of recent scans are stored in a searchable database. This man page only describes the few Zenmap command-line options and some critical notes. A much more detailed Zenmap User's Guide is available at http://nmap.org/book/zenmap.html. Other documentation and information is available from the Zenmap web page at http://nmap.org/zenmap/. OPTIONS SUMMARY
-f, --file results file Open the given results file for viewing. The results file may be an Nmap XML output file (.xml, as produced by nmap -oX) or a Umit scan results file (.usr). This option may be given more than once. -h, --help Show a help message and exit. -n, --nmap Nmap command line Run the given Nmap command within the Zenmap interface. After -n or --nmap, every remaining command line argument is read as the command line to execute. This means that -n or --nmap must be given last, after any other options. Note that the command line must include the nmap executable name: zenmap -n nmap -sS target. -p, --profile profile Start with the given profile selected. The profile name is just a string: "Regular scan". If combined with -t, begin a scan with the given profile against the specified target. -t, --target target Start with the given target. If combined with -p, begin a scan with the given profile against the specified target. -v, --verbose Increase verbosity (of Zenmap, not Nmap). This option may be given multiple times to get even more verbosity. Any other arguments are taken to be the names of results files to open. ENVIRONMENT VARIABLES
ZENMAP_DEVELOPMENT Set ZENMAP_DEVELOPMENT to disable automatic crash reporting. BUGS
Like their authors, Nmap and Zenmap aren't perfect. But you can help make them better by sending bug reports or even writing patches. If Nmap or Zenmap doesn't behave the way you expect, first upgrade to the latest version available from http://nmap.org. If the problem persists, do some research to determine whether it has already been discovered and addressed. Try Googling the error message or browsing the nmap-dev archives at http://seclists.org/. Read this full manual page as well. If nothing comes of this, mail a bug report to <dev@nmap.org>. Please include everything you have learned about the problem, as well as what version of Zenmap you are running and what operating system version it is running on. Problem reports and Zenmap usage questions sent to dev@nmap.org are far more likely to be answered than those sent to Fyodor directly. Code patches to fix bugs are even better than bug reports. Basic instructions for creating patch files with your changes are available at https://svn.nmap.org/nmap/HACKING. Patches may be sent to nmap-dev (recommended) or to Fyodor directly. HISTORY
Zenmap was originally derived from Umit, an Nmap GUI created during the Google-sponsored Nmap Summer of Code in 2005 and 2006. The primary author of Umit was Adriano Monteiro Marques. When Umit was modified and integrated into Nmap in 2007, it was renamed Zenmap. AUTHORS
Nmap Fyodor <fyodor@nmap.org> (http://insecure.org) Hundreds of people have made valuable contributions to Nmap over the years. These are detailed in the CHANGELOG file which is distributed with Nmap and also available from http://nmap.org/changelog.html. Umit Zenmap is derived from the Umit Nmap frontend, which was started by Adriano Monteiro Marques as an Nmap/Google Summer of Code project (<py.adriano@gmail.com>, http://www.umitproject.org). Zenmap 07/28/2013 ZENMAP(1)
All times are GMT -4. The time now is 08:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy