Loop IP in python 3

95 views Asked by At

we have a tool call Mkbrutus.py file that accepts in the target only one IP address. we need to loop IP like 192.168.x.x/16 and test every IP like 192.168.1.1 and 192.168.1.2 ...... and so on

variable for Mkbrutus.py

Mkbrutus.py -t (IP address here)

Loop script for python3

import ipaddress
for ip in ipaddress.IPv4Network('192.168.0.0/16'):
print (ip)

so how to make .py file that runs Mkbrutus.py -t (LOOP IP) so can check every IP not just one IP in the target

1

There are 1 answers

0
Blanks On

if you want to make your file capable of using arguments you will need to use args

Check out this link in order to pass arguments to your programs.

https://www.tutorialspoint.com/python/python_command_line_arguments.htm