atomicshop 3.3.8__py3-none-any.whl → 3.10.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 atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/a_mains/get_local_tcp_ports.py +85 -0
- atomicshop/a_mains/install_ca_certificate.py +172 -0
- atomicshop/a_mains/process_from_port.py +119 -0
- atomicshop/a_mains/set_default_dns_gateway.py +90 -0
- atomicshop/basics/strings.py +1 -1
- atomicshop/certificates.py +2 -2
- atomicshop/dns.py +26 -28
- atomicshop/etws/traces/trace_tcp.py +1 -2
- atomicshop/mitm/centered_settings.py +133 -0
- atomicshop/mitm/config_static.py +22 -44
- atomicshop/mitm/connection_thread_worker.py +383 -165
- atomicshop/mitm/engines/__parent/recorder___parent.py +1 -1
- atomicshop/mitm/engines/__parent/requester___parent.py +1 -1
- atomicshop/mitm/engines/__parent/responder___parent.py +15 -2
- atomicshop/mitm/engines/create_module_template.py +1 -2
- atomicshop/mitm/import_config.py +91 -89
- atomicshop/mitm/initialize_engines.py +1 -2
- atomicshop/mitm/message.py +5 -4
- atomicshop/mitm/mitm_main.py +238 -122
- atomicshop/mitm/recs_files.py +61 -5
- atomicshop/mitm/ssh_tester.py +82 -0
- atomicshop/mitm/statistic_analyzer.py +33 -12
- atomicshop/mitm/statistic_analyzer_helper/moving_average_helper.py +104 -31
- atomicshop/networks.py +160 -92
- atomicshop/package_mains_processor.py +84 -0
- atomicshop/permissions/ubuntu_permissions.py +47 -0
- atomicshop/print_api.py +3 -5
- atomicshop/process.py +11 -4
- atomicshop/python_functions.py +23 -108
- atomicshop/speech_recognize.py +8 -0
- atomicshop/ssh_remote.py +140 -164
- atomicshop/web.py +63 -22
- atomicshop/web_apis/google_llm.py +22 -14
- atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py +2 -1
- atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py +2 -1
- atomicshop/wrappers/dockerw/dockerw.py +2 -2
- atomicshop/wrappers/elasticsearchw/config_basic.py +0 -12
- atomicshop/wrappers/elasticsearchw/elastic_infra.py +0 -190
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py +5 -5
- atomicshop/wrappers/githubw.py +180 -68
- atomicshop/wrappers/loggingw/consts.py +1 -1
- atomicshop/wrappers/loggingw/handlers.py +1 -1
- atomicshop/wrappers/loggingw/loggingw.py +20 -4
- atomicshop/wrappers/loggingw/reading.py +18 -0
- atomicshop/wrappers/mongodbw/mongo_infra.py +0 -38
- atomicshop/wrappers/netshw.py +124 -3
- atomicshop/wrappers/playwrightw/scenarios.py +1 -1
- atomicshop/wrappers/powershell_networking.py +80 -0
- atomicshop/wrappers/psutilw/psutil_networks.py +9 -0
- atomicshop/wrappers/pywin32w/win_event_log/fetch.py +174 -0
- atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_create.py +3 -105
- atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_terminate.py +3 -57
- atomicshop/wrappers/pywin32w/wmis/win32_networkadapterconfiguration.py +12 -27
- atomicshop/wrappers/pywin32w/wmis/win32networkadapter.py +15 -9
- atomicshop/wrappers/socketw/certificator.py +19 -9
- atomicshop/wrappers/socketw/creator.py +101 -14
- atomicshop/wrappers/socketw/dns_server.py +17 -5
- atomicshop/wrappers/socketw/exception_wrapper.py +21 -16
- atomicshop/wrappers/socketw/process_getter.py +86 -0
- atomicshop/wrappers/socketw/receiver.py +29 -9
- atomicshop/wrappers/socketw/sender.py +10 -9
- atomicshop/wrappers/socketw/sni.py +31 -10
- atomicshop/wrappers/socketw/{base.py → socket_base.py} +33 -1
- atomicshop/wrappers/socketw/socket_client.py +11 -10
- atomicshop/wrappers/socketw/socket_wrapper.py +125 -32
- atomicshop/wrappers/socketw/ssl_base.py +6 -2
- atomicshop/wrappers/ubuntu_terminal.py +21 -18
- atomicshop/wrappers/win_auditw.py +189 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/METADATA +25 -30
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/RECORD +83 -109
- atomicshop/_basics_temp.py +0 -101
- atomicshop/a_installs/ubuntu/docker_rootless.py +0 -11
- atomicshop/a_installs/ubuntu/docker_sudo.py +0 -11
- atomicshop/a_installs/ubuntu/elastic_search_and_kibana.py +0 -10
- atomicshop/a_installs/ubuntu/mongodb.py +0 -12
- atomicshop/a_installs/win/fibratus.py +0 -9
- atomicshop/a_installs/win/mongodb.py +0 -9
- atomicshop/a_installs/win/wsl_ubuntu_lts.py +0 -10
- atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh +0 -3
- atomicshop/addons/package_setup/CreateWheel.cmd +0 -7
- atomicshop/addons/package_setup/Setup in Edit mode.cmd +0 -6
- atomicshop/addons/package_setup/Setup.cmd +0 -7
- atomicshop/archiver/__init__.py +0 -0
- atomicshop/archiver/_search_in_zip.py +0 -189
- atomicshop/archiver/search_in_archive.py +0 -284
- atomicshop/archiver/sevenz_app_w.py +0 -86
- atomicshop/archiver/sevenzs.py +0 -73
- atomicshop/archiver/shutils.py +0 -34
- atomicshop/archiver/zips.py +0 -353
- atomicshop/file_types.py +0 -24
- atomicshop/pbtkmultifile_argparse.py +0 -88
- atomicshop/script_as_string_processor.py +0 -42
- atomicshop/ssh_scripts/process_from_ipv4.py +0 -37
- atomicshop/ssh_scripts/process_from_port.py +0 -27
- atomicshop/wrappers/_process_wrapper_curl.py +0 -27
- atomicshop/wrappers/_process_wrapper_tar.py +0 -21
- atomicshop/wrappers/dockerw/install_docker.py +0 -449
- atomicshop/wrappers/elasticsearchw/install_elastic.py +0 -233
- atomicshop/wrappers/ffmpegw.py +0 -125
- atomicshop/wrappers/fibratusw/__init__.py +0 -0
- atomicshop/wrappers/fibratusw/install.py +0 -80
- atomicshop/wrappers/mongodbw/install_mongodb_ubuntu.py +0 -100
- atomicshop/wrappers/mongodbw/install_mongodb_win.py +0 -244
- atomicshop/wrappers/process_wrapper_pbtk.py +0 -16
- atomicshop/wrappers/socketw/get_process.py +0 -123
- atomicshop/wrappers/wslw.py +0 -192
- atomicshop-3.3.8.dist-info/entry_points.txt +0 -2
- /atomicshop/{addons → a_mains/addons}/PlayWrightCodegen.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/ScriptExecution.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/inits/init_to_import_all_modules.py +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/ReadMe.txt +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compile.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.dll +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.exp +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.lib +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/process_list.cpp +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/top_level.txt +0 -0
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Needed to redirect output from console to logger on LOCALHOST process command line harvesting.
|
|
2
|
-
import io
|
|
3
|
-
from contextlib import redirect_stdout
|
|
4
|
-
import logging
|
|
5
|
-
|
|
6
|
-
from . import base
|
|
7
|
-
from ...ssh_remote import SSHRemote
|
|
8
|
-
from ...print_api import print_api
|
|
9
|
-
|
|
10
|
-
import psutil
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class GetCommandLine:
|
|
14
|
-
def __init__(
|
|
15
|
-
self,
|
|
16
|
-
client_socket=None,
|
|
17
|
-
ssh_script_processor=None,
|
|
18
|
-
ssh_user: str = None,
|
|
19
|
-
ssh_pass: str = None,
|
|
20
|
-
logger: logging.Logger = None
|
|
21
|
-
):
|
|
22
|
-
self.client_socket = client_socket
|
|
23
|
-
self.ssh_script_processor = ssh_script_processor
|
|
24
|
-
self.ssh_user: str = ssh_user
|
|
25
|
-
self.ssh_pass: str = ssh_pass
|
|
26
|
-
self.logger: logging.Logger = logger
|
|
27
|
-
|
|
28
|
-
def get_process_name(self, print_kwargs: dict = None):
|
|
29
|
-
# Get client ip and the source port.
|
|
30
|
-
client_ip, source_port = base.get_source_address_from_socket(self.client_socket)
|
|
31
|
-
|
|
32
|
-
# Put source port variable inside the string script.
|
|
33
|
-
updated_script_string = self.ssh_script_processor.put_variable_into_script_string(
|
|
34
|
-
source_port, print_kwargs=print_kwargs)
|
|
35
|
-
|
|
36
|
-
process_name = self.get_process_commandline(
|
|
37
|
-
client_ip=client_ip,
|
|
38
|
-
script_string=updated_script_string,
|
|
39
|
-
print_kwargs=print_kwargs)
|
|
40
|
-
|
|
41
|
-
return process_name
|
|
42
|
-
|
|
43
|
-
def get_process_commandline(
|
|
44
|
-
self,
|
|
45
|
-
client_ip: str,
|
|
46
|
-
script_string: str,
|
|
47
|
-
print_kwargs: dict = None
|
|
48
|
-
):
|
|
49
|
-
execution_output = None
|
|
50
|
-
execution_error = None
|
|
51
|
-
|
|
52
|
-
# Checking if we're on localhost. If not, we'll execute SSH connection to get calling process name.
|
|
53
|
-
if client_ip not in base.THIS_DEVICE_IP_LIST:
|
|
54
|
-
# Tried using paramiko SSH concurrently within threads, but with bigger loads it just breaks.
|
|
55
|
-
# So, better using it separately for each thread.
|
|
56
|
-
|
|
57
|
-
print_api(f"Initializing SSH connection to [{client_ip}]", **print_kwargs)
|
|
58
|
-
# Initializing SSHRemote class.
|
|
59
|
-
current_ssh_client = SSHRemote(
|
|
60
|
-
ip_address=client_ip, username=self.ssh_user, password=self.ssh_pass, logger=self.logger)
|
|
61
|
-
|
|
62
|
-
execution_output, execution_error = current_ssh_client.connect_get_client_commandline(script_string)
|
|
63
|
-
# Else, if we're on localhost, then execute the script directly without SSH.
|
|
64
|
-
else:
|
|
65
|
-
print_api(f"Executing LOCALHOST command to get the calling process.", **print_kwargs)
|
|
66
|
-
# Getting the redirection from console print, since that what the 'script_string' does.
|
|
67
|
-
with io.StringIO() as buffer, redirect_stdout(buffer):
|
|
68
|
-
# Executing the script with print to console.
|
|
69
|
-
try:
|
|
70
|
-
exec(script_string)
|
|
71
|
-
except ModuleNotFoundError as function_exception_object:
|
|
72
|
-
execution_error = f"Module not installed: {function_exception_object}"
|
|
73
|
-
print_api(
|
|
74
|
-
execution_error, error_type=True, logger_method="error", traceback_string=True,
|
|
75
|
-
**print_kwargs)
|
|
76
|
-
except psutil.AccessDenied:
|
|
77
|
-
execution_error = f"Access Denied for 'psutil' to read system process command line. " \
|
|
78
|
-
f"Run script with Admin Rights."
|
|
79
|
-
print_api(
|
|
80
|
-
execution_error, error_type=True, logger_method="error", traceback_string=True,
|
|
81
|
-
**print_kwargs)
|
|
82
|
-
|
|
83
|
-
if not execution_error:
|
|
84
|
-
# Reading the buffer.
|
|
85
|
-
execution_output = buffer.getvalue()
|
|
86
|
-
|
|
87
|
-
# This section is generic for both remote SSH and localhost executions of the script.
|
|
88
|
-
process_name = self.get_commandline_and_error(execution_output, execution_error, print_kwargs=print_kwargs)
|
|
89
|
-
|
|
90
|
-
return process_name
|
|
91
|
-
|
|
92
|
-
@staticmethod
|
|
93
|
-
def get_commandline_and_error(
|
|
94
|
-
execution_output,
|
|
95
|
-
execution_error,
|
|
96
|
-
print_kwargs: dict = None
|
|
97
|
-
):
|
|
98
|
-
# If there was known error on localhost / known error on remote or any kind of error on remote, it was
|
|
99
|
-
# already logged, so we'll just put the error into 'process_name'.
|
|
100
|
-
if execution_error:
|
|
101
|
-
process_name = execution_error
|
|
102
|
-
print_api(
|
|
103
|
-
f"Error During Command Execution: {process_name}", error_type=True,
|
|
104
|
-
logger_method='error', **(print_kwargs or {}))
|
|
105
|
-
# If there wasn't any error of above types, then we can put the output from either local or remote script
|
|
106
|
-
# execution into 'process_name' and log it / output to console.
|
|
107
|
-
else:
|
|
108
|
-
# If the output that was returned is not empty.
|
|
109
|
-
if execution_output:
|
|
110
|
-
# Replacing '\r\n' escape lines with string, so that the line will not be escaped in logs.
|
|
111
|
-
if '\r\n' in execution_output:
|
|
112
|
-
execution_output = execution_output.replace('\r\n', '')
|
|
113
|
-
elif '\n' in execution_output:
|
|
114
|
-
execution_output = execution_output.replace('\n', '')
|
|
115
|
-
|
|
116
|
-
process_name = execution_output
|
|
117
|
-
print_api(f"Client Process Command Line: {process_name}", **(print_kwargs or {}))
|
|
118
|
-
# Else if the script output came back empty.
|
|
119
|
-
else:
|
|
120
|
-
process_name = "Client Process Command Line came back empty after script execution."
|
|
121
|
-
print_api(process_name, error_type=True, logger_method='error', **(print_kwargs or {}))
|
|
122
|
-
|
|
123
|
-
return process_name
|
atomicshop/wrappers/wslw.py
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
from ..import process, permissions, virtualization
|
|
5
|
-
from ..permissions import permissions
|
|
6
|
-
from ..print_api import print_api
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def is_installed():
|
|
10
|
-
# Command to check the status of the WSL feature
|
|
11
|
-
command = "Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"
|
|
12
|
-
|
|
13
|
-
# Check if WSL is enabled
|
|
14
|
-
if "Enabled" in process.run_powershell_command(command):
|
|
15
|
-
return True
|
|
16
|
-
else:
|
|
17
|
-
return False
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def get_installed_distros() -> list:
|
|
21
|
-
"""
|
|
22
|
-
Get a list of installed WSL distros.
|
|
23
|
-
:return: list, list of installed WSL distros.
|
|
24
|
-
"""
|
|
25
|
-
return process.execute_with_live_output("wsl --list --quiet")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_available_distros_to_install() -> list:
|
|
29
|
-
"""
|
|
30
|
-
Get a list of available WSL distros to install.
|
|
31
|
-
:return: list, list of available WSL distros to install.
|
|
32
|
-
"""
|
|
33
|
-
return process.execute_with_live_output("wsl --list --online")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def is_ubuntu_installed(version: str = "22.04") -> bool:
|
|
37
|
-
"""
|
|
38
|
-
Check if specific version of Ubuntu is installed on WSL.
|
|
39
|
-
:param version: string, Ubuntu version to check for. Default is 22.04.
|
|
40
|
-
:return: bool, True if Ubuntu is installed, False otherwise.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
if not version:
|
|
44
|
-
version = str()
|
|
45
|
-
|
|
46
|
-
installed_distros_list = get_installed_distros()
|
|
47
|
-
|
|
48
|
-
if f'Ubuntu-{version}' in installed_distros_list:
|
|
49
|
-
return True
|
|
50
|
-
elif 'Ubuntu' in installed_distros_list:
|
|
51
|
-
# Command to get Ubuntu version
|
|
52
|
-
command = f"wsl -d Ubuntu lsb_release -a"
|
|
53
|
-
|
|
54
|
-
# Execute the command
|
|
55
|
-
result = process.execute_with_live_output(command)
|
|
56
|
-
|
|
57
|
-
is_version_installed: bool = False
|
|
58
|
-
# Parse the output for the version number
|
|
59
|
-
for line in result:
|
|
60
|
-
if "Release" in line and version in line:
|
|
61
|
-
is_version_installed = True
|
|
62
|
-
break
|
|
63
|
-
|
|
64
|
-
return is_version_installed
|
|
65
|
-
else:
|
|
66
|
-
return False
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def install_wsl_manual(
|
|
70
|
-
directory_path: str, enable_virtual_machine_platform: bool = True, set_default_version_2: bool = True):
|
|
71
|
-
# noinspection GrazieInspection
|
|
72
|
-
"""
|
|
73
|
-
Install WSL on Windows 10.
|
|
74
|
-
:param directory_path: string, directory path to save Ubuntu package.
|
|
75
|
-
:param enable_virtual_machine_platform: bool, True to enable Virtual Machine Platform feature.
|
|
76
|
-
:param set_default_version_2: bool, True to set WSL version 2 as default.
|
|
77
|
-
|
|
78
|
-
Main.py example:
|
|
79
|
-
import sys
|
|
80
|
-
from atomicshop.wrappers import wslw
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def main():
|
|
84
|
-
if len(sys.argv) < 2:
|
|
85
|
-
print("Usage: python main.py <directory_path_to_save_Ubuntu_package>")
|
|
86
|
-
sys.exit(1)
|
|
87
|
-
|
|
88
|
-
wslw.install_wsl(directory_path=sys.argv[1])
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if __name__ == '__main__':
|
|
92
|
-
main()
|
|
93
|
-
"""
|
|
94
|
-
|
|
95
|
-
# Check for admin privileges
|
|
96
|
-
if not permissions.is_admin():
|
|
97
|
-
sys.exit("Script must be run as administrator")
|
|
98
|
-
|
|
99
|
-
# Check if WSL is already installed
|
|
100
|
-
if is_installed():
|
|
101
|
-
print_api("WSL is already installed", color='green')
|
|
102
|
-
else:
|
|
103
|
-
# Enable WSL
|
|
104
|
-
print_api("Enabling Windows Subsystem for Linux...")
|
|
105
|
-
process.run_powershell_command(
|
|
106
|
-
"Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart")
|
|
107
|
-
|
|
108
|
-
# # Check if the system needs a reboot
|
|
109
|
-
# if "RestartNeeded : True" in process.run_powershell_command(
|
|
110
|
-
# "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"):
|
|
111
|
-
# print_api("Please restart your computer to complete the installation of WSL and rerun the script.")
|
|
112
|
-
# sys.exit(0)
|
|
113
|
-
|
|
114
|
-
# Enable Virtual Machine Platform is needed for WSL 2.
|
|
115
|
-
if enable_virtual_machine_platform:
|
|
116
|
-
# Check if Hyper-V is enabled
|
|
117
|
-
if "Enabled" in process.run_powershell_command(
|
|
118
|
-
"Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V"):
|
|
119
|
-
print_api("Hyper-V is enabled")
|
|
120
|
-
else:
|
|
121
|
-
# Command to enable Virtual Machine Platform
|
|
122
|
-
command = "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart"
|
|
123
|
-
|
|
124
|
-
print_api("Enabling Virtual Machine Platform...")
|
|
125
|
-
process.run_powershell_command(command)
|
|
126
|
-
|
|
127
|
-
# Set WSL version 2 as default.
|
|
128
|
-
if set_default_version_2:
|
|
129
|
-
print_api("Setting WSL version 2 as default...")
|
|
130
|
-
process.execute_with_live_output("wsl --set-default-version 2")
|
|
131
|
-
|
|
132
|
-
# Check if Ubuntu is already installed. If so, exit with a message.
|
|
133
|
-
if is_ubuntu_installed():
|
|
134
|
-
print_api("Ubuntu is already installed", color='green')
|
|
135
|
-
sys.exit(0)
|
|
136
|
-
|
|
137
|
-
# Before you install Ubuntu, you need to set the WSL to version 2.
|
|
138
|
-
# You can do it after you install, but if so, you will need to set the Ubuntu to version 2 either.
|
|
139
|
-
# Download and Install Ubuntu.
|
|
140
|
-
print_api("Installing Ubuntu for WSL...")
|
|
141
|
-
package_file_path: str = str(Path(directory_path, "Ubuntu.appx"))
|
|
142
|
-
process.run_powershell_command(
|
|
143
|
-
f"Invoke-WebRequest -Uri https://aka.ms/wslubuntu2204 -OutFile {package_file_path} -UseBasicParsing")
|
|
144
|
-
process.run_powershell_command(f"Add-AppxPackage {package_file_path}")
|
|
145
|
-
|
|
146
|
-
print_api("Ubuntu installation is complete. You can now launch Ubuntu from the Start Menu.")
|
|
147
|
-
print_api("Please restart your computer to complete the installation.")
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def install_wsl(distro: str = "Ubuntu-22.04"):
|
|
151
|
-
# noinspection GrazieInspection
|
|
152
|
-
"""
|
|
153
|
-
Install WSL and Ubuntu.
|
|
154
|
-
:param distro: string, distro to install. Default is Ubuntu-22.04.
|
|
155
|
-
:return:
|
|
156
|
-
|
|
157
|
-
Main.py example:
|
|
158
|
-
from atomicshop.wrappers import wslw
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def main():
|
|
162
|
-
wslw.install_wsl()
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if __name__ == '__main__':
|
|
166
|
-
main()
|
|
167
|
-
"""
|
|
168
|
-
|
|
169
|
-
# Check for admin privileges
|
|
170
|
-
if not permissions.is_admin():
|
|
171
|
-
print_api("Script must be run as administrator", color='red')
|
|
172
|
-
sys.exit(1)
|
|
173
|
-
|
|
174
|
-
# Check if virtualization is enabled.
|
|
175
|
-
if not virtualization.is_enabled():
|
|
176
|
-
print_api("Virtualization is not enabled in the bios. Please enable it and rerun the script.", color='red')
|
|
177
|
-
sys.exit(1)
|
|
178
|
-
|
|
179
|
-
# Check if WSL and Ubuntu is already installed
|
|
180
|
-
wsl_installed: bool = is_installed()
|
|
181
|
-
ubuntu_installed: bool = is_ubuntu_installed()
|
|
182
|
-
|
|
183
|
-
if wsl_installed and ubuntu_installed:
|
|
184
|
-
print_api("WSL and Ubuntu is already installed", color='green')
|
|
185
|
-
sys.exit(0)
|
|
186
|
-
elif wsl_installed and not ubuntu_installed:
|
|
187
|
-
print_api("WSL is already installed, installing Ubuntu")
|
|
188
|
-
elif not wsl_installed:
|
|
189
|
-
print_api("WSL is not installed, installing WSL and Ubuntu")
|
|
190
|
-
|
|
191
|
-
command = f"wsl --install -d {distro}"
|
|
192
|
-
process.execute_with_live_output(command, verbose=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|