text
stringlengths 1
93.6k
|
|---|
potential_paths = [
|
"/home/pi/xeno/config/ssh_default_credentials.txt",
|
"/root/ssh_default_credentials.txt"
|
]
|
for path in potential_paths:
|
if os.path.exists(path):
|
print(f"[INFO] Found SSH credentials at: {path}")
|
credentials = []
|
try:
|
with open(path, "r") as file:
|
for line in file:
|
line = line.strip()
|
if line and ":" in line:
|
username, password = line.split(":", 1)
|
credentials.append({"username": username, "password": password})
|
return credentials
|
except Exception as e:
|
print(f"[ERROR] Failed to load SSH credentials from {path}: {e}")
|
return []
|
print("[ERROR] No SSH credentials file found in config or root.")
|
return []
|
def load_wifi_credentials():
|
"""
|
Load Wi-Fi credentials from predefined paths in the project directory.
|
Searches in the following order:
|
- /home/pi/xeno/config/wifi_credentials.json
|
- /root/wifi_credentials.json
|
Returns:
|
list: A list of dictionaries with Wi-Fi credentials, where each dictionary contains:
|
- SSID (str): The Wi-Fi network name.
|
- Password (str): The Wi-Fi network password.
|
Raises:
|
Exception: If the file cannot be read or is improperly formatted.
|
"""
|
potential_paths = [
|
"/home/pi/xeno/config/wifi_credentials.json",
|
"/root/wifi_credentials.json"
|
]
|
for path in potential_paths:
|
if os.path.exists(path):
|
print(f"[INFO] Found Wi-Fi credentials at: {path}")
|
try:
|
import json
|
with open(path, "r") as file:
|
return json.load(file)
|
except Exception as e:
|
print(f"[ERROR] Failed to load Wi-Fi credentials from {path}: {e}")
|
return []
|
print("[ERROR] No Wi-Fi credentials file found in config or root.")
|
return []
|
def initialize_display_template(display, current_ssid="Not Connected", stats=None):
|
"""
|
Initialize the e-paper display with a basic template.
|
Parameters:
|
display (EPaperDisplay): The e-paper display object to update.
|
current_ssid (str): The name of the current Wi-Fi network (default: "Not Connected").
|
stats (dict): A dictionary with stats on targets, vulnerabilities, exploits, and files.
|
Default Stats:
|
- targets: 0
|
- vulns: 0
|
- exploits: 0
|
- files: 0
|
Raises:
|
Exception: If an error occurs during initialization or image rendering.
|
"""
|
if stats is None:
|
stats = {"targets": 0, "vulns": 0, "exploits": 0, "files": 0} # Default stats
|
try:
|
from PIL import Image
|
placeholder_image = Image.new('1', (60, 60), color=255) # Blank image
|
prepared_image = display.prepare_image(placeholder_image)
|
layout = display.draw_layout(prepared_image, current_ssid=current_ssid, current_status="Initializing...", stats=stats)
|
display.display_image(layout, use_partial_update=False) # Full refresh for initialization
|
print("[INFO] Template initialized.")
|
except Exception as e:
|
print(f"[ERROR] Failed to initialize display template: {e}")
|
def update_display_state(self, state_manager, state, current_ssid="SSID",
|
current_status="", stats=None, use_partial_update=True):
|
"""
|
Update the e-paper display with the current workflow state.
|
Parameters:
|
self (EPaperDisplay): The e-paper display object to update.
|
state_manager (ImageStateManager): Manages workflow states and images.
|
state (str): The current workflow state (e.g., "scanning", "analyzing").
|
current_ssid (str): The name of the current Wi-Fi network.
|
current_status (str): The current status message to display.
|
stats (dict): A dictionary with stats on targets, vulnerabilities, exploits, and files.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.