port check

noprianto opennopri at yahoo.com
Fri Aug 24 00:26:33 EDT 2001


Hello pythonia,

I learn to make a program acts like port checker, so
if someone try to connect by by tcp, i always know.

So far, i have made a program that only can check for
one port. This is my code is you care :

#!/usr/bin/env python

import socket
import sys
import traceback

PORT = 10000

def main():
	serverSocket = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
	serverSocket.bind((socket.gethostname(),PORT))
	serverSocket.listen(5)
	while 1:
		conn, addr = serverSocket.accept()
		print addr , ' connected at port ' , PORT
	conn.close()
		



if __name__=='__main__':
	main()
	
------------------------------------------------------
But when i change PORT to 21 for example, it said
permission denied. I heard that port below 1024 is
restricted only for root. I'm using linux.

So anyone can help me how to make a little port
scanning ? Is it hard ? Please give me a little codes,
i'm newbie but serious !

You have my thanks.
__nopri


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/




More information about the Python-list mailing list