From 20ec50badfc6aca6c6f977eb706d85a61f3d7371 Mon Sep 17 00:00:00 2001 From: Quentin WEPHRE Date: Tue, 14 Oct 2025 09:58:15 +0200 Subject: [PATCH] Grandpuits proxy setup --- Python/cube_ssh_batch.py | 8 ++++---- Python/cube_ssh_batch_passive.py | 8 ++++---- Python/requirements.txt | 3 ++- Python/ssh_fabric_batch.py | 13 +++++-------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Python/cube_ssh_batch.py b/Python/cube_ssh_batch.py index 3691af0..dfe5348 100644 --- a/Python/cube_ssh_batch.py +++ b/Python/cube_ssh_batch.py @@ -10,11 +10,11 @@ from azure.iot.hub.models import Twin, TwinProperties load_dotenv(override=True) -ip_address_prefix = "10.188.11." +ip_address_prefix = "10.81.60." ssh_command = "hostname" -csv_filename = "hoohana7.csv" -SITE_NAME = "HOOHANA" +csv_filename = "Grandpuits_01.csv" +SITE_NAME = "Grandpuits" ssh_username = os.getenv("DEFAULT_CUBE_LINUX_ADMIN_USER") ssh_password = os.getenv("DEFAULT_CUBE_LINUX_ADMIN_PASSWORD") @@ -82,7 +82,7 @@ def main(): results = [] - numbers = [16, 18, 34, 35] + numbers = [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214] for i in numbers: ip_address = f"{ip_address_prefix}{i}" print(f"Activating SSH for {ip_address}:", end=" ") diff --git a/Python/cube_ssh_batch_passive.py b/Python/cube_ssh_batch_passive.py index 3e5a7a6..b70bdc8 100644 --- a/Python/cube_ssh_batch_passive.py +++ b/Python/cube_ssh_batch_passive.py @@ -48,10 +48,10 @@ def update_cloud_config(ip, new_content): def main(): - ip_address_prefix = "10.84.171." - start_ip = 1 - end_ip = 5 - SITE_NAME = "MYRTLE" + ip_address_prefix = "10.81.60." + start_ip = 193 + end_ip = 214 + SITE_NAME = "Grandpuits" print(f"Site: {SITE_NAME}") print(f"From {ip_address_prefix}{str(start_ip)} to {ip_address_prefix}{str(end_ip)}") diff --git a/Python/requirements.txt b/Python/requirements.txt index 5deca5e..0fb2361 100644 --- a/Python/requirements.txt +++ b/Python/requirements.txt @@ -7,4 +7,5 @@ pandas openpyxl scp textual -fabric \ No newline at end of file +fabric +ruamel.yaml \ No newline at end of file diff --git a/Python/ssh_fabric_batch.py b/Python/ssh_fabric_batch.py index baa5d4a..c049e2f 100644 --- a/Python/ssh_fabric_batch.py +++ b/Python/ssh_fabric_batch.py @@ -12,14 +12,9 @@ import base64 def execute_command(c, command): """Executes a simple command on the remote device.""" - # print(f"--- [{c.host}] Executing: {command} ---") try: result = c.run(command, hide=True) return result.stdout - # print("STDOUT:") - # print(result.stdout) - # print("STDERR:") - # print(result.stderr) except Exception as e: print(f"Error executing {command}: {e}") @@ -443,9 +438,9 @@ def write_remote_config_base64_sudo(c, remote_path, content, sudo_pass, user_own def main(): """Main function to parse arguments and orchestrate tasks.""" - ip_address_prefix = "10.81.35." # Carling subnet - ip_address_range = list(range(68, 75)) # Fronm 65 to 74 - ip_address_range.append(85) # Add 85 after 74. + ip_address_prefix = "10.81.60." # Grandpuits subnet + ip_address_range = [ 198, 212 ]#list(range(193, 215)) # Fronm 193 to 214 # TODO: 198, 212 + # ip_address_range.append(85) # Add 85 after 74. hosts = [f"{ip_address_prefix}{suffix}" for suffix in ip_address_range] ssh_port = 11022 @@ -457,6 +452,8 @@ def main(): connect_args["banner_timeout"] = 3 connect_args["auth_timeout"] = 60 connect_args["channel_timeout"] = 60 + connect_args["look_for_keys"] = False + connect_args["allow_agent"] = False for host in hosts: