This is what I am doing right now.
def formate(newurl1, schemess):
newurl = newurl1.replace('http://', '')
portss = 21, 22, 80, 8080, 443, 8443, 3306, 445
th1 = threading.Thread(target=connCheck, args= (newurl, schemess, 21,))
th2 = threading.Thread(target=connCheck, args=( newurl, schemess, 22,))
th3 = threading.Thread(target=connCheck, args= (newurl, schemess,80,))
th4 = threading.Thread(target=connCheck, args=(newurl, schemess,8080,))
th5 = threading.Thread(target=connCheck, args= (newurl, schemess,443,))
th6 = threading.Thread(target=connCheck, args= (newurl, schemess,8443,))
th7 = threading.Thread(target=connCheck, args= (newurl, schemess,3306,))
th8 = threading.Thread(target=connCheck, args= (newurl, schemess,445,))
print "\n Host:- ", newurl1, "\n"
print "\t[+] List of open ports:-"
th1.start()
th2.start()
th3.start()
th4.start()
th5.start()
th6.start()
th7.start()
th8.start()
th8.join()
for x in urls_returning200:
formate(x, '')
NOTE:- connCheck is my another function for creating sockets. so, that does not need to define here.
Now all the work is going good, what I want to know that, Is there any alternative for that? Means, this code is working perfectly for me what its quite lengthy which is really not good. So Is there anyone who can suggest me something?
What I had tried.
threadingss = []
def formate(newurl1, schemess):
portss = 21, 22, 80, 8080, 443, 8443, 3306, 445
for x in portss:
threadin = threading.Thread(target=connCheck, args(newurl, schemess, x))
threadingss.append(threadin)
for x in threadingss:
x.start()
for x in threadingss:
x.join()
for x in urls_returning200:
formate(x, '')
But that cause error so that also doesn't work for me?
So please suggest me something.