A Simple Port Scanner [Python]
#!/usr/bin/python
import sys,os
from socket import *
os.system('clear')
def about():
print "###################################################"
print "# Simple Port Scanner"
print "# Coded By nu11_()_v0!d"
print "# Powered By Team OpenFire"
print "# Blog: infosec-regeneration.blogspot.com"
print "#"
def usage():
print "[?] usage : ./portScan.py 1 65500 IP --- All PORTS"
print "[?] usage : ./portScan.py 21 IP --- Single PORT"
def main():
if (int(len(sys.argv))==1):
about()
usage()
if (int(len(sys.argv)) == 3):
#one port
about()
try:socket(AF_INET, SOCK_STREAM).connect((sys.argv[2], int(sys.argv[1]))); print "[!] PORT : ", int(sys.argv[1])," OPEN"
except: pass
if (int(len(sys.argv)) == 4):
#range
about()
port = 0
for port in range( int(sys.argv[1]) , int(sys.argv[2]) ):
try:socket(AF_INET, SOCK_STREAM).connect((sys.argv[3], port)); print "[!] PORT : ", port," OPEN"
except: pass
main()
print "http://infosec-regeneration.blogspot.com"
print "###################################################"