Create portscan.py

This commit is contained in:
Namhyeon Go 2022-01-26 11:26:53 +09:00 committed by GitHub
parent 6d4d224e86
commit 90182f2af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

19
app/assets/py/portscan.py Normal file
View File

@ -0,0 +1,19 @@
#-*- coding: utf-8 -*-
import sys
import nmap
from optparse import OptionParser
import json
def main(args):
parser = OptionParser()
parser.add_option("-H", "--hosts", type="string", dest="hosts")
(options, args) = parser.parse_args()
nm = nmap.PortScanner(nmap_search_path=('bin/nmap-7.92/nmap',))
result = nm.scan(hosts=options.hosts, arguments='-sV')
print(json.dumps(result))
if __name__ == "__main__":
main(sys.argv)