-
August 21st, 2006, 05:00 PM
#11
Senior Member
will google for sys.argv[ 1 ]
but i keep getting this error
(am ru itnning it from the command prompt and running xp)
Traceback (most recent call last):
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 5, in ?
import socket
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 28, in ?
host = int (sys.argv[ 1 ] )
IndexError: list index out of range
like life, this is a test
-
August 21st, 2006, 05:09 PM
#12
IndexError: list index out of range
This is your key.... It's actually a very, very simply solution...
Try just sys.argv
In python [x] denotes the x+1 item in a list (because we start counting with 0)
so sys.argv[ 1 ] is looking for the 1 + 1 (2nd) item.. Compare that with the first google result for sys.argv
5.12. Handling command line arguments
So now we've got command line arguments and a list... well command line arguments are a list aren't they...
nmap -sV -P0 -O 192.168.1.1 (that's just a list of flags and arguments)
Perhaps then the script is looking for command lines to follow it... Looking at the script I see 4 variables with sys.argv assignments... I bet that means 4 items...
host = 1
Port = 2
timeout = 3
connCount = 4
I'll tell you that scriptname = 0
so perhaps it's python scriptname host port timeout connCount
Peace,
HT
-
August 21st, 2006, 05:37 PM
#13
Senior Member
now that was impressive
i am supposed to be a smart cookie too!!
did not understand much of it but am off googleing myself into the ground!!
adding and taking stuff away from the code to see what happens!
like life, this is a test
-
August 21st, 2006, 06:05 PM
#14
Senior Member
ok now i have more of an understanding
so i did this
C:\Documents and Settings\mhodgson\Desktop>socket.py 192.168.2.2 80 3 4
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-6:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
Exception in thread Thread-8:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\Documents and Settings\mhodgson\Desktop\socket.py", line 20, in r
self.sock = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
AttributeError: 'module' object has no attribute 'AF_INET'
(where it says r should be run!!)
so what the tom dick and harry does that mean?
i am all ears!
btw cheers for help so far
like life, this is a test
-
August 21st, 2006, 07:38 PM
#15
Senior Member
ok now i am thinking
so i typed
socket.py -198.162.2.2 -80 -3 -4
and this did not return any errors
so to see if anything was being sent i fired up etherial (wireshark!!)
ran the script and nothing seemed be sent?
how am i doing??
like life, this is a test
-
August 21st, 2006, 08:00 PM
#16
Originally posted here by yellowcat
ok now i am thinking
so i typed
socket.py -198.162.2.2 -80 -3 -4
and this did not return any errors
so to see if anything was being sent i fired up etherial (wireshark!!)
ran the script and nothing seemed be sent?
how am i doing??
You shouldn't have the - in front of each one..
As for the initial error.. Is this Python from Python.org or ActiveState Python (they have differences)...
-
August 22nd, 2006, 10:46 AM
#17
Senior Member
python is from python.org green snakey icons all over my desktop
if i do not put in the -'s i get all those errors
have tried to do it by taking some out
and still getting all the errors
however have learnt a lot about what a sys.avgr s are!
hang on
with -'s in
C:\Documents and Settings\mhodgson\Desktop>socket.py -192.168.2.2 -80 -3 -4
C:\Documents and Settings\mhodgson\Desktop>
see no errors
like life, this is a test
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
|
|