Home > Scripts > Python port scanning script

Python port scanning script

import telnetlib
import socket
import sys

remoteip = None

if (len(sys.argv) >1 ):
     remoteip = sys.argv[1]
     for i in range(1,65535):
        try:
            tn = telnetlib.Telnet(sys.argv[1],i)    
            if tn is not None:
               tn.close()
               print(i)

        except socket.error:
            pass

else:
     print("Usage: python portscan.py ")
Advertisements
Categories: Scripts
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: