Python Forum

Full Version: Help to create a script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'd like to create a script that from a .txt list analyzes all the IP addresses if they are online, and then it must create a file and insert them in there at the end of the scan.
sounds like a great project. Don't hesitate to post here when you have specific question. Post your code in python tags and full traceback if you get any error - in error tags.
Maybe you want to use low level sockets from the Python stdlib.
If you want to check, if an IP is up, you have two possibilities:
  • ICMP, ping the server and hope, that ICMP is not blocked. You can use the provided ping program of your operating system. In this case you have to execute a program. (subprocess module).
  • TCP, connect to a open port. This is interesting, if the IP has a running service. This could be for example a Webserver. Usually Webservers listen on Port 80.