Monday, October 3, 2016

Script Kiddie Network Mapper/Profiler

Here's a simple python script to quickly port scan a network (All TCP, default UDP via NMAP) and then Nikto scan common webserver ports (80, 443)

Written as a quick/rough tool for automation of simple "script kiddie" tasks.

Just the basics for now. System for scanning is passed as an argument. Can be individual or in CIDR notation.

Run this with correct arguments, grab a cup of coffee and come back in a few minutes.

#
#
#
#
#
# CODE STARTS HERE
import sys, os, platform
from netaddr import *

ip = IPNetwork(sys.argv[1])

# Quick Network Mapping Tool
#This will scan the target host without a ping, full TCP scan, all ports
def nmapfull(host):

    # NMAP Command
    nmap_str = "-sV -O -p 1-65535 -Pn"
    # NMAP
    return os.system("nmap" + " " + nmap_str + " " + str(ip))

#This will scan the target, with a ping, quick UDP scan
def nmapudp(host):


    # NMAP Command
    nmap_str = "-sU -O"

    # NMAP
    return os.system("nmap" + " " + nmap_str + " " + str(ip))

#This will nikto the host on port 80 (default http)
def nikto(host):

    # NIKTO Command
    nikto_str = "-h " + str(ip) + " -p" + " 80"

    # RUN NIKTO
    return os.system("nikto" + " " + nikto_str + " " + str(ip))

#This will nikto the host on port 443 (default https)
def niktossl(host):

    # NIKTO Command
    nikto_str = "-h " + str(ip) + " -p" + " 443"

    # RUN NIKTO
    return os.system("nikto" + " " + nikto_str + " " + str(ip))


for ip in IPSet([ip]):
      print(ip)
      print ("IP "  + str(ip) + " Results for FULL nmap")
      nmapfull(ip)
      print ("IP "  + str(ip) + " Results for UDP nmap")
      nmapudp(ip)
      print ("IP "  + str(ip) + " Results for port 80 nikto")
      nikto(ip)
      print ("IP " + str(ip) + " has been nikto scanned.")
      print ("IP " + str(ip) + " Results for port 443 nikto")
      niktossl(ip)
      print ("IP " + str(ip) + " has been nikto SSL scanned.")



2 comments: