Skip to content

Instantly share code, notes, and snippets.

@ivabus
Last active July 3, 2023 09:14
Show Gist options
  • Save ivabus/13daec679d87411901d6e09f4f9407eb to your computer and use it in GitHub Desktop.
Save ivabus/13daec679d87411901d6e09f4f9407eb to your computer and use it in GitHub Desktop.
nmap launcher on python
#!/usr/bin/env python3
# ---
# dependencies:
# python.org: '>=3.11.3'
# nmap.org: '*'
# ---
import os
import sys
myArgs = list(sys.argv)[0:]
if len(myArgs) == 2:
threads = int(myArgs[1])
file = 0
if os.listdir('.').count('nmap') == 0:
os.system('mkdir nmap')
if threads <= 256 and 256 % threads == 0:
for i in range(0, 256, 256//threads):
os.system('python3 ' + myArgs[0] + ' ' + str(i) + ' ' + str(i + 256//threads) + ' &' )
else:
sys.exit('Error: wrong number of threads')
os.sync()
else:
start = int(myArgs[1])
end = int(myArgs[2])
file = str(str(start) + '-' + str(end - 1) + '.nmap')
if start == end - 1:
file = str(str(start) + '.nmap')
for i in range(start, end):
os.system(str('nmap 192.168.' + str(i) + '.0/24 >> nmap/' + file))
os.sync()
@ivabus
Copy link
Author

ivabus commented Jan 4, 2022

I would recommend to do it it the separate terminal, also 128 and 256 threads require lots of resources.

@ivabus
Copy link
Author

ivabus commented Feb 7, 2022

It can freeze your network

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment