Hack Forums
[Python] Scan IP Ranges - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Scan IP Ranges (/showthread.php?tid=5431787)



Scan IP Ranges - GRumPz. - Oct 12, 2016

Hello Everyone!

I am trying to teach myself python and I am not sure which direction to go in when it comes to actually creating something that scans IP ranges with a specific port. Can someone help me out or provide a module that would do this?

I would greatly appreciate it!


* - FinnTheHuman - Oct 12, 2016

You would want to look into sockets.

If you are trying to scan what ports are open, make a function that tries to establish a connection, and run it in a for loop.


* - supadopecat - Oct 13, 2016

cool thanks for the question and thanks for the comment. i can now explore the sockets mod.


* - GRumPz. - Oct 14, 2016

FinnTheHuman, thanks man greatly appreciated. I will post my source once I get this ironed out. :)


* - Xtopherus - Oct 30, 2016

You could do this much more efficiently in bash but if you're a solely a python programmer than yes you will want to look into sockets, send and receive and parsing the return. You could technically just make a front end and use nmap for the sweeping, thus implementing service scanning etc

Note that if you try using a connection type of scan like -sT in nmap you WILL be noticed on log files all over the place, a more discrete but not idiot proof is the SYN scanner.