Created
December 9, 2014 10:47
-
-
Save vck/14865598fb3aa0f7d8f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # simple port scan module | |
| import socket | |
| import time | |
| sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| import string | |
| num_list=list(string.digits) | |
| def scanport(ip): | |
| if ip in num_list: | |
| for port in range(1,1025): | |
| try: | |
| cek=sock.connect_ex((ip ,port)) | |
| if cek == 0: | |
| print 'port : '+ str(port) + ' is open' | |
| except Exception: | |
| print 'False' | |
| else: | |
| ipp=socket.gethostbyname(ip) | |
| print '[-] scanning ' + str(ipp) | |
| time.sleep(3) | |
| for port2 in range(1,4000): | |
| try: | |
| check2=sock.connect_ex((ipp, port2)) | |
| if check2 == 0: | |
| print 'Port open : ',port2 | |
| except Exception: | |
| print 'False' | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
😄 it's pretty primitive !!