From 6842925eeea5ab4afda255e48ec4b0d028067972 Mon Sep 17 00:00:00 2001 From: aisthanestha Date: Mon, 26 Sep 2016 21:52:09 -0500 Subject: [PATCH] made own repo --- nmap.py | 111 ++++++++++++++++++++++++++++++++++++ nmap.sh | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 284 insertions(+) create mode 100644 nmap.py create mode 100644 nmap.sh diff --git a/nmap.py b/nmap.py new file mode 100644 index 0000000..f69901c --- /dev/null +++ b/nmap.py @@ -0,0 +1,111 @@ +#!/usr/bin/python +import os + +#Global Elite(variables) +add_oa_valid="0" +oa_adder="" +# Functions +def fping_txt(): + #print "Set fping range for scan: (192.168.1.0/24 or 192.168.1.0-254)" + fping_target = raw_input("Set fping range for scan: (192.168.1.0-254)") + os.system("cd")#Make sure we are in root directory. + os.system("rm ~/fping.txt") #It will only append to fping.txt this will make it have a fresh file to append to. + print "%s has been selected" % fping_target + print "fping is running, kickback and chill" + print "when finished fping will spit out ~/fping.txt" + os.system("fping -a -g %s >> fping.txt" % (fping_target)) + print "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" + print "fping should be finished now!" + print "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" + +def menu(): + print "#############################" + print "# #" + print "# CHOOSE ARGUMENTS #" + print "# FOR NMAP #" + print "# #" + print "#############################\n" + print "This is a list of precompiled slightly modular cmds" + print "By defualt all NMAP cmds are set to -T4" + print "-T4 sends packets at an aggressive rate or 1.25p/s\n" + print "#############################" + print "0. HOST DISCOVERER - USES NMAP TO CHECK IF TARGET(s) ARE ALIVE" + print "1. FULL SCAN - ALL PORTS (0-65,535)" + print "2. TCP CONNECT, OS, DETAILED SERVICE SCAN FOR OPEN PORTS" + print "3. VIOLATE TCP CONNECTION WITH XMAS" + print "4. MASSCAN PORT 80 OF TARGET(s)" + print "Anything else to exit." + print "#############################\n" + +def menu_selector(): + menu_choice = raw_input("Choose from above") + if menu_choice == "0": print "0.Selected Host Discoverer..." + elif menu_choice == "1": print "1.Selected Full Scan..." + elif menu_choice == "2": print "2.Selected TCP Connect..." + elif menu_choice == "3": print "3.Selected TCP Violation..." + elif menu_choice == "4": print "4.Selected Masscan..." + else: print "Exiting..." + return menu_choice + +def cmd_list(oa_adder): + menu_choice = menu_selector() + os.system("cd") + if menu_choice == "0": print "nmap -T4 -sn -iL ~/fping.txt %s" % oa_adder;os.system("nmap -T4 -sn -iL ~/fping.txt %s" % oa_adder) + elif menu_choice == "1": print "nmap -T4 -p- -iL ~/fping.txt %s" % oa_adder; os.system("nmap -T4 -p- -iL ~/fping.txt %s" % oa_adder) + elif menu_choice == "2": print "nmap -T4 -O -sT -sV -iL ~/fping.txt %s" % oa_adder;os.system("nmap -T4 -O -sT -sV -iL ~/fping.txt %s" % oa_adder) + elif menu_choice == "3": print "nmap -T4 -sX -iL ~/fping.txt %s" % oa_adder;os.system("nmap -T4 -sX -iL ~/fping.txt %s" % oa_adder) + elif menu_choice == "4": print "masscan -p80 -iL ~/fping.txt";os.system("masscan -p80 -iL ~/fping.txt") + else: print "" +### +# +#Main body of script +# +### + +print "Start of script..." + + +#print "Generate a target list with fping? [y/n]" + +valid_choice="0" +while valid_choice=="0": + fping_creator = raw_input("Generate a target list with fping?[y/n]").lower() + if fping_creator=="y" or fping_creator=="yes": + print "Starting fping" + fping_txt() + valid_choice="1" + elif fping_creator=="n" or fping_creator=="no": + print "We will not be generating a target list with fping" + valid_choice="1" + else: print "Enter a valid choice ('yes','y', 'n', 'no')" + +valid_open="0" +while valid_open=="0": + open_fping = raw_input("Would you like to edit ~/fping.txt?[y/n]").lower() + if open_fping == "y" or open_fping=="yes": + raw_input("Opening Vim\nPress [ENTER]") + os.system("vim ~/fping.txt") + valid_open="1" + elif open_fping == "n" or open_fping=="no": + print "We won't edit ~/fping.txt" + valid_open="1" + else: print "Enter valid choice ('yes', 'y', 'n', 'no')" + +valid_oa="0" +while valid_oa=="0": + add_oa = raw_input("Do you want to add NMAP output file?[y/n]").lower() + + if add_oa == "y" or add_oa=="yes": + name_oa = raw_input("What do you want to name the output file?") + valid_oa="1" + add_oa_valid="1" #checks later if we should actually add this to cmd + oa_adder="-oA " + name_oa + elif add_oa == "n" or add_oa=="no": + print "There will be no output file for NMAP" + valid_oa="1" + else: print "Enter a valid choice ('yes', 'y', 'n', 'no')" + +menu() +cmd_list(oa_adder) + +print "End of script..." diff --git a/nmap.sh b/nmap.sh new file mode 100644 index 0000000..e3c0416 --- /dev/null +++ b/nmap.sh @@ -0,0 +1,173 @@ +#!/bin/shell +#Gregory Hendrickson +#Should run NMAP CMDs for you, Select what you want, aswell as set target. + +#Functions are here +fping() +{ + echo "Set fping range for scan: (192.168.1.0/24 or 192.168.1.0-254)" + read fping_target + cd + echo "fping is running, kickback and chill" + echo "when finished fping will spit out~/fping.txt" + fping -a -g $fping_target > fping.txt + echo "fping should be done!" +} + +choices() +{ + + echo "We'll be using ~/fping.txt for targets. " + echo "Press [Enter] to continue " + read garbo + + + echo "Do you want to create a NMAP output file?[y/n]" + read out + put_in=0 + if [ $out = "y" ] + then + echo "Name the output file" + read name + echo "$name was chosen for name" + put_in=1 + echo "Output will be in ~/" + + else + echo "There will be no output file" + fi + + echo "Do you want to open fping.txt to edit it?[y/n]" + read open + if [ $open = "y" ] + then + echo "Opening vim press [Enter] to continue" + read garbo + vim fping.txt + else + echo "We won't be editing fping.txt then" + fi + + echo "###########################" + echo "# Choose Arguments #" + echo "# for NMAP #" + echo "###########################" + + echo "List of precompiled NMAP commands, choose from list" + echo "By defualt i've set the timing options to -T4 for all commands." + echo "-T4 sends packets at an aggresive rate of 1.25seconds"i + echo "-iL is used to feed a list of IPs" + echo "#####################################################################" + echo "0. Host discoverer - Runs NMAP and checks for hosts that are alive. " + echo "1. Full scan - All ports (65,535) " + echo "2. TCP CONNECT, OS, DETAILED SERVICE SCAN FOR OPEN PORTS " + echo "3. Violate TCP, FeelsBadMan ;(" + echo "4. Non-NMAP command, portscanner" + echo "5. Nothing" + echo "6. Nothing" + echo "7. n0thing" + echo "8. Still has nothing" + echo "#####################################################################" + + + + read NUM + + + + case $NUM in + 0) + echo "-sn is a ping sweep no scanning of ports" + if [ $put_in=1 ] + then + nmap -T4 -sn -iL ~/fping.txt -oA $name + echo "nmap -T4 -sn -iL ~/fping.txt -oA $name" + else + nmap -T4 -sn -iL ~/fping.txt + echo "nmap -T4 -sn -iL ~/fping.txt" + fi + + ;; + 1) + echo "-p- scans all ports of the target (0-65,535)" + if [ $put_in=1 ] + then + nmap -T4 -p- -iL ~/fping.txt -oA $name + echo "nmap -T4 -p- -iL ~/fping.txt -oA $name" + else + nmap -T4 -p- -iL ~/fping.txt + echo "nmap -T4 -p- -iL ~/fping.txt" + fi + + + ;; + 2) + echo "-O determines OS, -sT connects with TCP, -sV determines services open" + if [ $put_in=1 ] + then + nmap -T4 -O -sT -sV -iL ~/fping.txt -oA $name + echo "nmap -T4 -O -sT -sV -iL ~/fping.txt -oA $name" + else + nmap -T4 -O -sT -sV -iL ~/fping.txt + echo "nmap -T4 -O -sT -sV -iL ~/fping.txt" + fi + ;; + 3) + echo "-sX is a XMAS scan, sets the FIN, PSH, and URG flags" + echo "This will determine if a port is closed or open|filtered" + + if [ $put_in=1 ] + then + nmap -T4 -sX -iL ~/fping.txt -oA $name + echo "nmap -T4 -sX -iL ~/fping.txt -oA $name" + else + nmap -T4 -sX -iL ~/fping.txt + echo "nmap -T4 -sX -iL ~/fping.txt" + fi + + ;; + 4) + echo "This is a masscan" + echo "comes on kali, it is a asynchronous TCP port scanner" + masscan -p80 -iL ~/fping.txt + echo "masscan is similiar to nmap" + echo "masscan -p80 -iL ~/fping.txt" + echo "-p80 selects port 80 to scan" + + + + + ;; + 5);; + 6);; + 7);; + 8);; + esac + +} + + + + + +##### +# +# Main Body of Script +# +#### + + echo "Start of script..." + + #echo "Generate target list with fping?[y/n]" + + #read list + + # if [ $list = "y" ] + # then + # fping + #else + # echo "Awesome!\n" + # fi + choices + + echo "End of script..."