+ 3

TypeError In my code. (description)

code: import argparse, socket parser = argparse.ArgumentParser() parser.add_argument('--target', '-t', help='target') args = parser.parse_args() if args.target: udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udp.send('message', (args.target, 80)) print "Packet sent" Error: File "send.py", line 8, in <module> udp.send('message', (args.target, 80)) TypeError: an integer is required

9th Jun 2018, 10:44 AM
1337 H4x0r
1337 H4x0r - avatar
5 odpowiedzi
+ 4
Hmm, okay. well, I don't really know python. i do notice you are using a send command, while all I found online was a sendto command
9th Jun 2018, 12:52 PM
J.G.
J.G. - avatar
+ 2
well what is args.target? This is what I found online: sendto(MESSAGE, (UDP_IP, UDP_PORT))
9th Jun 2018, 11:59 AM
J.G.
J.G. - avatar
+ 1
args.target is the target defined via command line arguements. its supoosed to work like this: root@kali:~# python2 send.py -t IP
9th Jun 2018, 12:00 PM
1337 H4x0r
1337 H4x0r - avatar
+ 1
Ooh i am so stupidd i forgot haha i will try if that works
9th Jun 2018, 12:54 PM
1337 H4x0r
1337 H4x0r - avatar
+ 1
Yep that was the problem.... I got used to using the send command because i was using tcp a lot in the past and with tcp you need the send command
9th Jun 2018, 12:55 PM
1337 H4x0r
1337 H4x0r - avatar