![]() ![]() # credit goes to Eugene Yarmash who replied in the post. ![]() Return str(IPv4Interface(host_address).network) # The result will return an IPv4Address object hence I use str() to convert to string object.ĭef address_belongs_to_which_subnet(host_address): Return address_belongs_to_which_subnet(intf_info + '/' + cidr) Intf_netmask = ifaddresses(interface).get(2).get('netmask')Ĭidr = str(convert_subnet_to_cidr(intf_info)) Intf_ip = ifaddresses(interface).get(2).get('addr') # The information is structured in a dictionary for easy manipulation. # Then I use another if loop to filter away localhost address. # Hence I am only interested if any interfaces in my computer has a valid IP address. # ifaddresses method returns a dictionary on specific interface. ![]() # interfaces method returns a list of interface. I have also tried n, however running checker.py had failed.įrom netifaces import interfaces, ifaddresses Run the analysis.py to get the result printout.Īnaylsys.py is mostly Worawit’s checker.py code and Worwit’s mysmb module, checker.py takes in sys.argv, which I do not know how to pass argument like this within a python script. Impacket is required to use Worawit’s mysmb library. network_discovery.py – Automatically checks which network the interface is connected to, the subnet is later used by reconn.py to check for hosts that have tcp 445 opened.Ĭopy and paste these and save as requirements.txt.įor the above python codes to work you need to install modules in the requirements.txt, pip install -r requirements.txt.reconn.py – Uses nmap to check for live host that has tcp 445 opened.analysis.py – This code uses Worawit’s checker.py code and Worawit’s mysmb library.This code is meant for educational purpose only, you should be well aware that you must not in any case use the code to scan for vulnerable host in production, to test the code, please load in your VM and use host-only network interface to test and learn in a safe environment. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |