Created
June 14, 2017 20:55
-
-
Save vijayanandrp/274269bb885af2567fe5c4ee1b2403a2 to your computer and use it in GitHub Desktop.
10 line code to create Port Scanner using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import socket | |
def main(): | |
ip = raw_input("ENTER THE TARGET IP ADDRESS: ") | |
for port in range(1, 65535): | |
s = socket.socket | |
try: | |
s = s(socket.AF_INET, socket.SOCK_STREAM) | |
except Exception as er: | |
print " Error: ", str(er) | |
if s.connect_ex((ip, port)): | |
continue | |
else: | |
print "Port", port, " is open !" | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment