-
August 20th, 2006, 01:54 PM
#1
Senior Member
forceing port connections
i do not want to get flamed for this because it might sound like i want to learn about DOS, which i do not
but
is there a way i can force multiple connections to a given port?
this is to test my VNC server and web server
like life, this is a test
-
August 20th, 2006, 10:36 PM
#2
Yeah, telnet to the port multiple times.
-
August 21st, 2006, 07:27 AM
#3
Senior Member
can i automate this or do i have to type in >: telnet xyz 5900 again and again?
like life, this is a test
-
August 21st, 2006, 08:18 AM
#4
Originally posted here by yellowcat
can i automate this or do i have to type in >: telnet xyz 5900 again and again?
Wouldn't it be more fun to try this yourself or learn how to do it yourself??? What's the point in it if you don't learn anything?
Regardless.. this can be done quite easily in python:
Code:
#!/usr/bin/env python
import threading
import socket
import sys
class threadedConnect ( threading.Thread ):
def __init__ ( self, host, port, timeout ) :
self.host = host # host to connect to
self.port = port # port to connnect to
self.timeout = timeout # 0 for no timeout
threading.Thread.__init__ ( self )
def run ( self ) :
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
self.sock.settimeout( self.timeout )
self.sock.connect ( ( self.host, self.port ) )
print self.sock.recv( 1024 )
#Init Variables
host = sys.argv[ 1 ]
port = int ( sys.argv[ 2 ] )
timeout = int ( sys.argv [ 3 ] )
connCount = int ( sys.argv [ 4 ] )
for x in xrange ( connCount ) : #Number of connections to make
threadedConnect( host, port, timeout).start()
How do you run it... how does it work... what do you need... Well that's up to you... but there's a very simple script for you (Yes I realize I could have made it easier... but where's the fun in that)... Also I didn't incorporate any error checking... so you'll die on errors... but it'll still do what you want.
Peace,
HT
-
August 21st, 2006, 08:45 AM
#5
Senior Member
well i should now take up programming!!
read a few books but they ALL start off with 'hello world' and do not get more exciting than that
will give it a go
cheers for the script
like life, this is a test
-
August 21st, 2006, 09:23 AM
#6
Senior Member
well i have run it and yes there are errors!!
no idea what IndexError means but having a look on web to see
does not like the import socket line or host = sys.argv [1]
like life, this is a test
-
August 21st, 2006, 10:10 AM
#7
Originally posted here by yellowcat
well i should now take up programming!!
read a few books but they ALL start off with 'hello world' and do not get more exciting than that
You will need to learn how to walk before you're able to run
Oliver's Law:
Experience is something you don't get until just after you need it.
-
August 21st, 2006, 02:21 PM
#8
Senior Member
ok done some playing around with the code
to no avail
i changed this
host = sys.argv[ 1 ]
to this
host = int ( sys.argv[ 1 ] )
but that did not work
and IndexError seems to be a universal type of error in many programming languages
like life, this is a test
-
August 21st, 2006, 03:02 PM
#9
Senior Member
am i missing modules?
i have tried several pre written scripts with
import socket
but non of them work.......
like life, this is a test
-
August 21st, 2006, 04:10 PM
#10
Hey Hey
If you've got Python, you've got everything you need to run the script and there are no changes that have to be made... it works perfectly the way it is.
I'd suggest you go look up why sys.argv[] is used... That will be your clue...
Peace,
HT
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|