-
Notifications
You must be signed in to change notification settings - Fork 1
/
portscanner.py
35 lines (27 loc) · 904 Bytes
/
portscanner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python3
#
# portscanner.py
# NMAP port scanning wrapper for Caterpillar Proxy
#
# Caterpillar Proxy - The simple web debugging proxy (formerly, php-httpproxy)
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
# https://github.com/gnh1201/caterpillar
# Created at: 2022-01-26 (from github.com/gnh1201/welsonjs)
# Updated at: 2024-07-11
#
import sys
import nmap
from base import Extension
class PortScanner(Extension):
def __init__(self):
self.type = "rpcmethod"
self.method = "scan_ports_by_hosts"
self.exported_methods = []
def dispatch(self, type, id, params, conn):
hosts = params["hosts"]
binpath = params["binpath"]
nm = nmap.PortScanner(nmap_search_path=(binpath,))
result = nm.scan(hosts=hosts, arguments="-T5 -sV -p0-65535 --max-retries 0")
return result
if __name__ == "__main__":
main(sys.argv)