Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
Port Scanner
  • s1n4
    Posts: 88
    Hi guys,

    A simple port scanner in python.

    #!/usr/bin/python


    ########## ##########
    ##### _ _ _ #####
    ##### ___/ |_ __ | || | #####
    ##### / __| | '_ \| || |_ #####
    ##### \__ \ | | | |__ _| #####
    ##### |___/_|_| |_| |_| #####
    ##### #####
    ##### This is a tool for scanning ports #####
    ##### s1n4_c0der[at]yahoo.com #####
    ########## ##########


    #------------------------------------------------
    # Usage : s1n4ps.py <ip> <start port> <end port>
    # s1n4ps.py 127.0.0.1 1 200
    #------------------------------------------------

    import socket, sys, os

    def main():

    def portscan(ipaddr, port) :
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    try :
    sock.connect((ipaddr, port))
    sock.close()
    return \"open\"
    except :
    pass

    try :
    ip = str(sys.argv[1])
    sp = int(sys.argv[2])
    ep = int(sys.argv[3])

    for pn in range(sp, ep + 1) :
    if portscan(ip, pn) == \"open\" :
    print \"\n\t[+]\", ip, \"\t\t\", pn, \"\t\tOpen\"

    except :
    print \"\nUsage: %s\" % os.path.basename(sys.argv[0]), \"<ip> <start port> <end port>\"
    exit()

    main()
  • Bursihido
    Posts: 406
    Nice Share mate Thanks.
  • Sh3llc0d3
    Posts: 1,910
    Nice and simple, I've seen similar before. Nice share :)
  • s1n4
    Posts: 88
    said:


    Nice Share mate Thanks.



    [hr]
    said:


    Nice and simple, I've seen similar before. Nice share :)



    Thanks Men :)
  • Xin
    Posts: 3,251
    Nice, in port scanners you wanna use multi threading as ive made basic port scanners before and really slow.
    Xin
  • Sh3llc0d3
    Posts: 1,910
    said:


    Nice, in port scanners you wanna use multi threading as ive made basic port scanners before and really slow.



    Quoted for truth. I'm coming up with a 'forked' perl port scanner cos the one I made was SO slow.
  • Xin
    Posts: 3,251
    said:


    said:


    Nice, in port scanners you wanna use multi threading as ive made basic port scanners before and really slow.



    Quoted for truth. I'm coming up with a 'forked' perl port scanner cos the one I made was SO slow.


    Haha, the one i made in visual basic ages ago just froze until the scan finished, that was terrible.
    Xin
  • s1n4
    Posts: 88
    Thanks men, that is simple and slow :)