computer-use-ootb-internal 0.0.160__tar.gz → 0.0.161__tar.gz
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.
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/PKG-INFO +1 -1
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/pyproject.toml +1 -1
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/guard_service.py +64 -59
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/.gitignore +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/README.md +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/app_teachmode.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/animation/click_animation.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/animation/icons8-select-cursor-transparent-96.gif +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/animation/test_animation.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/executor/teachmode_executor.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/gui_capture.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/simple_parser/utils.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_cli.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/gui_parser/uia_tools/screenshot_service.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/llm_utils.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/oai.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_litellm.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/gui_agent/llm_utils/run_llm.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/aws_request.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/base.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/bash.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/collection.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/colorful_text.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/computer.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/computer_marbot.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/edit.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/run.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/computer_use_demo/tools/screen_capture.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/dependency_check.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/preparation/__init__.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/preparation/star_rail_prepare.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/requirements-lite.txt +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/run_teachmode_ootb_args.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/service_manager.py +0 -0
- {computer_use_ootb_internal-0.0.160 → computer_use_ootb_internal-0.0.161}/src/computer_use_ootb_internal/signal_connection.py +0 -0
@@ -758,74 +758,79 @@ class GuardService(win32serviceutil.ServiceFramework):
|
|
758
758
|
self.log_error(f"Internal trigger: Error checking existing processes for {user}: {e}")
|
759
759
|
# Continue and attempt start despite error?
|
760
760
|
|
761
|
-
#
|
762
|
-
|
763
|
-
|
764
|
-
|
761
|
+
# --- Removed CreateProcessAsUser logic ---
|
762
|
+
# 4. Attempt immediate start directly via subprocess calling PowerShell
|
763
|
+
immediate_start_status = "start_attempted_direct_subprocess"
|
764
|
+
self.log_info(f"Internal trigger: User '{user}' is active and not running. Attempting immediate start via direct PowerShell subprocess...")
|
765
|
+
|
765
766
|
if not self.target_executable_path:
|
766
767
|
self.log_error("Internal trigger: Cannot start process - target executable path not found.")
|
767
768
|
final_status = "failed_exe_not_found"
|
768
|
-
return final_status
|
769
|
+
return final_status
|
769
770
|
|
770
771
|
try:
|
771
|
-
|
772
|
-
env = win32profile.CreateEnvironmentBlock(token, False)
|
773
|
-
startup = win32process.STARTUPINFO()
|
774
|
-
# Use CREATE_NEW_CONSOLE to make the PS window visible and potentially the UAC prompt
|
775
|
-
creation_flags = win32con.CREATE_NEW_CONSOLE
|
776
|
-
|
777
|
-
# Command to run PowerShell, which then elevates the target executable
|
772
|
+
# Prepare paths and arguments, escaping for PowerShell strings
|
778
773
|
target_exe_unquoted = self.target_executable_path.strip('"')
|
779
|
-
target_exe_for_ps = target_exe_unquoted.replace("'", "''")
|
774
|
+
target_exe_for_ps = target_exe_unquoted.replace("'", "''")
|
780
775
|
target_exe_dir_for_ps = os.path.dirname(target_exe_unquoted).replace("'", "''")
|
781
|
-
|
782
|
-
# 1. 准备 PowerShell 命令中需要的变量 (进行基本的 PowerShell 字符串转义)
|
783
|
-
ps_target_exe = target_exe_for_ps
|
784
|
-
ps_working_dir = target_exe_dir_for_ps
|
785
|
-
# 用户名 'altair' 在最终命令里需要 ''altair'' 格式
|
786
|
-
ps_user_arg_format = user.replace("'", "''") # 先转义用户名本身的单引号
|
787
|
-
|
788
|
-
# 2. 构建最终的、完整的 PowerShell 命令字符串,严格按照模板
|
789
|
-
# 模板: Start-Process -FilePath cmd.exe -ArgumentList @('/K', '"<exe_path>" --port <port> --target_user ''<username>''') -WorkingDirectory '<working_dir>' -Verb RunAs
|
790
|
-
ps_command_string = f"Start-Process -FilePath cmd.exe -ArgumentList @('/K', '"""{ps_target_exe}""" --port {calculated_port} --target_user ''''{ps_user_arg_format}''''') -WorkingDirectory '{ps_working_dir}' -Verb RunAs"
|
791
|
-
|
792
|
-
# 3. 为 powershell.exe -Command '...' 参数转义整个命令字符串中的单引号
|
793
|
-
ps_command_string_escaped = ps_command_string.replace("'", "''")
|
794
|
-
|
795
|
-
# 4. 生成最终传递给 CreateProcessAsUser 的命令行
|
796
|
-
# 依然使用 powershell.exe -NoExit -Command '{ ... }' 以便观察,虽然不一定有效
|
797
|
-
lpCommandLine = f"powershell.exe -NoProfile -ExecutionPolicy Bypass -NoExit -Command '{{ {ps_command_string_escaped} }}'"
|
798
|
-
|
799
|
-
lpApplicationName = None # Must be None if using lpCommandLine
|
800
|
-
cwd = os.path.dirname(target_exe_unquoted) if os.path.dirname(target_exe_unquoted) else None
|
801
776
|
|
802
|
-
#
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
777
|
+
# Build the exact Start-Process command string based on the working template as a single line
|
778
|
+
# Need to escape quotes carefully for the final -Command '...' argument
|
779
|
+
# 1. Build the second argument for the @() array element
|
780
|
+
cmd_k_second_arg = f'"\\"{target_exe_for_ps}\\"" --port {calculated_port} --target_user \'\'{user}\'\''
|
781
|
+
# 2. Escape single quotes within it for the PS literal array element
|
782
|
+
cmd_k_second_arg_escaped_for_array = cmd_k_second_arg.replace("'", "''")
|
783
|
+
# 3. Build the full script block content as a single line string
|
784
|
+
ps_script_block_content = f"$cmdArgs = @('/K', '{cmd_k_second_arg_escaped_for_array}'); Start-Process -FilePath cmd.exe -ArgumentList $cmdArgs -WorkingDirectory '{target_exe_dir_for_ps}' -Verb RunAs"
|
785
|
+
# 4. Escape single quotes in the whole script block for the outer -Command '...'
|
786
|
+
ps_script_block_content_escaped = ps_script_block_content.replace("'", "''")
|
787
|
+
|
788
|
+
# Command list for subprocess
|
789
|
+
powershell_executable = "powershell.exe"
|
790
|
+
command_list = [
|
791
|
+
powershell_executable,
|
792
|
+
"-NoProfile",
|
793
|
+
"-ExecutionPolicy", "Bypass",
|
794
|
+
"-Command",
|
795
|
+
f"{{ {ps_script_block_content_escaped} }}" # Use script block {}
|
796
|
+
]
|
797
|
+
|
798
|
+
self.log_info(f"Internal trigger: Executing subprocess: {command_list}")
|
799
|
+
|
800
|
+
# Execute the command directly from the service context
|
801
|
+
result = subprocess.run(
|
802
|
+
command_list,
|
803
|
+
capture_output=True,
|
804
|
+
text=True,
|
805
|
+
check=False, # Don't raise exception on non-zero exit
|
806
|
+
encoding='utf-8',
|
807
|
+
errors='ignore'
|
810
808
|
)
|
811
|
-
|
812
|
-
#
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
809
|
+
|
810
|
+
# Log results
|
811
|
+
if result.stdout:
|
812
|
+
self.log_info(f"Internal trigger: PowerShell STDOUT:\\n{result.stdout.strip()}")
|
813
|
+
if result.stderr:
|
814
|
+
self.log_warning(f"Internal trigger: PowerShell STDERR:\\n{result.stderr.strip()}")
|
815
|
+
|
816
|
+
if result.returncode == 0:
|
817
|
+
self.log_info("Internal trigger: PowerShell subprocess command executed successfully (Exit Code 0). Process likely started elevated in background.")
|
818
|
+
immediate_start_status = "start_success_direct_subprocess"
|
819
|
+
final_status = "success_direct_subprocess"
|
820
|
+
else:
|
821
|
+
self.log_error(f"Internal trigger: PowerShell subprocess command failed (Exit Code {result.returncode}).")
|
822
|
+
immediate_start_status = f"start_failed_direct_subprocess_code_{result.returncode}"
|
823
|
+
final_status = f"failed_direct_subprocess_code_{result.returncode}"
|
824
|
+
|
825
|
+
except FileNotFoundError:
|
826
|
+
self.log_error("Internal trigger: 'powershell.exe' not found.")
|
827
|
+
immediate_start_status = "start_failed_ps_not_found"
|
828
|
+
final_status = "failed_ps_not_found"
|
829
|
+
except Exception as subproc_err:
|
830
|
+
self.log_error(f"Internal trigger: Exception during PowerShell subprocess execution for user '{user}': {subproc_err}", exc_info=True)
|
831
|
+
immediate_start_status = "start_failed_subprocess_exception"
|
832
|
+
final_status = "failed_subprocess_exception"
|
833
|
+
|
829
834
|
# Combine results (mostly determined by start attempt now)
|
830
835
|
# Example: final_status = f"{task_created_status}_{immediate_start_status}"
|
831
836
|
return final_status
|
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
|
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
|
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
|