Browse Source

random updates

Marius Schwarz 4 years ago
parent
commit
572ae5ecea
6 changed files with 14 additions and 43 deletions
  1. 9 4
      example.gnmap
  2. 1 0
      example.json
  3. 0 4
      example2.gnmap
  4. 0 0
      example3.gnmap
  5. 4 4
      nmap-get.py
  6. 0 31
      nmap-pp.py

+ 9 - 4
example.gnmap

@@ -1,4 +1,9 @@
-# Nmap 7.80 scan initiated Wed Nov  4 20:36:10 2020 as: nmap -oG example.gnmap 127.0.0.1
-Host: 127.0.0.1 (localhost)	Status: Up
-Host: 127.0.0.1 (localhost)	Ports: 9080/open/tcp//glrpc///, 9090/open/tcp//zeus-admin///	Ignored State: closed (998)
-# Nmap done at Wed Nov  4 20:36:10 2020 -- 1 IP address (1 host up) scanned in 0.17 seconds
+# Nmap 7.80 scan initiated Wed Nov  4 21:42:17 2020 as: nmap -sC -sV -T5 -oG example2.gnmap scanme.nmap.org
+Host: 45.33.32.156 (scanme.nmap.org)	Status: Up
+Host: 45.33.32.156 (scanme.nmap.org)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+Host: 127.0.0.1 (bullshit.host)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+Host: 127.0.0.2 (bullshit.host)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+Host: 127.0.0.4 (bullshit.host)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+Host: 127.0.0.3 (bullshit.host)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+Host: 127.0.0.4 (bullshit.host)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
+# Nmap done at Wed Nov  4 21:42:41 2020 -- 1 IP address (1 host up) scanned in 24.35 seconds

+ 1 - 0
example.json

@@ -0,0 +1 @@
+[{"ip":"45.33.32.156","status":"Up","hostname":"scanme.nmap.org","ports":[{"port_number":22,"state":"open","protocol":"tcp","owner":"","service":"ssh","sun_rpc_info":"","version":"OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)"},{"port_number":80,"state":"open","protocol":"tcp","owner":"","service":"http","sun_rpc_info":"","version":"Apache httpd 2.4.7 ((Ubuntu))"},{"port_number":9929,"state":"open","protocol":"tcp","owner":"","service":"nping-echo","sun_rpc_info":"","version":"Nping echo"},{"port_number":31337,"state":"open","protocol":"tcp","owner":"","service":"tcpwrapped","sun_rpc_info":"","version":""}]}]

+ 0 - 4
example2.gnmap

@@ -1,4 +0,0 @@
-# Nmap 7.80 scan initiated Wed Nov  4 21:42:17 2020 as: nmap -sC -sV -T5 -oG example2.gnmap scanme.nmap.org
-Host: 45.33.32.156 (scanme.nmap.org)	Status: Up
-Host: 45.33.32.156 (scanme.nmap.org)	Ports: 22/open/tcp//ssh//OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)/, 80/open/tcp//http//Apache httpd 2.4.7 ((Ubuntu))/, 9929/open/tcp//nping-echo//Nping echo/, 31337/open/tcp//tcpwrapped///
-# Nmap done at Wed Nov  4 21:42:41 2020 -- 1 IP address (1 host up) scanned in 24.35 seconds

+ 0 - 0
example3.gnmap


+ 4 - 4
nmap-get.py

@@ -63,6 +63,8 @@ def filter_by_version(version):
 
 # Setup Argument Parser
 parser = argparse.ArgumentParser(description='Filtering nmap')
+parser.add_argument('file', action='store', nargs='?',
+                    help='Input File')
 parser.add_argument('--port', dest='port', action='store',
                     help='Filter by port number')
 parser.add_argument('--version', dest='version', action='store',
@@ -73,8 +75,8 @@ parser.add_argument('--ip', dest='ip', action='store_true',
 
 args = parser.parse_args()
 
-if len(sys.argv) == 2:
-    with open(sys.argv[1], "r") as inp_file:
+if args.file:
+    with open(args.file, "r") as inp_file:
         hosts = json.loads(inp_file.read())
 else:
     hosts = json.loads(sys.stdin.read())
@@ -86,5 +88,3 @@ elif args.version:
     pprint_table(filter_by_version(args.version), args.ip)
 else:
     pprint_table(hosts, args.ip)
-
-

+ 0 - 31
nmap-pp.py

@@ -1,31 +0,0 @@
-#!/usr/bin/python
-import sys
-import json
-from rich.console import Console
-from rich.table import Table
-import fileinput
-
-console = Console()
-
-table = Table(show_header=True, header_style="bold blue")
-table.add_column("Host", style="dim")
-table.add_column("Port")
-table.add_column("Service")
-table.add_column("Version", justify="left")
-
-if len(sys.argv) == 2:
-    with open(sys.argv[1], "r") as inp_file:
-        hosts = json.loads(inp_file.read())
-else:
-    hosts = json.loads(sys.stdin.read())
-
-for host in hosts:
-    for port in host["ports"]:
-        table.add_row(
-            host["hostname"],
-            str(port["port_number"]),
-            port["service"],
-            port["version"]
-        )
-
-console.print(table)