1
Scripting Languages / Re: [PYTHON] A simple port scanner (whith some questions)
« on: July 21, 2015, 11:53:35 AM »
hello,
here is a new source i have done for my port-scanner (always free for use in legal way for white-hats)
this range system was only for test , will change it next to add a user input range system ,and a port list system too
now i want to do multithreading and queue on it (but no clue how to do it , i'm still noob in python !! ), and next add all options i had on one of the first versions (whois,bannergrabing,nslookup,etc.. only in python )
if someone have an idea how to thread and queue this new source ^^
Have a nice day all
here is a new source i have done for my port-scanner (always free for use in legal way for white-hats)
Code: [Select]
from socket import *
open_p, closed_p = [], []
reponse = ["OPEN PORTS","CLOSED PORTS","SCANNING PORTS:","TYPE","SCANNING","ADDRESS"]
address = raw_input ("{}: ".format(reponse[5]))
ip = gethostbyname(address)
print "{0}:{1}\n".format(reponse[4],ip)
def scan_c(address,port):
s = socket(AF_INET,SOCK_STREAM)
s.settimeout(0.17)
result = s.connect_ex((address,port))
if result == 0:
open_p.append(port)
s.shutdown(2)
else:
closed_p.append(port)
s.close
def main():
print reponse[2]
for port in range (0,101):
print port,
scan_c(address,port)
if __name__ == "__main__":
main()
print "\n\n{}".format(reponse[0])
for elements in open_p:
print "{0} {1} :{2}".format(elements,reponse[3],getservbyport(elements))
this range system was only for test , will change it next to add a user input range system ,and a port list system too
now i want to do multithreading and queue on it (but no clue how to do it , i'm still noob in python !! ), and next add all options i had on one of the first versions (whois,bannergrabing,nslookup,etc.. only in python )
if someone have an idea how to thread and queue this new source ^^
Have a nice day all