exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Port Tester 0.1

Port Tester 0.1
Posted Feb 3, 2012
Authored by localh0t

This is a simple little port scanning script written in python.

tags | tool, scanner, python
systems | unix
SHA-256 | ad34cb9d3975247aeac90686a80c09eb62fbcb41dbb7d953b4454b12630d2829

Port Tester 0.1

Change Mirror Download
#!/usr/bin/python

# Port Tester v0.1
# Test which remote ports the server running this script can access to.
# written by localh0t
# Date: 03/02/12
# Contact: mattdch0@gmail.com
# Follow: @mattdch

import sys,socket,errno

# Functions goes here

def banner():
return "\n####################\n# Port Tester v0.1 #\n####################"

def exitProgram(code):
if code==1:
sys.exit("\n[!] Exiting help...\n")
if code==2:
sys.exit("\n[!] Test finished, exiting...\n")
if code==3:
sys.exit("\n[!] Exiting...\n")
if code==4:
sys.exit("\n[-] Exiting, check arguments...\n")

def strToInt(convert,typeParam):
try:
value = int(convert)
return value
except:
print "\n[-] Number given in " + typeParam + " is invalid"
exitProgram(3)

def checkTimeout(timeout):
if timeout is None or timeout <= 0:
# Default timeout : 3 seconds
timeout = 3
else:
pass
return timeout

def connectHost(host,port,timeout):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(timeout)
sock.connect((host, port))
# Connection established, we can access that port
return "[+] We can reach port " + str(port)
except:
# If some error happens (refused / filtered), we cannot access that port, print that
return "[-] We cannot reach port " + str(port)

if len(sys.argv) <= 4:
print banner()
print "\nUsage:\n======\n\npython", sys.argv[0], "-s [START PORT] -e [END PORT] -t [TIMEOUT (Seconds) (Optional, default: 3)]"
exitProgram(1)

# Set some variables
count = 0
timeout = None
start_port = None
end_port = None

# Read args
for arg in sys.argv:
if arg == "-s":
start_port = strToInt(sys.argv[count+1],"-s")
elif arg == "-e":
end_port = strToInt(sys.argv[count+1],"-e")
elif arg == "-t":
timeout = strToInt(sys.argv[count+1],"-t")
count+=1

# Do some checks
if start_port is None or end_port is None:
exitProgram(4)
timeout = checkTimeout(timeout)

# Test started
print banner()
print "\n[!] Port-test started..."
print "[!] Timeout: " + str(timeout) + " seconds\n"

# In case we had DNS problems on the server, we use the IP instead the domain, if you wanna use the domain : hostname = socket.gethostbyname("open.zorinaq.com")
hostname = '67.215.250.139' # open.zorinaq.com , 65k ports open

for port in range(start_port , end_port+1):
print connectHost(hostname, port, timeout)
exitProgram(2)

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close