Topic: python port scaning

sharing pengalaman belajar socket dikit

#!/usr/bin/python
from import socket *
iptarget = raw_input(‘ hostname ‘)
target = gethostbyname(iptarget)
for port in range(20,1025):
s = socket(AF_INET, SOCK_STREAM)
ulang = s.connect_ex((iptarget, port))
if(ulang==0):
   print ‘Port %d: OPEN’ % (port,)
s.close()

ket :

s = socket(AF_INET, SOCK_STREAM)
AF_INET ==> socket dihubungkan dengan protokol internet
SOCK_STREM ==> program ini memakai stream socket/tcp

klo g berguna dihapus aj
big_smile

Re: python port scaning

bung...klo mau ngistal2 program extensi (.py) yang udah jadi gmna c.

Re: python port scaning

-------------------------------------------------------------------------
>>> from import socket *
  File "<stdin>", line 1
    from import socket *
              ^
SyntaxError: invalid syntax
>>>
------------------------------------------------------------------------

maksudnya mungkin gini,

from socket import *

gak pernah dicoba ya ???
heheheh,... tongue