Skip to content
Snippets Groups Projects
Commit 028cac81 authored by NGUYEN Do Duc Anh's avatar NGUYEN Do Duc Anh
Browse files

update auto start attack

parent 48dc594e
Branches
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ $localIP = "0.0.0.0" # Listen on all interfaces
# Create TCP listener
$listener = New-Object System.Net.Sockets.TcpListener([System.Net.IPAddress]::Parse($localIP), $listenerPort)
$listener.Start()
try {
# Wait for any connection
......
@echo off
powershell -ExecutionPolicy Bypass -File "C:\Users\window7_pc\Desktop\monitor_start_attack_script.ps1"
powershell -ExecutionPolicy Bypass -File "C:\Users\window7_pc\Desktop\monitor_start_attack.ps1"
\ No newline at end of file
......@@ -5,6 +5,7 @@ import queue
import subprocess
import os
import json
# import numpy as np
# import matplotlib.pyplot as plt
......@@ -74,7 +75,20 @@ def generate_and_send_traffic_matrix():
for ip, receive_rate in trace_receive.items():
print("IP:", ip, " should received rate:", receive_rate)
print("Finish sending traffic matrix")
def notify_window_attacker():
global map_point
point_ips = map_point.keys()
for point_ip_send in point_ips:
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.settimeout(2.0)
try:
client_socket.connect((point_ip_send, 12345))
client_socket.close()
except (ConnectionRefusedError, socket.timeout):
continue
print("Finished sending attack demands")
def notify_ubuntu_internode():
......@@ -112,9 +126,11 @@ def read_and_write_points():
if len(map_point.keys()) == num_machine:
notify_ubuntu_internode()
input("Press Enter to continue...")
input("Press Enter to start traffic generation")
# time.sleep(3) # Sleep to wait the last windows finish opening the generator tool
generate_and_send_traffic_matrix()
input("Press Enter to start attack")
notify_window_attacker()
else:
print("IP crashed:", ip_client[1])
except queue.Empty:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment