machineconfig 1.96__py3-none-any.whl → 2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of machineconfig might be problematic. Click here for more details.
- machineconfig/cluster/cloud_manager.py +22 -26
- machineconfig/cluster/data_transfer.py +2 -2
- machineconfig/cluster/distribute.py +0 -2
- machineconfig/cluster/file_manager.py +4 -4
- machineconfig/cluster/job_params.py +1 -1
- machineconfig/cluster/loader_runner.py +8 -8
- machineconfig/cluster/remote_machine.py +4 -4
- machineconfig/cluster/script_execution.py +2 -2
- machineconfig/cluster/sessions_managers/archive/create_zellij_template.py +1 -1
- machineconfig/cluster/sessions_managers/enhanced_command_runner.py +23 -23
- machineconfig/cluster/sessions_managers/wt_local.py +78 -76
- machineconfig/cluster/sessions_managers/wt_local_manager.py +91 -91
- machineconfig/cluster/sessions_managers/wt_remote.py +39 -39
- machineconfig/cluster/sessions_managers/wt_remote_manager.py +94 -91
- machineconfig/cluster/sessions_managers/wt_utils/layout_generator.py +56 -54
- machineconfig/cluster/sessions_managers/wt_utils/process_monitor.py +49 -49
- machineconfig/cluster/sessions_managers/wt_utils/remote_executor.py +18 -18
- machineconfig/cluster/sessions_managers/wt_utils/session_manager.py +42 -42
- machineconfig/cluster/sessions_managers/wt_utils/status_reporter.py +36 -36
- machineconfig/cluster/sessions_managers/zellij_local.py +43 -46
- machineconfig/cluster/sessions_managers/zellij_local_manager.py +139 -120
- machineconfig/cluster/sessions_managers/zellij_remote.py +35 -35
- machineconfig/cluster/sessions_managers/zellij_remote_manager.py +33 -33
- machineconfig/cluster/sessions_managers/zellij_utils/example_usage.py +15 -15
- machineconfig/cluster/sessions_managers/zellij_utils/layout_generator.py +25 -26
- machineconfig/cluster/sessions_managers/zellij_utils/process_monitor.py +49 -49
- machineconfig/cluster/sessions_managers/zellij_utils/remote_executor.py +5 -5
- machineconfig/cluster/sessions_managers/zellij_utils/session_manager.py +15 -15
- machineconfig/cluster/sessions_managers/zellij_utils/status_reporter.py +11 -11
- machineconfig/cluster/templates/utils.py +3 -3
- machineconfig/jobs/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/jobs/python/__pycache__/python_ve_symlink.cpython-311.pyc +0 -0
- machineconfig/jobs/python/check_installations.py +8 -9
- machineconfig/jobs/python/python_cargo_build_share.py +2 -2
- machineconfig/jobs/python/vscode/link_ve.py +7 -7
- machineconfig/jobs/python/vscode/select_interpreter.py +7 -7
- machineconfig/jobs/python/vscode/sync_code.py +5 -5
- machineconfig/jobs/python_custom_installers/archive/ngrok.py +2 -2
- machineconfig/jobs/python_custom_installers/dev/aider.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/alacritty.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/brave.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/bypass_paywall.py +5 -5
- machineconfig/jobs/python_custom_installers/dev/code.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/cursor.py +9 -9
- machineconfig/jobs/python_custom_installers/dev/docker_desktop.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/espanso.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/goes.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/lvim.py +4 -4
- machineconfig/jobs/python_custom_installers/dev/nerdfont.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/redis.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/wezterm.py +3 -3
- machineconfig/jobs/python_custom_installers/dev/winget.py +27 -27
- machineconfig/jobs/python_custom_installers/docker.py +3 -3
- machineconfig/jobs/python_custom_installers/gh.py +7 -7
- machineconfig/jobs/python_custom_installers/hx.py +1 -1
- machineconfig/jobs/python_custom_installers/warp-cli.py +3 -3
- machineconfig/jobs/python_generic_installers/config.json +412 -389
- machineconfig/jobs/python_windows_installers/dev/config.json +1 -1
- machineconfig/logger.py +50 -0
- machineconfig/profile/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/create.cpython-311.pyc +0 -0
- machineconfig/profile/__pycache__/shell.cpython-311.pyc +0 -0
- machineconfig/profile/create.py +23 -16
- machineconfig/profile/create_hardlinks.py +8 -8
- machineconfig/profile/shell.py +41 -37
- machineconfig/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/linux/devops +2 -2
- machineconfig/scripts/linux/fire +1 -0
- machineconfig/scripts/linux/fire_agents +0 -1
- machineconfig/scripts/linux/mcinit +27 -0
- machineconfig/scripts/python/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/__init__.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/croshell.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/devops_update_repos.cpython-313.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_agents.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/fire_jobs.cpython-311.pyc +0 -0
- machineconfig/scripts/python/__pycache__/repos.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/init.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/__pycache__/mcinit.cpython-311.pyc +0 -0
- machineconfig/scripts/python/ai/chatmodes/Thinking-Beast-Mode.chatmode.md +337 -0
- machineconfig/scripts/python/ai/chatmodes/Ultimate-Transparent-Thinking-Beast-Mode.chatmode.md +644 -0
- machineconfig/scripts/python/ai/chatmodes/deepResearch.chatmode.md +81 -0
- machineconfig/scripts/python/ai/configs/.gemini/settings.json +81 -0
- machineconfig/scripts/python/ai/instructions/python/dev.instructions.md +45 -0
- machineconfig/scripts/python/ai/mcinit.py +103 -0
- machineconfig/scripts/python/ai/prompts/allLintersAndTypeCheckers.prompt.md +5 -0
- machineconfig/scripts/python/ai/prompts/research-report-skeleton.prompt.md +38 -0
- machineconfig/scripts/python/ai/scripts/lint_and_type_check.sh +47 -0
- machineconfig/scripts/python/archive/tmate_conn.py +5 -5
- machineconfig/scripts/python/archive/tmate_start.py +3 -3
- machineconfig/scripts/python/choose_wezterm_theme.py +2 -2
- machineconfig/scripts/python/cloud_copy.py +19 -18
- machineconfig/scripts/python/cloud_mount.py +9 -7
- machineconfig/scripts/python/cloud_repo_sync.py +11 -11
- machineconfig/scripts/python/cloud_sync.py +1 -1
- machineconfig/scripts/python/croshell.py +14 -14
- machineconfig/scripts/python/devops.py +6 -6
- machineconfig/scripts/python/devops_add_identity.py +8 -6
- machineconfig/scripts/python/devops_add_ssh_key.py +18 -18
- machineconfig/scripts/python/devops_backup_retrieve.py +13 -13
- machineconfig/scripts/python/devops_devapps_install.py +3 -3
- machineconfig/scripts/python/devops_update_repos.py +1 -1
- machineconfig/scripts/python/dotfile.py +2 -2
- machineconfig/scripts/python/fire_agents.py +183 -41
- machineconfig/scripts/python/fire_jobs.py +17 -11
- machineconfig/scripts/python/ftpx.py +2 -2
- machineconfig/scripts/python/gh_models.py +94 -94
- machineconfig/scripts/python/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/cloud_helpers.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers2.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/__pycache__/helpers4.cpython-311.pyc +0 -0
- machineconfig/scripts/python/helpers/cloud_helpers.py +3 -3
- machineconfig/scripts/python/helpers/helpers2.py +1 -1
- machineconfig/scripts/python/helpers/helpers4.py +8 -6
- machineconfig/scripts/python/helpers/helpers5.py +7 -7
- machineconfig/scripts/python/helpers/repo_sync_helpers.py +1 -1
- machineconfig/scripts/python/mount_nfs.py +3 -2
- machineconfig/scripts/python/mount_nw_drive.py +4 -4
- machineconfig/scripts/python/mount_ssh.py +3 -2
- machineconfig/scripts/python/repos.py +8 -8
- machineconfig/scripts/python/scheduler.py +1 -1
- machineconfig/scripts/python/start_slidev.py +8 -7
- machineconfig/scripts/python/start_terminals.py +1 -1
- machineconfig/scripts/python/viewer.py +40 -40
- machineconfig/scripts/python/wifi_conn.py +65 -66
- machineconfig/scripts/python/wsl_windows_transfer.py +1 -1
- machineconfig/scripts/windows/mcinit.ps1 +4 -0
- machineconfig/settings/linters/.ruff.toml +2 -2
- machineconfig/settings/shells/ipy/profiles/default/startup/playext.py +71 -71
- machineconfig/settings/shells/wt/settings.json +8 -8
- machineconfig/setup_linux/web_shortcuts/tmp.sh +2 -0
- machineconfig/setup_windows/wt_and_pwsh/set_pwsh_theme.py +10 -7
- machineconfig/setup_windows/wt_and_pwsh/set_wt_settings.py +9 -7
- machineconfig/utils/ai/browser_user_wrapper.py +5 -5
- machineconfig/utils/ai/generate_file_checklist.py +11 -12
- machineconfig/utils/ai/url2md.py +1 -1
- machineconfig/utils/cloud/onedrive/setup_oauth.py +4 -4
- machineconfig/utils/cloud/onedrive/transaction.py +129 -129
- machineconfig/utils/code.py +13 -6
- machineconfig/utils/installer.py +51 -53
- machineconfig/utils/installer_utils/installer_abc.py +21 -10
- machineconfig/utils/installer_utils/installer_class.py +42 -16
- machineconfig/utils/io_save.py +3 -15
- machineconfig/utils/options.py +10 -3
- machineconfig/utils/path.py +5 -0
- machineconfig/utils/path_reduced.py +201 -149
- machineconfig/utils/procs.py +23 -23
- machineconfig/utils/scheduling.py +11 -12
- machineconfig/utils/ssh.py +270 -0
- machineconfig/utils/terminal.py +180 -0
- machineconfig/utils/utils.py +1 -2
- machineconfig/utils/utils2.py +43 -0
- machineconfig/utils/utils5.py +163 -34
- machineconfig/utils/ve.py +2 -2
- {machineconfig-1.96.dist-info → machineconfig-2.0.dist-info}/METADATA +13 -8
- {machineconfig-1.96.dist-info → machineconfig-2.0.dist-info}/RECORD +163 -144
- machineconfig/cluster/self_ssh.py +0 -57
- {machineconfig-1.96.dist-info → machineconfig-2.0.dist-info}/WHEEL +0 -0
- {machineconfig-1.96.dist-info → machineconfig-2.0.dist-info}/top_level.txt +0 -0
|
@@ -17,7 +17,7 @@ pwd = homepassword456
|
|
|
17
17
|
|
|
18
18
|
Configuration file locations checked (in order):
|
|
19
19
|
- ~/dotfiles/machineconfig/setup/wifi.ini
|
|
20
|
-
- ~/.config/wifi.ini
|
|
20
|
+
- ~/.config/wifi.ini
|
|
21
21
|
- ./wifi.ini
|
|
22
22
|
|
|
23
23
|
Usage examples:
|
|
@@ -46,25 +46,25 @@ console = Console()
|
|
|
46
46
|
def get_available_networks() -> List[Dict[str, str]]:
|
|
47
47
|
"""Get list of available WiFi networks"""
|
|
48
48
|
networks = []
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
try:
|
|
51
51
|
if platform.system() == "Windows":
|
|
52
52
|
result = subprocess.run(
|
|
53
53
|
["netsh", "wlan", "show", "profiles"],
|
|
54
54
|
capture_output=True, text=True, check=True
|
|
55
55
|
)
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
for line in result.stdout.split('\n'):
|
|
58
58
|
if 'All User Profile' in line:
|
|
59
59
|
ssid = line.split(':')[1].strip()
|
|
60
60
|
networks.append({"ssid": ssid, "signal": "Unknown"})
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
# Also get available networks
|
|
63
63
|
result = subprocess.run(
|
|
64
64
|
["netsh", "wlan", "show", "networks"],
|
|
65
65
|
capture_output=True, text=True, check=True
|
|
66
66
|
)
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
current_ssid = None
|
|
69
69
|
for line in result.stdout.split('\n'):
|
|
70
70
|
if 'SSID' in line and 'BSSID' not in line:
|
|
@@ -75,7 +75,7 @@ def get_available_networks() -> List[Dict[str, str]]:
|
|
|
75
75
|
if not any(net['ssid'] == current_ssid for net in networks):
|
|
76
76
|
networks.append({"ssid": current_ssid, "signal": signal})
|
|
77
77
|
current_ssid = None
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
elif platform.system() in ["Linux", "Darwin"]:
|
|
80
80
|
if platform.system() == "Linux":
|
|
81
81
|
result = subprocess.run(
|
|
@@ -87,7 +87,7 @@ def get_available_networks() -> List[Dict[str, str]]:
|
|
|
87
87
|
["/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport", "-s"],
|
|
88
88
|
capture_output=True, text=True, check=True
|
|
89
89
|
)
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
for line in result.stdout.strip().split('\n'):
|
|
92
92
|
if line and ':' in line:
|
|
93
93
|
parts = line.split(':')
|
|
@@ -96,12 +96,12 @@ def get_available_networks() -> List[Dict[str, str]]:
|
|
|
96
96
|
"ssid": parts[0].strip(),
|
|
97
97
|
"signal": f"{parts[1].strip()}%"
|
|
98
98
|
})
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
except subprocess.CalledProcessError as e:
|
|
101
101
|
console.print(f"[red]❌ Error scanning networks: {e}[/red]")
|
|
102
102
|
except Exception as e:
|
|
103
103
|
console.print(f"[red]❌ Unexpected error: {e}[/red]")
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
# Remove duplicates and empty SSIDs
|
|
106
106
|
seen = set()
|
|
107
107
|
unique_networks = []
|
|
@@ -110,54 +110,54 @@ def get_available_networks() -> List[Dict[str, str]]:
|
|
|
110
110
|
if ssid and ssid not in seen:
|
|
111
111
|
seen.add(ssid)
|
|
112
112
|
unique_networks.append(net)
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
return unique_networks
|
|
115
115
|
|
|
116
116
|
def display_and_select_network() -> Optional[Dict[str, str]]:
|
|
117
117
|
"""Display available networks and let user select one"""
|
|
118
118
|
console.print("\n[blue]📡 Scanning for available WiFi networks...[/blue]")
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
networks = get_available_networks()
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
if not networks:
|
|
123
123
|
console.print("[red]❌ No networks found or error occurred[/red]")
|
|
124
124
|
return None
|
|
125
|
-
|
|
125
|
+
|
|
126
126
|
# Display networks in a table
|
|
127
127
|
table = Table(title="Available WiFi Networks")
|
|
128
128
|
table.add_column("Index", style="cyan", no_wrap=True)
|
|
129
129
|
table.add_column("SSID", style="green")
|
|
130
130
|
table.add_column("Signal Strength", style="yellow")
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
for i, network in enumerate(networks, 1):
|
|
133
133
|
table.add_row(str(i), network['ssid'], network['signal'])
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
console.print(table)
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
# Let user select
|
|
138
138
|
try:
|
|
139
139
|
choice = Prompt.ask(
|
|
140
140
|
"\n[blue]Select network number (or 'q' to quit)[/blue]",
|
|
141
141
|
default="q"
|
|
142
142
|
)
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
if choice.lower() == 'q':
|
|
145
145
|
return None
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
index = int(choice) - 1
|
|
148
148
|
if 0 <= index < len(networks):
|
|
149
149
|
return networks[index]
|
|
150
150
|
else:
|
|
151
151
|
console.print(f"[red]❌ Invalid selection. Please choose 1-{len(networks)}[/red]")
|
|
152
152
|
return None
|
|
153
|
-
|
|
153
|
+
|
|
154
154
|
except ValueError:
|
|
155
155
|
console.print("[red]❌ Invalid input. Please enter a number.[/red]")
|
|
156
156
|
return None
|
|
157
157
|
def connect(name: str, ssid: str):
|
|
158
158
|
"""Connect to a WiFi network"""
|
|
159
159
|
console.print(f"\n[blue]🌐 Connecting to network: {name} (SSID: {ssid})[/blue]")
|
|
160
|
-
|
|
160
|
+
|
|
161
161
|
try:
|
|
162
162
|
if platform.system() == "Windows":
|
|
163
163
|
subprocess.run(
|
|
@@ -166,9 +166,9 @@ def connect(name: str, ssid: str):
|
|
|
166
166
|
)
|
|
167
167
|
elif platform.system() == "Linux":
|
|
168
168
|
subprocess.run(f"nmcli connection up '{name}'", shell=True, check=True)
|
|
169
|
-
|
|
169
|
+
|
|
170
170
|
console.print("[green]✅ Connected successfully![/green]\n")
|
|
171
|
-
|
|
171
|
+
|
|
172
172
|
except subprocess.CalledProcessError as e:
|
|
173
173
|
console.print(f"[red]❌ Error connecting: {e}[/red]")
|
|
174
174
|
raise
|
|
@@ -194,7 +194,7 @@ def connect_to_new_network(ssid: str, password: str):
|
|
|
194
194
|
# If direct connection fails, create a connection profile
|
|
195
195
|
create_new_connection(ssid, ssid, password)
|
|
196
196
|
connect(ssid, ssid)
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
except Exception as e:
|
|
199
199
|
console.print(f"[red]❌ Failed to connect to {ssid}: {e}[/red]")
|
|
200
200
|
raise
|
|
@@ -202,15 +202,15 @@ def connect_to_new_network(ssid: str, password: str):
|
|
|
202
202
|
def display_available_networks():
|
|
203
203
|
"""Display available networks (legacy function for compatibility)"""
|
|
204
204
|
console.print("\n[blue]📡 Scanning for available networks...[/blue]")
|
|
205
|
-
|
|
205
|
+
|
|
206
206
|
try:
|
|
207
207
|
if platform.system() == "Windows":
|
|
208
208
|
subprocess.run(["netsh", "wlan", "show", "networks", "interface=Wi-Fi"], check=True)
|
|
209
209
|
elif platform.system() == "Linux":
|
|
210
210
|
subprocess.run(["nmcli", "device", "wifi", "list"], check=True)
|
|
211
|
-
|
|
211
|
+
|
|
212
212
|
console.print("[green]✅ Network scan completed![/green]\n")
|
|
213
|
-
|
|
213
|
+
|
|
214
214
|
except subprocess.CalledProcessError as e:
|
|
215
215
|
console.print(f"[red]❌ Error scanning networks: {e}[/red]")
|
|
216
216
|
except Exception as e:
|
|
@@ -224,34 +224,34 @@ def try_config_connection(config_ssid: str) -> bool:
|
|
|
224
224
|
Path.home() / '.config/wifi.ini',
|
|
225
225
|
Path.cwd() / 'wifi.ini'
|
|
226
226
|
]
|
|
227
|
-
|
|
227
|
+
|
|
228
228
|
creds = configparser.ConfigParser()
|
|
229
229
|
config_found = False
|
|
230
|
-
|
|
230
|
+
|
|
231
231
|
for config_path in config_paths:
|
|
232
232
|
if config_path.exists():
|
|
233
233
|
creds.read(config_path)
|
|
234
234
|
config_found = True
|
|
235
235
|
break
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
if not config_found:
|
|
238
238
|
console.print("[yellow]⚠️ No WiFi configuration file found in standard locations[/yellow]")
|
|
239
239
|
return False
|
|
240
|
-
|
|
240
|
+
|
|
241
241
|
if config_ssid not in creds:
|
|
242
242
|
console.print(f"[yellow]⚠️ SSID '{config_ssid}' not found in configuration[/yellow]")
|
|
243
243
|
available_ssids = list(creds.sections())
|
|
244
244
|
if available_ssids:
|
|
245
245
|
console.print(f"[blue]Available configured networks: {', '.join(available_ssids)}[/blue]")
|
|
246
246
|
return False
|
|
247
|
-
|
|
247
|
+
|
|
248
248
|
ssid = creds[config_ssid]['SSID']
|
|
249
249
|
password = creds[config_ssid]['pwd']
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
console.print(f"[green]✅ Found configuration for {config_ssid}[/green]")
|
|
252
252
|
connect_to_new_network(ssid, password)
|
|
253
253
|
return True
|
|
254
|
-
|
|
254
|
+
|
|
255
255
|
except Exception as e:
|
|
256
256
|
console.print(f"[red]❌ Error reading configuration: {e}[/red]")
|
|
257
257
|
return False
|
|
@@ -259,20 +259,20 @@ def try_config_connection(config_ssid: str) -> bool:
|
|
|
259
259
|
def manual_network_selection() -> bool:
|
|
260
260
|
"""Manual network selection and connection"""
|
|
261
261
|
network = display_and_select_network()
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
if not network:
|
|
264
264
|
return False
|
|
265
|
-
|
|
265
|
+
|
|
266
266
|
ssid = network['ssid']
|
|
267
267
|
console.print(f"\n[blue]Selected network: {ssid}[/blue]")
|
|
268
|
-
|
|
268
|
+
|
|
269
269
|
# Get password from user
|
|
270
270
|
password = getpass.getpass(f"Enter password for '{ssid}': ")
|
|
271
|
-
|
|
271
|
+
|
|
272
272
|
if not password:
|
|
273
273
|
console.print("[red]❌ Password cannot be empty[/red]")
|
|
274
274
|
return False
|
|
275
|
-
|
|
275
|
+
|
|
276
276
|
try:
|
|
277
277
|
connect_to_new_network(ssid, password)
|
|
278
278
|
return True
|
|
@@ -282,8 +282,8 @@ def manual_network_selection() -> bool:
|
|
|
282
282
|
def main():
|
|
283
283
|
"""Main function with fallback network selection"""
|
|
284
284
|
console.print(Panel(
|
|
285
|
-
"📶 Welcome to the WiFi Connector Tool",
|
|
286
|
-
title="[bold blue]WiFi Connection[/bold blue]",
|
|
285
|
+
"📶 Welcome to the WiFi Connector Tool",
|
|
286
|
+
title="[bold blue]WiFi Connection[/bold blue]",
|
|
287
287
|
border_style="blue"
|
|
288
288
|
))
|
|
289
289
|
|
|
@@ -293,12 +293,12 @@ def main():
|
|
|
293
293
|
parser.add_argument('-l', "--list", action='store_true', help="📡 List available networks only")
|
|
294
294
|
|
|
295
295
|
args = parser.parse_args()
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
# If user just wants to list networks
|
|
298
298
|
if args.list:
|
|
299
299
|
display_available_networks()
|
|
300
300
|
return
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
# If user wants manual mode, skip config and go straight to selection
|
|
303
303
|
if args.manual:
|
|
304
304
|
console.print("[blue]🔍 Manual network selection mode[/blue]")
|
|
@@ -307,17 +307,17 @@ def main():
|
|
|
307
307
|
else:
|
|
308
308
|
console.print("[red]❌ Failed to connect[/red]")
|
|
309
309
|
return
|
|
310
|
-
|
|
310
|
+
|
|
311
311
|
# Try to connect using configuration first
|
|
312
312
|
console.print(f"[blue]🔍 Attempting to connect to configured network: {args.ssid}[/blue]")
|
|
313
|
-
|
|
313
|
+
|
|
314
314
|
if try_config_connection(args.ssid):
|
|
315
315
|
console.print("[green]🎉 Successfully connected using configuration![/green]")
|
|
316
316
|
return
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
# Configuration failed, offer fallback options
|
|
319
319
|
console.print("\n[yellow]⚠️ Configuration connection failed or not available[/yellow]")
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
if Confirm.ask("[blue]Would you like to manually select a network?[/blue]", default=True):
|
|
322
322
|
if manual_network_selection():
|
|
323
323
|
console.print("[green]🎉 Successfully connected![/green]")
|
|
@@ -329,30 +329,30 @@ def main():
|
|
|
329
329
|
def get_current_wifi_name() -> str:
|
|
330
330
|
"""Get the name of the currently connected WiFi network"""
|
|
331
331
|
console.print("\n[blue]🔍 Checking current WiFi connection...[/blue]")
|
|
332
|
-
|
|
332
|
+
|
|
333
333
|
try:
|
|
334
334
|
if platform.system() == "Windows":
|
|
335
335
|
result = subprocess.run(
|
|
336
|
-
["netsh", "wlan", "show", "interface"],
|
|
336
|
+
["netsh", "wlan", "show", "interface"],
|
|
337
337
|
capture_output=True, text=True, check=True
|
|
338
338
|
)
|
|
339
|
-
|
|
339
|
+
|
|
340
340
|
for line in result.stdout.split("\n"):
|
|
341
341
|
if "SSID" in line and "BSSID" not in line:
|
|
342
342
|
wifi_name = line.split(":")[1].strip()
|
|
343
343
|
if wifi_name:
|
|
344
344
|
console.print(f"[green]✅ Connected to: {wifi_name}[/green]\n")
|
|
345
345
|
return wifi_name
|
|
346
|
-
|
|
346
|
+
|
|
347
347
|
console.print("[yellow]⚠️ Not connected to WiFi[/yellow]\n")
|
|
348
348
|
return "Not connected to WiFi"
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
elif platform.system() == "Linux":
|
|
351
351
|
result = subprocess.run(
|
|
352
|
-
["iwgetid", "-r"],
|
|
352
|
+
["iwgetid", "-r"],
|
|
353
353
|
capture_output=True, text=True, check=True
|
|
354
354
|
)
|
|
355
|
-
|
|
355
|
+
|
|
356
356
|
wifi_name = result.stdout.strip()
|
|
357
357
|
if wifi_name:
|
|
358
358
|
console.print(f"[green]✅ Connected to: {wifi_name}[/green]\n")
|
|
@@ -360,21 +360,21 @@ def get_current_wifi_name() -> str:
|
|
|
360
360
|
else:
|
|
361
361
|
console.print("[yellow]⚠️ Not connected to WiFi[/yellow]\n")
|
|
362
362
|
return "Not connected to WiFi"
|
|
363
|
-
|
|
363
|
+
|
|
364
364
|
except subprocess.CalledProcessError:
|
|
365
365
|
console.print("[yellow]⚠️ Not connected to WiFi or unable to detect[/yellow]\n")
|
|
366
366
|
return "Not connected to WiFi"
|
|
367
367
|
except Exception as e:
|
|
368
368
|
console.print(f"[red]❌ Error: {e}[/red]\n")
|
|
369
369
|
return "Error detecting WiFi"
|
|
370
|
-
|
|
370
|
+
|
|
371
371
|
console.print("[yellow]⚠️ System not supported[/yellow]\n")
|
|
372
372
|
return "System not supported"
|
|
373
373
|
|
|
374
374
|
def create_new_connection(name: str, ssid: str, password: str):
|
|
375
375
|
"""Create a new WiFi connection profile"""
|
|
376
376
|
console.print(f"\n[blue]🔧 Creating new connection: {name} (SSID: {ssid})[/blue]")
|
|
377
|
-
|
|
377
|
+
|
|
378
378
|
try:
|
|
379
379
|
if platform.system() == "Windows":
|
|
380
380
|
# Create proper Windows WiFi profile XML
|
|
@@ -403,36 +403,35 @@ def create_new_connection(name: str, ssid: str, password: str):
|
|
|
403
403
|
</security>
|
|
404
404
|
</MSM>
|
|
405
405
|
</WLANProfile>"""
|
|
406
|
-
|
|
406
|
+
|
|
407
407
|
profile_path = f"{name}.xml"
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
408
|
+
Path(profile_path).write_text(xml_config, encoding="utf-8")
|
|
409
|
+
|
|
411
410
|
subprocess.run(
|
|
412
411
|
["netsh", "wlan", "add", "profile", f"filename={profile_path}", "interface=Wi-Fi"],
|
|
413
412
|
capture_output=True, text=True, check=True
|
|
414
413
|
)
|
|
415
|
-
|
|
414
|
+
|
|
416
415
|
# Clean up the XML file
|
|
417
416
|
try:
|
|
418
417
|
os.remove(profile_path)
|
|
419
418
|
except OSError:
|
|
420
419
|
pass
|
|
421
|
-
|
|
420
|
+
|
|
422
421
|
elif platform.system() == "Linux":
|
|
423
422
|
# Check if connection already exists
|
|
424
423
|
check_cmd = f"nmcli connection show '{name}'"
|
|
425
424
|
check_result = subprocess.run(check_cmd, shell=True, capture_output=True)
|
|
426
|
-
|
|
425
|
+
|
|
427
426
|
if check_result.returncode == 0:
|
|
428
427
|
console.print(f"[yellow]⚠️ Connection '{name}' already exists, deleting old one...[/yellow]")
|
|
429
428
|
subprocess.run(f"nmcli connection delete '{name}'", shell=True, check=True)
|
|
430
|
-
|
|
429
|
+
|
|
431
430
|
command = f"nmcli connection add type wifi con-name '{name}' ssid '{ssid}' wifi-sec.key-mgmt wpa-psk wifi-sec.psk '{password}'"
|
|
432
431
|
subprocess.run(command, shell=True, check=True)
|
|
433
|
-
|
|
432
|
+
|
|
434
433
|
console.print("[green]✅ Connection created successfully![/green]\n")
|
|
435
|
-
|
|
434
|
+
|
|
436
435
|
except subprocess.CalledProcessError as e:
|
|
437
436
|
console.print(f"[red]❌ Error creating connection: {e}[/red]")
|
|
438
437
|
raise
|
|
@@ -55,7 +55,7 @@ Otherwise, a flag must be raised to indicate the direction.""")
|
|
|
55
55
|
path.copy(folder=WIN_FROM_WSL.joinpath(UserName).joinpath(path.rel2home().parent), overwrite=True)
|
|
56
56
|
print("✅ Transfer completed successfully!\n")
|
|
57
57
|
else:
|
|
58
|
-
from
|
|
58
|
+
from machineconfig.utils.ssh import SSH
|
|
59
59
|
import platform
|
|
60
60
|
port = int(args.port) if args.port else (2222 if system == "Windows" else 22)
|
|
61
61
|
username = UserName
|
|
@@ -33,8 +33,8 @@ exclude = [
|
|
|
33
33
|
line-length = 250
|
|
34
34
|
indent-width = 4
|
|
35
35
|
|
|
36
|
-
# Assume Python 3.
|
|
37
|
-
# target-version = "
|
|
36
|
+
# Assume Python 3.13
|
|
37
|
+
# target-version = "py313"
|
|
38
38
|
|
|
39
39
|
[lint]
|
|
40
40
|
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"""G
|
|
1
|
+
# """G
|
|
2
2
|
|
|
3
|
-
"""
|
|
3
|
+
# """
|
|
4
4
|
|
|
5
|
-
from IPython.core.magic import register_line_magic
|
|
6
|
-
from machineconfig.utils.utils2 import randstr
|
|
7
|
-
from machineconfig.utils.path_reduced import P as PathExtended
|
|
8
|
-
from rich import inspect
|
|
9
|
-
from typing import Any
|
|
5
|
+
# from IPython.core.magic import register_line_magic
|
|
6
|
+
# from machineconfig.utils.utils2 import randstr
|
|
7
|
+
# from machineconfig.utils.path_reduced import P as PathExtended
|
|
8
|
+
# from rich import inspect
|
|
9
|
+
# from typing import Any
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def get_names():
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
# def get_names():
|
|
13
|
+
# res: dict[str, list[str]] = {}
|
|
14
|
+
# for item in globals().keys():
|
|
15
|
+
# if item.startswith("_") or item in ("open", "In", "Out", "quit", "exit", "get_ipython"):
|
|
16
|
+
# continue
|
|
17
|
+
# if item in ("P", "randstr", "Struct", "print_code", "print_dir_func", "print_program_func", "run_python_file_in_this_namespace"):
|
|
18
|
+
# continue
|
|
19
|
+
# type_ = repr(type(eval(item))) # type: ignore # pylint: disable=eval-used
|
|
20
|
+
# if "typing." in type_: continue
|
|
21
|
+
# if type_ in res: res[type_].append(item)
|
|
22
|
+
# else: res[type_] = [item]
|
|
23
|
+
# return res
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
@register_line_magic("codei") # type: ignore
|
|
27
|
-
def print_code_interactive(_):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
# @register_line_magic("codei") # type: ignore
|
|
27
|
+
# def print_code_interactive(_):
|
|
28
|
+
# res = get_names()
|
|
29
|
+
# from machineconfig.utils.utils import choose_one_option
|
|
30
|
+
# choice = choose_one_option(options=res["<class 'function'>"], msg="Choose a type to inspect", fzf=True)
|
|
31
|
+
# obj = eval(choice, globals(), locals()) # type: ignore # pylint: disable=eval-used
|
|
32
|
+
# from rich.syntax import Syntax
|
|
33
|
+
# import inspect
|
|
34
|
+
# q: str = inspect.getsource(obj)
|
|
35
|
+
# from rich import console
|
|
36
|
+
# console.Console().print(Syntax(code=q, lexer="python"))
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
@register_line_magic("print_dir") # type: ignore
|
|
40
|
-
def print_dir_func(line: Any):
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
📂 Objects Defined in Current Directory
|
|
46
|
-
=======================================
|
|
47
|
-
""")
|
|
39
|
+
# @register_line_magic("print_dir") # type: ignore
|
|
40
|
+
# def print_dir_func(line: Any):
|
|
41
|
+
# """Pretty print and categorize dir() output."""
|
|
42
|
+
# _ = line # ipython caller assumes there is at least one argument, an passes '' worstcase.
|
|
43
|
+
# res = get_names()
|
|
44
|
+
# inspect(res, value=False, title="""
|
|
45
|
+
# 📂 Objects Defined in Current Directory
|
|
46
|
+
# =======================================
|
|
47
|
+
# """)
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
@register_line_magic("code") # type: ignore
|
|
51
|
-
def print_program_func(obj_str: str):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
# @register_line_magic("code") # type: ignore
|
|
51
|
+
# def print_program_func(obj_str: str):
|
|
52
|
+
# """Inspect the code of an object."""
|
|
53
|
+
# obj = eval(obj_str, globals(), locals()) # type: ignore # pylint: disable=eval-used
|
|
54
|
+
# from rich.syntax import Syntax
|
|
55
|
+
# import inspect
|
|
56
|
+
# q: str = inspect.getsource(obj)
|
|
57
|
+
# from rich import console
|
|
58
|
+
# console.Console().print(Syntax(code=q, lexer="python"))
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
@register_line_magic("play") # type: ignore
|
|
62
|
-
def run_python_file_in_this_namespace(a_path: str, module: bool=False):
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
# @register_line_magic("play") # type: ignore
|
|
62
|
+
# def run_python_file_in_this_namespace(a_path: str, module: bool=False):
|
|
63
|
+
# """Given a potentially dirty path of python file, run it in this namespace."""
|
|
64
|
+
# from machineconfig.utils.utils import match_file_name, sanitize_path
|
|
65
|
+
# path = sanitize_path(PathExtended(a_path))
|
|
66
|
+
# if not path.exists():
|
|
67
|
+
# path = match_file_name(a_path, search_root=PathExtended.cwd())
|
|
68
|
+
# from IPython import get_ipython # type: ignore # this gets the same instance, its in the namespace anyway even if not imported.
|
|
69
|
+
# if module:
|
|
70
|
+
# result = PathExtended.tmp().joinpath(f"tmp_scripts/python/{randstr()}.py")
|
|
71
|
+
# result.parent.mkdir(parents=True, exist_ok=True)
|
|
72
|
+
# result.write_text(f"""
|
|
73
|
+
# import sys
|
|
74
|
+
# sys.path.append(r'{path.parent}')
|
|
75
|
+
# from {path.stem} import *
|
|
76
|
+
# """, encoding="utf-8")
|
|
77
|
+
# print("""💡 IPyExtension: Remember that reload fails for imported modules that import other varying modules.""")
|
|
78
|
+
# get_ipython().run_line_magic(magic_name="load", line=result) # type: ignore
|
|
79
|
+
# return
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
result = path.as_posix()
|
|
82
|
-
print(f"➡️ Running magic: %run {result}")
|
|
83
|
-
get_ipython().run_line_magic(magic_name="run", line=result) # type: ignore
|
|
84
|
-
globals().update(locals())
|
|
81
|
+
# result = path.as_posix()
|
|
82
|
+
# print(f"➡️ Running magic: %run {result}")
|
|
83
|
+
# get_ipython().run_line_magic(magic_name="run", line=result) # type: ignore
|
|
84
|
+
# globals().update(locals())
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"copyOnSelect": true,
|
|
7
7
|
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
|
|
8
8
|
"focusFollowMouse": true,
|
|
9
|
-
"keybindings":
|
|
9
|
+
"keybindings":
|
|
10
10
|
[
|
|
11
11
|
{
|
|
12
12
|
"id": "Terminal.TogglePaneZoom",
|
|
@@ -38,27 +38,27 @@
|
|
|
38
38
|
}
|
|
39
39
|
],
|
|
40
40
|
"launchMode": "fullscreen",
|
|
41
|
-
"newTabMenu":
|
|
41
|
+
"newTabMenu":
|
|
42
42
|
[
|
|
43
43
|
{
|
|
44
44
|
"type": "remainingProfiles"
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
|
-
"profiles":
|
|
47
|
+
"profiles":
|
|
48
48
|
{
|
|
49
|
-
"defaults":
|
|
49
|
+
"defaults":
|
|
50
50
|
{
|
|
51
51
|
"colorScheme": "Campbell (modified)",
|
|
52
52
|
"padding": "0",
|
|
53
53
|
"useAcrylic": false
|
|
54
54
|
},
|
|
55
|
-
"list":
|
|
55
|
+
"list":
|
|
56
56
|
[
|
|
57
57
|
{
|
|
58
58
|
"commandline": "pwsh",
|
|
59
59
|
"cursorColor": "#D4D8E1",
|
|
60
60
|
"cursorShape": "filledBox",
|
|
61
|
-
"font":
|
|
61
|
+
"font":
|
|
62
62
|
{
|
|
63
63
|
"face": "CaskaydiaCove Nerd Font"
|
|
64
64
|
},
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
|
|
87
|
-
"font":
|
|
87
|
+
"font":
|
|
88
88
|
{
|
|
89
89
|
"face": "CaskaydiaCove Nerd Font"
|
|
90
90
|
},
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
}
|
|
143
143
|
]
|
|
144
144
|
},
|
|
145
|
-
"schemes":
|
|
145
|
+
"schemes":
|
|
146
146
|
[
|
|
147
147
|
{
|
|
148
148
|
"background": "#000000",
|