diff --git a/README.md b/README.md index 60a30a5..5e7f53f 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # gutterbox +nmap -O -oX scan.xml 192.168.1.0/24 diff --git a/greppy.sh b/greppy.sh deleted file mode 100644 index e578bfa..0000000 --- a/greppy.sh +++ /dev/null @@ -1,6 +0,0 @@ -NMAP_FILE="scant" - -egrep -v "^#|Status: Up" $NMAP_FILE | cut -d' ' -f2 -f4- | \ -sed -n -e 's/Ignored.*//p' | \ -awk -F, '{split($0,a," "); printf "Host: %-20s Ports Open: %d\n" , a[1], NF}' \ -| sort -k 5 -g diff --git a/index.php b/index.php index dbda925..f0f138d 100644 --- a/index.php +++ b/index.php @@ -2,30 +2,47 @@ GutterBox + - +

This might help

+ +
+ + + + +query("SELECT os,hostname,address,ports FROM targets"); foreach($targets as $tar) { - echo ""; - if($tar['os'] == "windows"){ - echo ""; + echo "\t\n"; + if(strtolower($tar['os']) == "windows"){ + echo "\t\t\n"; + }else if(strtolower($tar['os']) == "linux"){ + echo "\t\t\n"; }else{ - echo ""; + echo "\t\t\n"; } - echo ""; - echo ""; - echo ""; - echo ""; + echo "\t\t\n"; + echo "\t\t\n"; + echo "\t\t\n"; + echo "\t\n"; } ?> +
OS + HOSTNAME + ADDRESS + PORTS +
".$tar['hostname']."".$tar['address']."".$tar['ports']."
".$tar['hostname']."".$tar['address']."".$tar['ports']."
- \ No newline at end of file + diff --git a/media/unsure.png b/media/unsure.png new file mode 100755 index 0000000..294a5ba Binary files /dev/null and b/media/unsure.png differ diff --git a/parser.py b/parser.py index 5dcab42..290dd46 100644 --- a/parser.py +++ b/parser.py @@ -1,8 +1,35 @@ +import xml.etree.ElementTree as ET from sqlite3 import Error +import argparse import sqlite3 import sys import re + +parser = argparse.ArgumentParser(description='Convert your nmap scans into a sqlite database!') +parser.add_argument('-d', type=str, help='The database file to use') +parser.add_argument('-x', type=str, help='The xml file to read from, please use -oX with nmap') +args = parser.parse_args() + + +if(args.d == None or args.x == None): + raise("Must have a database and xml file!") + + +class target: + def __init__(self, os,hostname,address,ports): + self.os = os + self.hostname = hostname + self.address = address + self.ports = ports + + def ptarg(self): + print("{}\n{}\n{}\n{}\n".format(self.os,self.hostname,self.address,self.ports)) + + def add(self,conn): + add_item(conn,self.os,self.hostname,self.address,self.ports) + + def create_connection(database): """ Connects to the database file """ try: @@ -10,7 +37,7 @@ def create_connection(database): return conn except Error as e: print(e) - + return None def create_table(conn, create_table_sql): @@ -34,7 +61,8 @@ def add_item(conn, os, hostname, address, ports): def main(): """ Connect to the database file """ - database = 'scanned.db' + + database = args.d conn = create_connection(database) if conn is None: @@ -50,7 +78,37 @@ def main(): ); """ create_table(conn, targetTableCreate) - add_item(conn, "windows", "localhost", 1, "80,69,8080") + + # Start parsing the xml + tree = ET.parse(args.x) + root = tree.getroot() + targets = [] + + for host in root.iter('host'): + os = None + hostname = None + address = None + ports = [] + + for o in host.iter('osclass'): + os = str(o.attrib['osfamily']) + + for hm in host.iter('hostname'): + hostname = str(hm.attrib['name']) + + for addr in host.iter('address'): + if(addr.attrib['addrtype'] == 'ipv4'): + address = str(addr.attrib['addr']).split('.')[-1] + + for port in host.iter('port'): + ports.append(str(port.attrib['portid'])) + + + + targets.append(target(os, hostname, address, ', '.join(ports))) + # Write the targets to the database + for tar in targets: + tar.add(conn) # Close the database connection conn.commit() diff --git a/sav.txt b/sav.txt deleted file mode 100644 index ef6ab4a..0000000 --- a/sav.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Nmap 7.70 scan initiated Mon Feb 18 01:16:33 2019 as: nmap -O -oG scant 192.168.1.0/24 -Host: 192.168.1.1 () Status: Up -Host: 192.168.1.1 () Ports: 22/open/tcp//ssh///, 80/open/tcp//http///, 443/open/tcp//https/// Ignored State: filtered (997) Seq Index: 261 IP ID Seq: Randomized -Host: 192.168.1.10 () Status: Up -Host: 192.168.1.10 () Ports: 22/open/tcp//ssh///, 5900/open/tcp//vnc/// Ignored State: closed (998) OS: Linux 3.10 - 4.11 Seq Index: 259 IP ID Seq: All zeros -Host: 192.168.1.20 () Status: Up -Host: 192.168.1.20 () Ports: 21/open/tcp//ftp///, 22/open/tcp//ssh///, 80/open/tcp//http///, 111/open/tcp//rpcbind/// Ignored State: closed (996) OS: Linux 3.10 - 4.11 Seq Index: 256 IP ID Seq: All zeros -Host: 192.168.1.40 () Status: Up -Host: 192.168.1.40 () Ports: 22/open/tcp//ssh///, 25/open/tcp//smtp///, 110/open/tcp//pop3///, 111/open/tcp//rpcbind///, 143/open/tcp//imap///, 993/open/tcp//imaps///, 995/open/tcp//pop3s/// Ignored State: closed (993) OS: Linux 3.10 - 4.11 Seq Index: 262 IP ID Seq: All zeros -Host: 192.168.1.50 () Status: Up -Host: 192.168.1.50 () Ports: 22/open/tcp//ssh///, 80/open/tcp//http///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds/// Ignored State: closed (996) OS: Linux 3.10 - 4.11 Seq Index: 256 IP ID Seq: All zeros -Host: 192.168.1.60 () Status: Up -Host: 192.168.1.60 () Ports: 21/open/tcp//ftp///, 22/open/tcp//ssh///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 5900/open/tcp//vnc/// Ignored State: closed (995) OS: Linux 3.10 - 4.11 Seq Index: 259 IP ID Seq: All zeros -Host: 192.168.1.70 () Status: Up -Host: 192.168.1.70 () Ports: 53/open/tcp//domain///, 80/open/tcp//http///, 88/open/tcp//kerberos-sec///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 389/open/tcp//ldap///, 443/open/tcp//https///, 445/open/tcp//microsoft-ds///, 464/open/tcp//kpasswd5///, 593/open/tcp//http-rpc-epmap///, 636/open/tcp//ldapssl///, 3268/open/tcp//globalcatLDAP///, 3269/open/tcp//globalcatLDAPssl///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49155/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown///, 49159/open/tcp//unknown/// Ignored State: closed (979) OS: Microsoft Windows Server 2012 R2 Seq Index: 258 IP ID Seq: Incremental -Host: 192.168.1.80 () Status: Up -Host: 192.168.1.80 () Ports: 53/open/tcp//domain///, 80/open/tcp//http///, 88/open/tcp//kerberos-sec///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 389/open/tcp//ldap///, 443/open/tcp//https///, 445/open/tcp//microsoft-ds///, 464/open/tcp//kpasswd5///, 593/open/tcp//http-rpc-epmap///, 636/open/tcp//ldapssl///, 3268/open/tcp//globalcatLDAP///, 3269/open/tcp//globalcatLDAPssl///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49155/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown///, 49159/open/tcp//unknown/// Ignored State: closed (979) OS: Microsoft Windows Server 2012 R2 Seq Index: 259 IP ID Seq: Incremental -Host: 192.168.1.90 () Status: Up -Host: 192.168.1.90 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 1433/open/tcp//ms-sql-s///, 3389/open/tcp//ms-wbt-server/// Ignored State: closed (995) Seq Index: 252 IP ID Seq: Incremental -Host: 192.168.1.100 () Status: Up -Host: 192.168.1.100 () Ports: 80/open/tcp//http///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49157/open/tcp//unknown/// Ignored State: closed (991) OS: Microsoft Windows Vista Home Premium SP1, Windows 7, or Windows Server 2008 Seq Index: 255 IP ID Seq: Incremental -Host: 192.168.1.110 () Status: Up -Host: 192.168.1.110 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server/// Ignored State: closed (996) Seq Index: 261 IP ID Seq: Incremental -Host: 192.168.1.114 () Status: Up -Host: 192.168.1.114 () Status: Up -Host: 192.168.1.120 () Status: Up -Host: 192.168.1.120 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown/// Ignored State: filtered (992) OS: Microsoft Windows 7 Professional or Windows 8|Microsoft Windows Vista SP0 or SP1, Windows Server 2008 SP1, or Windows 7|Microsoft Windows Vista SP2, Windows 7 SP1, or Windows Server 2008 Seq Index: 255 IP ID Seq: Incremental -Host: 192.168.1.113 () Status: Up -Host: 192.168.1.113 () Status: Up -# Nmap done at Mon Feb 18 01:17:54 2019 -- 256 IP addresses (14 hosts up) scanned in 81.65 seconds diff --git a/scan.py b/scan.py deleted file mode 100644 index 2258391..0000000 --- a/scan.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys -import nmap -# initialize the port scanner -nmScan = nmap.PortScanner() - -# scan localhost for ports in range 21-443 -nmScan.scan('127.0.0.1', '21-443') - -# run a loop to print all the found result about the ports -for host in nmScan.all_hosts(): - sys.stdout.write("{};{};{};".format(host, nmScan[host].hostname(), nmScan[host].state()) ) - for proto in nmScan[host].all_protocols(): - sys.stdout.write("{};".format(proto)) - lport = nmScan[host][proto].keys() - lport = sorted(lport) - for port in lport: - sys.stdout.write("{};{};".format(port, nmScan[host][proto][port]['state'])) - sys.stdout.write("\n") diff --git a/scant.txt b/scant.txt deleted file mode 100644 index ef6ab4a..0000000 --- a/scant.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Nmap 7.70 scan initiated Mon Feb 18 01:16:33 2019 as: nmap -O -oG scant 192.168.1.0/24 -Host: 192.168.1.1 () Status: Up -Host: 192.168.1.1 () Ports: 22/open/tcp//ssh///, 80/open/tcp//http///, 443/open/tcp//https/// Ignored State: filtered (997) Seq Index: 261 IP ID Seq: Randomized -Host: 192.168.1.10 () Status: Up -Host: 192.168.1.10 () Ports: 22/open/tcp//ssh///, 5900/open/tcp//vnc/// Ignored State: closed (998) OS: Linux 3.10 - 4.11 Seq Index: 259 IP ID Seq: All zeros -Host: 192.168.1.20 () Status: Up -Host: 192.168.1.20 () Ports: 21/open/tcp//ftp///, 22/open/tcp//ssh///, 80/open/tcp//http///, 111/open/tcp//rpcbind/// Ignored State: closed (996) OS: Linux 3.10 - 4.11 Seq Index: 256 IP ID Seq: All zeros -Host: 192.168.1.40 () Status: Up -Host: 192.168.1.40 () Ports: 22/open/tcp//ssh///, 25/open/tcp//smtp///, 110/open/tcp//pop3///, 111/open/tcp//rpcbind///, 143/open/tcp//imap///, 993/open/tcp//imaps///, 995/open/tcp//pop3s/// Ignored State: closed (993) OS: Linux 3.10 - 4.11 Seq Index: 262 IP ID Seq: All zeros -Host: 192.168.1.50 () Status: Up -Host: 192.168.1.50 () Ports: 22/open/tcp//ssh///, 80/open/tcp//http///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds/// Ignored State: closed (996) OS: Linux 3.10 - 4.11 Seq Index: 256 IP ID Seq: All zeros -Host: 192.168.1.60 () Status: Up -Host: 192.168.1.60 () Ports: 21/open/tcp//ftp///, 22/open/tcp//ssh///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 5900/open/tcp//vnc/// Ignored State: closed (995) OS: Linux 3.10 - 4.11 Seq Index: 259 IP ID Seq: All zeros -Host: 192.168.1.70 () Status: Up -Host: 192.168.1.70 () Ports: 53/open/tcp//domain///, 80/open/tcp//http///, 88/open/tcp//kerberos-sec///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 389/open/tcp//ldap///, 443/open/tcp//https///, 445/open/tcp//microsoft-ds///, 464/open/tcp//kpasswd5///, 593/open/tcp//http-rpc-epmap///, 636/open/tcp//ldapssl///, 3268/open/tcp//globalcatLDAP///, 3269/open/tcp//globalcatLDAPssl///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49155/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown///, 49159/open/tcp//unknown/// Ignored State: closed (979) OS: Microsoft Windows Server 2012 R2 Seq Index: 258 IP ID Seq: Incremental -Host: 192.168.1.80 () Status: Up -Host: 192.168.1.80 () Ports: 53/open/tcp//domain///, 80/open/tcp//http///, 88/open/tcp//kerberos-sec///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 389/open/tcp//ldap///, 443/open/tcp//https///, 445/open/tcp//microsoft-ds///, 464/open/tcp//kpasswd5///, 593/open/tcp//http-rpc-epmap///, 636/open/tcp//ldapssl///, 3268/open/tcp//globalcatLDAP///, 3269/open/tcp//globalcatLDAPssl///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49155/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown///, 49159/open/tcp//unknown/// Ignored State: closed (979) OS: Microsoft Windows Server 2012 R2 Seq Index: 259 IP ID Seq: Incremental -Host: 192.168.1.90 () Status: Up -Host: 192.168.1.90 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 1433/open/tcp//ms-sql-s///, 3389/open/tcp//ms-wbt-server/// Ignored State: closed (995) Seq Index: 252 IP ID Seq: Incremental -Host: 192.168.1.100 () Status: Up -Host: 192.168.1.100 () Ports: 80/open/tcp//http///, 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server///, 49152/open/tcp//unknown///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49157/open/tcp//unknown/// Ignored State: closed (991) OS: Microsoft Windows Vista Home Premium SP1, Windows 7, or Windows Server 2008 Seq Index: 255 IP ID Seq: Incremental -Host: 192.168.1.110 () Status: Up -Host: 192.168.1.110 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server/// Ignored State: closed (996) Seq Index: 261 IP ID Seq: Incremental -Host: 192.168.1.114 () Status: Up -Host: 192.168.1.114 () Status: Up -Host: 192.168.1.120 () Status: Up -Host: 192.168.1.120 () Ports: 135/open/tcp//msrpc///, 139/open/tcp//netbios-ssn///, 445/open/tcp//microsoft-ds///, 3389/open/tcp//ms-wbt-server///, 49153/open/tcp//unknown///, 49154/open/tcp//unknown///, 49157/open/tcp//unknown///, 49158/open/tcp//unknown/// Ignored State: filtered (992) OS: Microsoft Windows 7 Professional or Windows 8|Microsoft Windows Vista SP0 or SP1, Windows Server 2008 SP1, or Windows 7|Microsoft Windows Vista SP2, Windows 7 SP1, or Windows Server 2008 Seq Index: 255 IP ID Seq: Incremental -Host: 192.168.1.113 () Status: Up -Host: 192.168.1.113 () Status: Up -# Nmap done at Mon Feb 18 01:17:54 2019 -- 256 IP addresses (14 hosts up) scanned in 81.65 seconds diff --git a/style.css b/style.css index 3471cb9..e8f0703 100644 --- a/style.css +++ b/style.css @@ -1,11 +1,13 @@ -*{ - background-color: white; +body{ + background-color: black; color: black; font-family: Arial, Helvetica, sans-serif; + text-align:center; + margin:2% 5% 0 5%; } -body{ - width: 90%; +h2{ + color:gray; } #scan-table{ @@ -13,15 +15,40 @@ body{ height: 100%; } -.table-header{ - background-color: B9C9FE; +th{ + padding:5px; } - -.table-row{ +tr{ border:1px solid white; + background-color: #E8EDFF; +} +td{ + padding:5px; +} +.table-header{ + border-bottom:10px solid white; font-weight: bold; - background-color: E8EDFF; + background-color: #B9C9FE; +} + + +tbody tr:hover td { + background-color: #FFEFC6; + cursor: pointer; +} + + +table tr:last-child td:first-child { + border-bottom-left-radius: 10px; +} +table tr:first-child th:first-child { + border-top-left-radius: 10px; +} + +table tr:last-child td:last-child { + border-bottom-right-radius: 10px; +} +table tr:first-child th:last-child { + border-top-right-radius: 10px; } -.windows{background-image: url('media/windows.png');} -.linux{background-image: url('media/linux.png');} \ No newline at end of file