MCPcopy Create free account
hub / github.com/echQoQ/RustSL / WorkerThread

Class WorkerThread

gui/worker.py:20–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20class WorkerThread(QThread):
21 log_signal = pyqtSignal(str)
22 progress_signal = pyqtSignal(int)
23 done_signal = pyqtSignal(str)
24 error_signal = pyqtSignal(str)
25
26 def __init__(self, parent, params):
27 super().__init__(parent)
28 self.params = params
29
30 def run(self):
31 try:
32 self._encrypt_payload()
33 self._build_rust_project()
34 output_file = self._copy_output()
35 if self.params['sign_enable']:
36 self._sign_executable(output_file)
37 self.progress_signal.emit(100)
38 self.log_signal.emit('All done!')
39 self.done_signal.emit(output_file)
40 except Exception as e:
41 self.error_signal.emit(str(e))
42
43 def _encrypt_payload(self):
44 self.progress_signal.emit(0)
45 self.log_signal.emit('Encrypting...')
46 self.progress_signal.emit(10)
47
48 enc_map = get_encryption_map()
49 enc_method_arg = enc_map.get(
50 self.params['enc_method'],
51 self.params['enc_method']
52 )
53
54 enc_cmd = [
55 sys.executable, 'encrypt.py',
56 '-i', self.params['input_bin'],
57 '-o', 'output/encrypt.bin',
58 '-m', enc_method_arg,
59 '-e', self.params.get('encode_method', 'base64')
60 ]
61
62 result = subprocess.run(enc_cmd, capture_output=True, text=True, encoding='utf-8', errors='ignore', check=True)
63 self.log_signal.emit(result.stdout)
64 if result.stderr:
65 self.log_signal.emit(result.stderr)
66
67 self.progress_signal.emit(40)
68
69 def _build_rust_project(self):
70 self.log_signal.emit('Building Rust project...')
71
72 self.target = self.params.get('target', 'x86_64-pc-windows-msvc')
73
74 features = self._build_features_list()
75 features_str = ','.join(features)
76
77 self.log_signal.emit(f'Features enabled for this build: {features_str}')

Callers 1

run_allMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected