saql4l 1.0.5__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.
- saql4l/__init__.py +1 -0
- saql4l/pointer.py +987 -0
- saql4l-1.0.5.dist-info/METADATA +17 -0
- saql4l-1.0.5.dist-info/RECORD +6 -0
- saql4l-1.0.5.dist-info/WHEEL +4 -0
- saql4l-1.0.5.dist-info/entry_points.txt +2 -0
saql4l/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
saql4l/pointer.py
ADDED
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import subprocess
|
|
4
|
+
import re
|
|
5
|
+
import html
|
|
6
|
+
import tkinter as tk
|
|
7
|
+
import pyperclip
|
|
8
|
+
import threading
|
|
9
|
+
import keyboard
|
|
10
|
+
import requests
|
|
11
|
+
import base64
|
|
12
|
+
from io import BytesIO
|
|
13
|
+
from PIL import ImageGrab
|
|
14
|
+
import pyautogui
|
|
15
|
+
import time
|
|
16
|
+
import random
|
|
17
|
+
import mss
|
|
18
|
+
from PIL import Image
|
|
19
|
+
import uiautomation as auto
|
|
20
|
+
import pythoncom
|
|
21
|
+
|
|
22
|
+
import ctypes
|
|
23
|
+
from ctypes import wintypes, POINTER, c_void_p, byref
|
|
24
|
+
import comtypes.client
|
|
25
|
+
|
|
26
|
+
comtypes.client.GetModule('oleacc.dll')
|
|
27
|
+
|
|
28
|
+
IID_IServiceProvider = comtypes.GUID("{6D5140C1-7436-11CE-8034-00AA006009FA}")
|
|
29
|
+
IID_IAccessible2 = comtypes.GUID("{E89F726E-C4F4-4C19-BB19-B647D7FA8478}")
|
|
30
|
+
|
|
31
|
+
oleacc = ctypes.windll.oleacc
|
|
32
|
+
|
|
33
|
+
VERCEL_API_URL = 'https://meraaaiisseehhapi-erserver.vercel.app/api'
|
|
34
|
+
|
|
35
|
+
session = requests.Session()
|
|
36
|
+
|
|
37
|
+
class IQPointer:
|
|
38
|
+
def __init__(self):
|
|
39
|
+
|
|
40
|
+
self.hidden_master = tk.Tk()
|
|
41
|
+
|
|
42
|
+
self.hidden_master.title("")
|
|
43
|
+
self.hidden_master.withdraw()
|
|
44
|
+
|
|
45
|
+
self.root = tk.Toplevel(self.hidden_master)
|
|
46
|
+
|
|
47
|
+
self.root.title("")
|
|
48
|
+
|
|
49
|
+
self.root.attributes('-topmost', True)
|
|
50
|
+
self.root.overrideredirect(True)
|
|
51
|
+
self.root.attributes('-transparentcolor', 'white')
|
|
52
|
+
self.root.config(bg='white')
|
|
53
|
+
|
|
54
|
+
self.label = tk.Label(self.root, text=".", font=('Consolas', 8, 'bold'),
|
|
55
|
+
fg='#d3d3d3', bg='white', wraplength=350, justify="left")
|
|
56
|
+
self.label.pack()
|
|
57
|
+
|
|
58
|
+
self.code_window = tk.Toplevel(self.root)
|
|
59
|
+
self.code_window.attributes('-topmost', True)
|
|
60
|
+
self.code_window.overrideredirect(True)
|
|
61
|
+
|
|
62
|
+
self.code_window.attributes('-transparentcolor', 'white')
|
|
63
|
+
|
|
64
|
+
self.code_window.attributes('-alpha', 0.75)
|
|
65
|
+
self.code_window.withdraw()
|
|
66
|
+
|
|
67
|
+
self.code_text = tk.Text(self.code_window, font=('Consolas', 8, 'bold'), bg='white', fg='#d3d3d3',
|
|
68
|
+
width=55, height=20, relief='flat', highlightthickness=0,
|
|
69
|
+
insertbackground='white')
|
|
70
|
+
self.code_text.pack()
|
|
71
|
+
self.is_code_visible = False
|
|
72
|
+
|
|
73
|
+
self.last_text = pyperclip.paste()
|
|
74
|
+
self.is_hidden = False
|
|
75
|
+
self.is_processing = False
|
|
76
|
+
|
|
77
|
+
self.snip_step = 0
|
|
78
|
+
self.snip_step_deep = 0
|
|
79
|
+
self.snip_step_ia2 = 0
|
|
80
|
+
self.snip_step_image = 0
|
|
81
|
+
self.snip_x1 = 0
|
|
82
|
+
self.snip_y1 = 0
|
|
83
|
+
|
|
84
|
+
self.is_typing = False
|
|
85
|
+
self.is_paused = False
|
|
86
|
+
self.text_to_type = ""
|
|
87
|
+
self.type_index = 0
|
|
88
|
+
|
|
89
|
+
self.mash_text = ""
|
|
90
|
+
self.mash_index = 0
|
|
91
|
+
self.mash_hook = None
|
|
92
|
+
|
|
93
|
+
self.is_merge_mode = False
|
|
94
|
+
self.merge_buffer = ""
|
|
95
|
+
|
|
96
|
+
keyboard.add_hotkey('1+c', self.trigger_api)
|
|
97
|
+
keyboard.add_hotkey('caps lock', self.stealth_hide)
|
|
98
|
+
keyboard.add_hotkey('1+`', self.stealth_show)
|
|
99
|
+
keyboard.add_hotkey('9+q', self.panic_exit)
|
|
100
|
+
keyboard.add_hotkey('7+z', self.self_destruct)
|
|
101
|
+
keyboard.add_hotkey('1+v', self.auto_hide)
|
|
102
|
+
keyboard.add_hotkey('1+s', self.screen_read_trigger)
|
|
103
|
+
keyboard.add_hotkey('1+e', self.region_screen_trigger)
|
|
104
|
+
keyboard.add_hotkey('1+r', self.retry_api)
|
|
105
|
+
keyboard.add_hotkey('a+v', self.force_paste)
|
|
106
|
+
keyboard.add_hotkey('a+x', self.toggle_code_view)
|
|
107
|
+
|
|
108
|
+
keyboard.add_hotkey('a+up', self.scroll_up)
|
|
109
|
+
keyboard.add_hotkey('a+down', self.scroll_down)
|
|
110
|
+
keyboard.add_hotkey('f10', self.extract_text_by_area)
|
|
111
|
+
keyboard.add_hotkey('1+w', self.extract_text_by_area_deep)
|
|
112
|
+
|
|
113
|
+
keyboard.add_hotkey('1+q', self.extract_text_by_area_ia2)
|
|
114
|
+
keyboard.add_hotkey('a+c', self.toggle_merge_mode)
|
|
115
|
+
|
|
116
|
+
keyboard.add_hotkey('a+m', self.start_mash_mode)
|
|
117
|
+
|
|
118
|
+
self.current_mode = "dsa"
|
|
119
|
+
|
|
120
|
+
keyboard.add_hotkey('a+1', lambda: self.change_mode("aptitude"))
|
|
121
|
+
keyboard.add_hotkey('a+2', lambda: self.change_mode("dsa"))
|
|
122
|
+
keyboard.add_hotkey('a+3', lambda: self.change_mode("fullstack"))
|
|
123
|
+
keyboard.add_hotkey('a+4', lambda: self.change_mode("aws"))
|
|
124
|
+
keyboard.add_hotkey('a+5', lambda: self.change_mode("ocr"))
|
|
125
|
+
|
|
126
|
+
self.update_ui()
|
|
127
|
+
self.monitor_loop()
|
|
128
|
+
self.root.mainloop()
|
|
129
|
+
|
|
130
|
+
def change_mode(self, mode):
|
|
131
|
+
self.current_mode = mode
|
|
132
|
+
if mode == "aptitude":
|
|
133
|
+
self.label.config(fg="#d3d3d3", text="ap")
|
|
134
|
+
elif mode == "dsa":
|
|
135
|
+
self.label.config(fg="#d3d3d3", text="dsa")
|
|
136
|
+
elif mode == "fullstack":
|
|
137
|
+
self.label.config(fg="#d3d3d3", text="fu")
|
|
138
|
+
elif mode == "aws":
|
|
139
|
+
self.label.config(fg="#d3d3d3", text="aw")
|
|
140
|
+
elif mode == "ocr":
|
|
141
|
+
self.label.config(fg="#d3d3d3", text="cp")
|
|
142
|
+
|
|
143
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
144
|
+
|
|
145
|
+
def retry_api(self):
|
|
146
|
+
"""Manually trigger last copied text again"""
|
|
147
|
+
if self.is_hidden or self.is_processing:
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
if self.is_typing or getattr(self, 'mash_hook', None):
|
|
151
|
+
return
|
|
152
|
+
|
|
153
|
+
current_text = pyperclip.paste()
|
|
154
|
+
if len(current_text.strip()) > 5:
|
|
155
|
+
self.is_processing = True
|
|
156
|
+
self.label.config(text="re..")
|
|
157
|
+
|
|
158
|
+
threading.Thread(target=self.get_ai_answer, args=(current_text,), daemon=True).start()
|
|
159
|
+
|
|
160
|
+
def extract_text_by_area(self):
|
|
161
|
+
if self.is_hidden or self.is_processing:
|
|
162
|
+
return
|
|
163
|
+
|
|
164
|
+
if self.snip_step == 0:
|
|
165
|
+
|
|
166
|
+
self.snip_x1, self.snip_y1 = pyautogui.position()
|
|
167
|
+
self.snip_step = 1
|
|
168
|
+
self.label.config(text="..")
|
|
169
|
+
else:
|
|
170
|
+
|
|
171
|
+
x2, y2 = pyautogui.position()
|
|
172
|
+
self.snip_step = 0
|
|
173
|
+
self.label.config(text="..")
|
|
174
|
+
|
|
175
|
+
left = min(self.snip_x1, x2)
|
|
176
|
+
right = max(self.snip_x1, x2)
|
|
177
|
+
top = min(self.snip_y1, y2)
|
|
178
|
+
bottom = max(self.snip_y1, y2)
|
|
179
|
+
|
|
180
|
+
threading.Thread(target=self.process_area_extraction, args=(left, right, top, bottom), daemon=True).start()
|
|
181
|
+
|
|
182
|
+
def process_area_extraction(self, left, right, top, bottom):
|
|
183
|
+
try:
|
|
184
|
+
pythoncom.CoInitialize()
|
|
185
|
+
self.is_processing = True
|
|
186
|
+
|
|
187
|
+
main_app = auto.ControlFromPoint(int(left), int(top)).GetTopLevelControl()
|
|
188
|
+
|
|
189
|
+
full_text = ""
|
|
190
|
+
|
|
191
|
+
for item, depth in auto.WalkControl(main_app, maxDepth=8):
|
|
192
|
+
try:
|
|
193
|
+
rect = item.BoundingRectangle
|
|
194
|
+
|
|
195
|
+
cx = (rect.left + rect.right) / 2
|
|
196
|
+
cy = (rect.top + rect.bottom) / 2
|
|
197
|
+
|
|
198
|
+
if left <= cx <= right and top <= cy <= bottom:
|
|
199
|
+
text = ""
|
|
200
|
+
|
|
201
|
+
try:
|
|
202
|
+
|
|
203
|
+
if item.ControlType == auto.ControlType.EditControl:
|
|
204
|
+
text = item.GetValuePattern().Value
|
|
205
|
+
except:
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
if not text:
|
|
209
|
+
text = item.Name
|
|
210
|
+
|
|
211
|
+
if text and text.strip() and len(text.strip()) > 1 and text.strip() not in full_text:
|
|
212
|
+
full_text += text.strip() + "\n"
|
|
213
|
+
except:
|
|
214
|
+
pass
|
|
215
|
+
|
|
216
|
+
if full_text and len(full_text.strip()) > 3:
|
|
217
|
+
clean_text = full_text.strip()[:3500]
|
|
218
|
+
|
|
219
|
+
pyperclip.copy(clean_text)
|
|
220
|
+
self.last_text = clean_text
|
|
221
|
+
|
|
222
|
+
self.label.config(text="c-ok")
|
|
223
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
224
|
+
else:
|
|
225
|
+
self.label.config(text="no-txt")
|
|
226
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
227
|
+
|
|
228
|
+
except Exception as e:
|
|
229
|
+
self.label.config(text="ex-err")
|
|
230
|
+
finally:
|
|
231
|
+
self.is_processing = False
|
|
232
|
+
pythoncom.CoUninitialize()
|
|
233
|
+
|
|
234
|
+
def extract_text_by_area_deep(self):
|
|
235
|
+
if self.is_hidden or self.is_processing:
|
|
236
|
+
return
|
|
237
|
+
|
|
238
|
+
if self.snip_step_deep == 0:
|
|
239
|
+
|
|
240
|
+
self.snip_x1, self.snip_y1 = pyautogui.position()
|
|
241
|
+
self.snip_step_deep = 1
|
|
242
|
+
self.label.config(text="..")
|
|
243
|
+
else:
|
|
244
|
+
|
|
245
|
+
x2, y2 = pyautogui.position()
|
|
246
|
+
self.snip_step_deep = 0
|
|
247
|
+
self.label.config(text="..")
|
|
248
|
+
|
|
249
|
+
left = min(self.snip_x1, x2)
|
|
250
|
+
right = max(self.snip_x1, x2)
|
|
251
|
+
top = min(self.snip_y1, y2)
|
|
252
|
+
bottom = max(self.snip_y1, y2)
|
|
253
|
+
|
|
254
|
+
threading.Thread(target=self.process_deep_area_extraction, args=(left, right, top, bottom), daemon=True).start()
|
|
255
|
+
|
|
256
|
+
def process_deep_area_extraction(self, left, right, top, bottom):
|
|
257
|
+
try:
|
|
258
|
+
pythoncom.CoInitialize()
|
|
259
|
+
self.is_processing = True
|
|
260
|
+
full_text = ""
|
|
261
|
+
|
|
262
|
+
main_window = auto.ControlFromPoint(int(left), int(top)).GetTopLevelControl()
|
|
263
|
+
|
|
264
|
+
for item, depth in auto.WalkControl(main_window, maxDepth=12):
|
|
265
|
+
try:
|
|
266
|
+
|
|
267
|
+
rect = item.BoundingRectangle
|
|
268
|
+
if not rect:
|
|
269
|
+
continue
|
|
270
|
+
|
|
271
|
+
cx = (rect.left + rect.right) / 2
|
|
272
|
+
cy = (rect.top + rect.bottom) / 2
|
|
273
|
+
|
|
274
|
+
if (left - 10) <= cx <= (right + 10) and (top - 10) <= cy <= (bottom + 10):
|
|
275
|
+
text = ""
|
|
276
|
+
|
|
277
|
+
try:
|
|
278
|
+
text = item.GetTextPattern().DocumentRange.GetText(-1)
|
|
279
|
+
except:
|
|
280
|
+
pass
|
|
281
|
+
|
|
282
|
+
if not text:
|
|
283
|
+
try: text = item.Name
|
|
284
|
+
except: pass
|
|
285
|
+
|
|
286
|
+
if not text:
|
|
287
|
+
try:
|
|
288
|
+
text = item.GetLegacyIAccessiblePattern().Value
|
|
289
|
+
except: pass
|
|
290
|
+
|
|
291
|
+
if text and text.strip() and len(text.strip()) > 1:
|
|
292
|
+
clean_text = text.strip()
|
|
293
|
+
if clean_text not in full_text:
|
|
294
|
+
full_text += clean_text + "\n"
|
|
295
|
+
|
|
296
|
+
except Exception as inner_e:
|
|
297
|
+
pass
|
|
298
|
+
|
|
299
|
+
if full_text and len(full_text.strip()) > 3:
|
|
300
|
+
clean_text = full_text.strip()[:3500]
|
|
301
|
+
|
|
302
|
+
if self.is_merge_mode:
|
|
303
|
+
if not self.merge_buffer:
|
|
304
|
+
|
|
305
|
+
self.merge_buffer = clean_text + "\n"
|
|
306
|
+
self.root.after(0, lambda: self.label.config(text="1/2"))
|
|
307
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
308
|
+
else:
|
|
309
|
+
|
|
310
|
+
final_text = self.merge_buffer + clean_text
|
|
311
|
+
pyperclip.copy(final_text)
|
|
312
|
+
self.last_text = final_text
|
|
313
|
+
|
|
314
|
+
self.is_merge_mode = False
|
|
315
|
+
self.merge_buffer = ""
|
|
316
|
+
|
|
317
|
+
self.root.after(0, lambda: self.label.config(text="2/2"))
|
|
318
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
319
|
+
else:
|
|
320
|
+
|
|
321
|
+
pyperclip.copy(clean_text)
|
|
322
|
+
self.last_text = clean_text
|
|
323
|
+
self.root.after(0, lambda: self.label.config(text="cp"))
|
|
324
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
325
|
+
else:
|
|
326
|
+
self.root.after(0, lambda: self.label.config(text="n-txt"))
|
|
327
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
328
|
+
|
|
329
|
+
except Exception as e:
|
|
330
|
+
self.root.after(0, lambda: self.label.config(text="ex-err"))
|
|
331
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
332
|
+
finally:
|
|
333
|
+
self.is_processing = False
|
|
334
|
+
pythoncom.CoUninitialize()
|
|
335
|
+
|
|
336
|
+
def extract_text_by_area_ia2(self):
|
|
337
|
+
if self.is_hidden or self.is_processing:
|
|
338
|
+
return
|
|
339
|
+
|
|
340
|
+
if self.snip_step_ia2 == 0:
|
|
341
|
+
|
|
342
|
+
self.snip_x1, self.snip_y1 = pyautogui.position()
|
|
343
|
+
self.snip_step_ia2 = 1
|
|
344
|
+
self.label.config(text="..")
|
|
345
|
+
else:
|
|
346
|
+
|
|
347
|
+
x2, y2 = pyautogui.position()
|
|
348
|
+
self.snip_step_ia2 = 0
|
|
349
|
+
self.label.config(text="..")
|
|
350
|
+
|
|
351
|
+
left = min(self.snip_x1, x2)
|
|
352
|
+
right = max(self.snip_x1, x2)
|
|
353
|
+
top = min(self.snip_y1, y2)
|
|
354
|
+
bottom = max(self.snip_y1, y2)
|
|
355
|
+
|
|
356
|
+
threading.Thread(target=self.process_ia2_area_extraction, args=(left, right, top, bottom), daemon=True).start()
|
|
357
|
+
|
|
358
|
+
def process_ia2_area_extraction(self, left, right, top, bottom):
|
|
359
|
+
try:
|
|
360
|
+
pythoncom.CoInitialize()
|
|
361
|
+
self.is_processing = True
|
|
362
|
+
full_text = ""
|
|
363
|
+
|
|
364
|
+
main_window = auto.ControlFromPoint(int(left), int(top)).GetTopLevelControl()
|
|
365
|
+
|
|
366
|
+
blacklist_words = ["file://", ".html"]
|
|
367
|
+
|
|
368
|
+
for item, depth in auto.WalkControl(main_window, maxDepth=14):
|
|
369
|
+
try:
|
|
370
|
+
rect = item.BoundingRectangle
|
|
371
|
+
if not rect:
|
|
372
|
+
continue
|
|
373
|
+
|
|
374
|
+
cx = (rect.left + rect.right) / 2
|
|
375
|
+
cy = (rect.top + rect.bottom) / 2
|
|
376
|
+
|
|
377
|
+
if left <= cx <= right and top <= cy <= bottom:
|
|
378
|
+
text = ""
|
|
379
|
+
|
|
380
|
+
try:
|
|
381
|
+
legacy = item.GetLegacyIAccessiblePattern()
|
|
382
|
+
if legacy:
|
|
383
|
+
text = legacy.Value
|
|
384
|
+
if not text:
|
|
385
|
+
text = legacy.Name
|
|
386
|
+
except:
|
|
387
|
+
pass
|
|
388
|
+
|
|
389
|
+
if not text:
|
|
390
|
+
try:
|
|
391
|
+
if item.ControlType in [auto.ControlType.EditControl, auto.ControlType.TextControl, auto.ControlType.DocumentControl]:
|
|
392
|
+
text = item.GetValuePattern().Value
|
|
393
|
+
except: pass
|
|
394
|
+
|
|
395
|
+
if not text:
|
|
396
|
+
try: text = item.Name
|
|
397
|
+
except: pass
|
|
398
|
+
|
|
399
|
+
if text and text.strip() and len(text.strip()) > 1:
|
|
400
|
+
clean_text_line = text.strip()
|
|
401
|
+
|
|
402
|
+
if any(bad_word.lower() in clean_text_line.lower() for bad_word in blacklist_words):
|
|
403
|
+
continue
|
|
404
|
+
|
|
405
|
+
if clean_text_line not in full_text:
|
|
406
|
+
full_text += clean_text_line + "\n"
|
|
407
|
+
|
|
408
|
+
except Exception as inner_e:
|
|
409
|
+
pass
|
|
410
|
+
|
|
411
|
+
if full_text and len(full_text.strip()) > 3:
|
|
412
|
+
clean_text = full_text.strip()[:3500]
|
|
413
|
+
|
|
414
|
+
if self.is_merge_mode:
|
|
415
|
+
if not self.merge_buffer:
|
|
416
|
+
|
|
417
|
+
self.merge_buffer = clean_text + "\n"
|
|
418
|
+
self.root.after(0, lambda: self.label.config(text="1/2"))
|
|
419
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
420
|
+
else:
|
|
421
|
+
|
|
422
|
+
final_text = self.merge_buffer + clean_text
|
|
423
|
+
pyperclip.copy(final_text)
|
|
424
|
+
self.last_text = final_text
|
|
425
|
+
|
|
426
|
+
self.is_merge_mode = False
|
|
427
|
+
self.merge_buffer = ""
|
|
428
|
+
|
|
429
|
+
self.root.after(0, lambda: self.label.config(text="2/2"))
|
|
430
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
431
|
+
else:
|
|
432
|
+
|
|
433
|
+
pyperclip.copy(clean_text)
|
|
434
|
+
self.last_text = clean_text
|
|
435
|
+
self.root.after(0, lambda: self.label.config(text="cp"))
|
|
436
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
437
|
+
else:
|
|
438
|
+
self.root.after(0, lambda: self.label.config(text="n-txt"))
|
|
439
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
440
|
+
|
|
441
|
+
except Exception as e:
|
|
442
|
+
self.root.after(0, lambda: self.label.config(text="ex-err"))
|
|
443
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
444
|
+
finally:
|
|
445
|
+
self.is_processing = False
|
|
446
|
+
pythoncom.CoUninitialize()
|
|
447
|
+
|
|
448
|
+
def encode_and_send_screenshot(self, screenshot, *, region=False):
|
|
449
|
+
"""Prepare a screenshot once and submit it to the vision endpoint."""
|
|
450
|
+
|
|
451
|
+
max_side = 1800 if region else 2200
|
|
452
|
+
if max(screenshot.size) > max_side:
|
|
453
|
+
scale = max_side / max(screenshot.size)
|
|
454
|
+
screenshot = screenshot.resize(
|
|
455
|
+
(max(1, round(screenshot.width * scale)), max(1, round(screenshot.height * scale))),
|
|
456
|
+
Image.Resampling.LANCZOS
|
|
457
|
+
)
|
|
458
|
+
buffered = BytesIO()
|
|
459
|
+
screenshot.save(buffered, format="JPEG", quality=85)
|
|
460
|
+
img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
|
|
461
|
+
threading.Thread(target=self.get_ai_vision_answer, args=(img_str,), daemon=True).start()
|
|
462
|
+
|
|
463
|
+
def region_screen_trigger(self):
|
|
464
|
+
"""Press twice to capture only the question/options between two corners."""
|
|
465
|
+
if self.is_hidden or self.is_processing:
|
|
466
|
+
return
|
|
467
|
+
if self.snip_step_image == 0:
|
|
468
|
+
self.snip_x1, self.snip_y1 = pyautogui.position()
|
|
469
|
+
self.snip_step_image = 1
|
|
470
|
+
self.label.config(text="im-1")
|
|
471
|
+
return
|
|
472
|
+
|
|
473
|
+
x2, y2 = pyautogui.position()
|
|
474
|
+
self.snip_step_image = 0
|
|
475
|
+
left, right = sorted((int(self.snip_x1), int(x2)))
|
|
476
|
+
top, bottom = sorted((int(self.snip_y1), int(y2)))
|
|
477
|
+
if right - left < 20 or bottom - top < 20:
|
|
478
|
+
self.label.config(text="im-er")
|
|
479
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
480
|
+
return
|
|
481
|
+
self.is_processing = True
|
|
482
|
+
self.label.config(text="Sc")
|
|
483
|
+
threading.Thread(
|
|
484
|
+
target=self.process_region_screenshot,
|
|
485
|
+
args=(left, top, right, bottom),
|
|
486
|
+
daemon=True
|
|
487
|
+
).start()
|
|
488
|
+
|
|
489
|
+
def process_region_screenshot(self, left, top, right, bottom):
|
|
490
|
+
try:
|
|
491
|
+
screenshot = None
|
|
492
|
+
|
|
493
|
+
pad = 24
|
|
494
|
+
left -= pad
|
|
495
|
+
top -= pad
|
|
496
|
+
right += pad
|
|
497
|
+
bottom += pad
|
|
498
|
+
try:
|
|
499
|
+
|
|
500
|
+
screenshot = pyautogui.screenshot(region=(left, top, right - left, bottom - top))
|
|
501
|
+
except Exception:
|
|
502
|
+
pass
|
|
503
|
+
if screenshot is None:
|
|
504
|
+
try:
|
|
505
|
+
screenshot = ImageGrab.grab(bbox=(left, top, right, bottom), all_screens=True)
|
|
506
|
+
except Exception:
|
|
507
|
+
with mss.MSS() as sct:
|
|
508
|
+
region = {'left': left, 'top': top, 'width': right - left, 'height': bottom - top}
|
|
509
|
+
sct_img = sct.grab(region)
|
|
510
|
+
screenshot = Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX")
|
|
511
|
+
self.encode_and_send_screenshot(screenshot, region=True)
|
|
512
|
+
except Exception:
|
|
513
|
+
self.root.after(0, lambda: self.label.config(text="sc-er"))
|
|
514
|
+
self.is_processing = False
|
|
515
|
+
|
|
516
|
+
def screen_read_trigger(self):
|
|
517
|
+
"""Screenshot scan logic with Anti-Spam Lock"""
|
|
518
|
+
if self.is_processing:
|
|
519
|
+
return
|
|
520
|
+
try:
|
|
521
|
+
self.is_processing = True
|
|
522
|
+
self.label.config(text="Sc")
|
|
523
|
+
|
|
524
|
+
screenshot = None
|
|
525
|
+
|
|
526
|
+
try:
|
|
527
|
+
with mss.MSS() as sct:
|
|
528
|
+
x, y = pyautogui.position()
|
|
529
|
+
monitor = next((item for item in sct.monitors[1:]
|
|
530
|
+
if item['left'] <= x < item['left'] + item['width']
|
|
531
|
+
and item['top'] <= y < item['top'] + item['height']), sct.monitors[1])
|
|
532
|
+
sct_img = sct.grab(monitor)
|
|
533
|
+
screenshot = Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX")
|
|
534
|
+
except: pass
|
|
535
|
+
|
|
536
|
+
if screenshot is None:
|
|
537
|
+
screenshot = ImageGrab.grab()
|
|
538
|
+
|
|
539
|
+
if screenshot:
|
|
540
|
+
self.encode_and_send_screenshot(screenshot)
|
|
541
|
+
|
|
542
|
+
else:
|
|
543
|
+
self.label.config(text="er-img")
|
|
544
|
+
self.is_processing = False
|
|
545
|
+
|
|
546
|
+
except Exception as e:
|
|
547
|
+
self.label.config(text="sc-er")
|
|
548
|
+
self.is_processing = False
|
|
549
|
+
|
|
550
|
+
def show_api_error(self, response):
|
|
551
|
+
status = getattr(response, 'status_code', 0)
|
|
552
|
+
label = f"H-{status}" if status else "sr-er"
|
|
553
|
+
self.root.after(0, lambda: self.label.config(text=label))
|
|
554
|
+
|
|
555
|
+
def is_compact_answer(self, answer):
|
|
556
|
+
if len(answer) <= 15:
|
|
557
|
+
return True
|
|
558
|
+
lines = answer.strip().splitlines()
|
|
559
|
+
if len(answer) <= 400 and len(lines) <= 12 and all(
|
|
560
|
+
re.fullmatch(r'\s*\d+\s*->\s*(?:\d+(?:,\d+)*|UNKNOWN)\s*', line)
|
|
561
|
+
for line in lines
|
|
562
|
+
):
|
|
563
|
+
return True
|
|
564
|
+
return self.current_mode == 'aptitude' and len(answer) <= 200 and len(lines) <= 8
|
|
565
|
+
|
|
566
|
+
def get_ai_vision_answer(self, img_data):
|
|
567
|
+
try:
|
|
568
|
+
response = session.post(VERCEL_API_URL, json={'image': img_data, 'mode': self.current_mode}, timeout=60)
|
|
569
|
+
if response.status_code == 200:
|
|
570
|
+
answer = html.unescape(response.json().get('answer', '')).replace('\xa0', ' ')
|
|
571
|
+
if answer:
|
|
572
|
+
|
|
573
|
+
if "Please provide" in answer or "I cannot" in answer or "does not contain" in answer or "BLANK_DATA" in answer:
|
|
574
|
+
answer = "sc-er"
|
|
575
|
+
|
|
576
|
+
pyperclip.copy(answer)
|
|
577
|
+
self.last_text = answer
|
|
578
|
+
|
|
579
|
+
if not self.is_compact_answer(answer):
|
|
580
|
+
self.root.after(0, lambda: self.label.config(text="P"))
|
|
581
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
582
|
+
else:
|
|
583
|
+
self.root.after(0, lambda: self.label.config(text=answer))
|
|
584
|
+
|
|
585
|
+
else:
|
|
586
|
+
self.root.after(0, lambda: self.label.config(text="EMPTY"))
|
|
587
|
+
else:
|
|
588
|
+
self.show_api_error(response)
|
|
589
|
+
except requests.Timeout:
|
|
590
|
+
self.root.after(0, lambda: self.label.config(text="TIMEOUT"))
|
|
591
|
+
except requests.RequestException:
|
|
592
|
+
self.root.after(0, lambda: self.label.config(text="NET-ER"))
|
|
593
|
+
except Exception:
|
|
594
|
+
self.root.after(0, lambda: self.label.config(text="SC-ER"))
|
|
595
|
+
finally:
|
|
596
|
+
self.is_processing = False
|
|
597
|
+
|
|
598
|
+
def trigger_api(self):
|
|
599
|
+
if self.is_hidden: return
|
|
600
|
+
self.root.after(500, self.process_request)
|
|
601
|
+
|
|
602
|
+
def monitor_loop(self):
|
|
603
|
+
self.process_request()
|
|
604
|
+
self.root.after(300, self.monitor_loop)
|
|
605
|
+
|
|
606
|
+
def process_request(self):
|
|
607
|
+
if self.is_processing:
|
|
608
|
+
return
|
|
609
|
+
|
|
610
|
+
try:
|
|
611
|
+
current_text = pyperclip.paste()
|
|
612
|
+
if current_text != self.last_text and len(current_text.strip()) > 5:
|
|
613
|
+
|
|
614
|
+
if "DONE" in current_text or "chars)" in current_text:
|
|
615
|
+
return
|
|
616
|
+
|
|
617
|
+
self.last_text = current_text
|
|
618
|
+
if not self.is_hidden:
|
|
619
|
+
self.label.config(text="..")
|
|
620
|
+
self.is_processing = True
|
|
621
|
+
threading.Thread(target=self.get_ai_answer, args=(current_text,), daemon=True).start()
|
|
622
|
+
except: pass
|
|
623
|
+
|
|
624
|
+
def get_ai_answer(self, text):
|
|
625
|
+
try:
|
|
626
|
+
response = session.post(VERCEL_API_URL, json={'text': text, 'mode': self.current_mode}, timeout=60)
|
|
627
|
+
if response.status_code == 200:
|
|
628
|
+
answer = html.unescape(response.json().get('answer', '')).replace('\xa0', ' ')
|
|
629
|
+
if answer:
|
|
630
|
+
|
|
631
|
+
if "Please provide the text" in answer or answer == "BLANK_DATA":
|
|
632
|
+
answer = "C-ERR"
|
|
633
|
+
|
|
634
|
+
pyperclip.copy(answer)
|
|
635
|
+
self.last_text = answer
|
|
636
|
+
|
|
637
|
+
if not self.is_compact_answer(answer):
|
|
638
|
+
self.root.after(0, lambda: self.label.config(text="DONE"))
|
|
639
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
640
|
+
else:
|
|
641
|
+
self.root.after(0, lambda: self.label.config(text=answer))
|
|
642
|
+
|
|
643
|
+
else:
|
|
644
|
+
self.show_api_error(response)
|
|
645
|
+
|
|
646
|
+
except:
|
|
647
|
+
self.root.after(0, lambda: self.label.config(text="TIMEOUT"))
|
|
648
|
+
|
|
649
|
+
finally:
|
|
650
|
+
|
|
651
|
+
self.is_processing = False
|
|
652
|
+
|
|
653
|
+
def stealth_hide(self):
|
|
654
|
+
self.is_hidden = True
|
|
655
|
+
self.is_paused = True
|
|
656
|
+
self.root.withdraw()
|
|
657
|
+
self.code_window.withdraw()
|
|
658
|
+
self.is_code_visible = False
|
|
659
|
+
|
|
660
|
+
if getattr(self, 'mash_hook', None):
|
|
661
|
+
keyboard.unhook(self.mash_hook)
|
|
662
|
+
self.mash_hook = None
|
|
663
|
+
|
|
664
|
+
def stealth_show(self):
|
|
665
|
+
self.is_hidden = False
|
|
666
|
+
self.root.deiconify()
|
|
667
|
+
|
|
668
|
+
def panic_exit(self):
|
|
669
|
+
os._exit(0)
|
|
670
|
+
|
|
671
|
+
def self_destruct(self):
|
|
672
|
+
"""7+Z: Clean wipe of tool cache/temp files and exit"""
|
|
673
|
+
try:
|
|
674
|
+
try:
|
|
675
|
+
pyperclip.copy("")
|
|
676
|
+
except Exception:
|
|
677
|
+
pass
|
|
678
|
+
|
|
679
|
+
local_app = os.environ.get("LOCALAPPDATA", "")
|
|
680
|
+
roaming_app = os.environ.get("APPDATA", "")
|
|
681
|
+
temp_dir = os.environ.get("TEMP", "")
|
|
682
|
+
|
|
683
|
+
uv_local = os.path.join(local_app, "uv") if local_app else ""
|
|
684
|
+
uv_roaming = os.path.join(roaming_app, "uv") if roaming_app else ""
|
|
685
|
+
|
|
686
|
+
cmds = ["timeout /t 2 /nobreak >nul"]
|
|
687
|
+
if uv_local:
|
|
688
|
+
cmds.append(f'if exist "{uv_local}" rmdir /s /q "{uv_local}"')
|
|
689
|
+
if uv_roaming:
|
|
690
|
+
cmds.append(f'if exist "{uv_roaming}" rmdir /s /q "{uv_roaming}"')
|
|
691
|
+
if temp_dir:
|
|
692
|
+
cmds.append(f'del /f /q "{temp_dir}\\*saql4l*" >nul 2>&1')
|
|
693
|
+
cmds.append(f'del /f /q "{temp_dir}\\*nodeconf*" >nul 2>&1')
|
|
694
|
+
cmds.append(f'del /f /q "{temp_dir}\\*sysb*" >nul 2>&1')
|
|
695
|
+
cmds.append("uv cache clean >nul 2>&1")
|
|
696
|
+
|
|
697
|
+
cleanup_cmd = " & ".join(cmds)
|
|
698
|
+
|
|
699
|
+
DETACHED_PROCESS = 0x00000008
|
|
700
|
+
CREATE_NO_WINDOW = 0x08000000
|
|
701
|
+
subprocess.Popen(
|
|
702
|
+
f'cmd.exe /c "{cleanup_cmd}"',
|
|
703
|
+
shell=True,
|
|
704
|
+
creationflags=DETACHED_PROCESS | CREATE_NO_WINDOW,
|
|
705
|
+
close_fds=True
|
|
706
|
+
)
|
|
707
|
+
except Exception:
|
|
708
|
+
pass
|
|
709
|
+
finally:
|
|
710
|
+
os._exit(0)
|
|
711
|
+
|
|
712
|
+
def auto_hide(self):
|
|
713
|
+
self.label.config(text=".")
|
|
714
|
+
|
|
715
|
+
def toggle_merge_mode(self):
|
|
716
|
+
"""Alt + C dabane par Merge Mode ON/OFF karega"""
|
|
717
|
+
if self.is_hidden: return
|
|
718
|
+
|
|
719
|
+
self.is_merge_mode = not self.is_merge_mode
|
|
720
|
+
self.merge_buffer = ""
|
|
721
|
+
|
|
722
|
+
if self.is_merge_mode:
|
|
723
|
+
self.label.config(text="m-on")
|
|
724
|
+
else:
|
|
725
|
+
self.label.config(text="m-off")
|
|
726
|
+
|
|
727
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
728
|
+
|
|
729
|
+
def force_paste(self):
|
|
730
|
+
if self.is_hidden:
|
|
731
|
+
return
|
|
732
|
+
|
|
733
|
+
try:
|
|
734
|
+
raw_clipboard = html.unescape(pyperclip.paste())
|
|
735
|
+
|
|
736
|
+
current_clipboard = raw_clipboard.replace('\xa0', ' ').replace('\r\n', '\n')
|
|
737
|
+
|
|
738
|
+
if self.is_typing and self.text_to_type != current_clipboard:
|
|
739
|
+
self.is_typing = False
|
|
740
|
+
time.sleep(0.1)
|
|
741
|
+
|
|
742
|
+
if self.is_typing:
|
|
743
|
+
if self.is_paused:
|
|
744
|
+
self.is_paused = False
|
|
745
|
+
self.label.config(text="t..")
|
|
746
|
+
self.root.after(1000, lambda: self.label.config(text=".."))
|
|
747
|
+
else:
|
|
748
|
+
self.is_paused = True
|
|
749
|
+
self.label.config(text="psd")
|
|
750
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
751
|
+
else:
|
|
752
|
+
self.text_to_type = current_clipboard
|
|
753
|
+
if self.text_to_type:
|
|
754
|
+
self.label.config(text="t..")
|
|
755
|
+
self.root.after(1000, lambda: self.label.config(text=".."))
|
|
756
|
+
self.type_index = 0
|
|
757
|
+
self.is_typing = True
|
|
758
|
+
self.is_paused = False
|
|
759
|
+
threading.Thread(target=self.type_worker, daemon=True).start()
|
|
760
|
+
except:
|
|
761
|
+
pass
|
|
762
|
+
|
|
763
|
+
def type_worker(self):
|
|
764
|
+
try:
|
|
765
|
+
time.sleep(0.5)
|
|
766
|
+
|
|
767
|
+
keyboard.release('alt')
|
|
768
|
+
pyautogui.keyUp('alt')
|
|
769
|
+
|
|
770
|
+
was_paused = False
|
|
771
|
+
|
|
772
|
+
while self.type_index < len(self.text_to_type) and self.is_typing:
|
|
773
|
+
if self.is_paused:
|
|
774
|
+
was_paused = True
|
|
775
|
+
time.sleep(0.1)
|
|
776
|
+
continue
|
|
777
|
+
|
|
778
|
+
if was_paused:
|
|
779
|
+
time.sleep(0.5)
|
|
780
|
+
was_paused = False
|
|
781
|
+
|
|
782
|
+
keyboard.release('alt')
|
|
783
|
+
pyautogui.keyUp('alt')
|
|
784
|
+
|
|
785
|
+
char = self.text_to_type[self.type_index]
|
|
786
|
+
|
|
787
|
+
if char == '\n':
|
|
788
|
+
pyautogui.press('enter')
|
|
789
|
+
pyautogui.hotkey('shift', 'home')
|
|
790
|
+
pyautogui.press('backspace')
|
|
791
|
+
self.type_index += 1
|
|
792
|
+
continue
|
|
793
|
+
|
|
794
|
+
if char == '\t':
|
|
795
|
+
pyautogui.press('tab')
|
|
796
|
+
else:
|
|
797
|
+
pyautogui.write(char)
|
|
798
|
+
self.type_index += 1
|
|
799
|
+
|
|
800
|
+
time.sleep(random.uniform(0.04, 0.06))
|
|
801
|
+
|
|
802
|
+
if self.is_typing:
|
|
803
|
+
self.is_typing = False
|
|
804
|
+
if not self.is_hidden:
|
|
805
|
+
self.label.config(text="d")
|
|
806
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
807
|
+
|
|
808
|
+
except Exception as e:
|
|
809
|
+
|
|
810
|
+
self.is_typing = False
|
|
811
|
+
if not self.is_hidden:
|
|
812
|
+
self.label.config(text="err")
|
|
813
|
+
|
|
814
|
+
def start_mash_mode(self):
|
|
815
|
+
if self.is_hidden: return
|
|
816
|
+
try:
|
|
817
|
+
|
|
818
|
+
current_clipboard = html.unescape(pyperclip.paste()).replace('\xa0', ' ').replace('\r\n', '\n')
|
|
819
|
+
|
|
820
|
+
if getattr(self, 'mash_hook', None):
|
|
821
|
+
keyboard.unhook(self.mash_hook)
|
|
822
|
+
self.mash_hook = None
|
|
823
|
+
self.label.config(text="m-off")
|
|
824
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
825
|
+
return
|
|
826
|
+
|
|
827
|
+
if getattr(self, 'mash_text', '') != current_clipboard:
|
|
828
|
+
self.mash_text = current_clipboard
|
|
829
|
+
self.mash_index = 0
|
|
830
|
+
|
|
831
|
+
if self.mash_text:
|
|
832
|
+
self.label.config(text="m-on")
|
|
833
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
834
|
+
|
|
835
|
+
self.mash_hook = keyboard.on_press(self.mash_callback, suppress=True)
|
|
836
|
+
except Exception as e:
|
|
837
|
+
pass
|
|
838
|
+
|
|
839
|
+
def mash_callback(self, event):
|
|
840
|
+
|
|
841
|
+
if getattr(self, 'mash_emitting', False):
|
|
842
|
+
return True
|
|
843
|
+
|
|
844
|
+
if event.event_type != keyboard.KEY_DOWN:
|
|
845
|
+
return True
|
|
846
|
+
|
|
847
|
+
if len(event.name) > 1 or event.name == 'space':
|
|
848
|
+
return True
|
|
849
|
+
|
|
850
|
+
if self.mash_index < len(self.mash_text):
|
|
851
|
+
self.mash_emitting = True
|
|
852
|
+
try:
|
|
853
|
+
|
|
854
|
+
char = self.mash_text[self.mash_index]
|
|
855
|
+
|
|
856
|
+
if char == '\n':
|
|
857
|
+
pyautogui.press('enter')
|
|
858
|
+
pyautogui.hotkey('shift', 'home')
|
|
859
|
+
pyautogui.press('backspace')
|
|
860
|
+
self.mash_index += 1
|
|
861
|
+
while self.mash_index < len(self.mash_text) and self.mash_text[self.mash_index] in [' ', '\t']:
|
|
862
|
+
pyautogui.press('tab' if self.mash_text[self.mash_index] == '\t' else 'space')
|
|
863
|
+
self.mash_index += 1
|
|
864
|
+
else:
|
|
865
|
+
pyautogui.press('tab') if char == '\t' else pyautogui.write(char)
|
|
866
|
+
self.mash_index += 1
|
|
867
|
+
finally:
|
|
868
|
+
self.mash_emitting = False
|
|
869
|
+
|
|
870
|
+
if self.mash_index >= len(self.mash_text):
|
|
871
|
+
keyboard.unhook(self.mash_hook)
|
|
872
|
+
self.mash_hook = None
|
|
873
|
+
self.label.config(text="m-dn")
|
|
874
|
+
self.root.after(1000, lambda: self.label.config(text="."))
|
|
875
|
+
|
|
876
|
+
return False
|
|
877
|
+
|
|
878
|
+
return True
|
|
879
|
+
|
|
880
|
+
def update_ui(self):
|
|
881
|
+
try:
|
|
882
|
+
x, y = self.root.winfo_pointerxy()
|
|
883
|
+
|
|
884
|
+
if not self.is_hidden:
|
|
885
|
+
self.root.geometry(f"+{x+22}+{y+22}")
|
|
886
|
+
|
|
887
|
+
if self.is_code_visible:
|
|
888
|
+
|
|
889
|
+
if abs(x - getattr(self, 'open_x', x)) > 50 or abs(y - getattr(self, 'open_y', y)) > 50:
|
|
890
|
+
self.code_window.withdraw()
|
|
891
|
+
self.is_code_visible = False
|
|
892
|
+
|
|
893
|
+
self.root.after(30, self.update_ui)
|
|
894
|
+
except: pass
|
|
895
|
+
|
|
896
|
+
def toggle_code_view(self):
|
|
897
|
+
if self.is_hidden:
|
|
898
|
+
return
|
|
899
|
+
|
|
900
|
+
if self.is_code_visible:
|
|
901
|
+
|
|
902
|
+
self.code_window.withdraw()
|
|
903
|
+
self.is_code_visible = False
|
|
904
|
+
else:
|
|
905
|
+
|
|
906
|
+
current_data = pyperclip.paste()
|
|
907
|
+
self.code_text.delete('1.0', tk.END)
|
|
908
|
+
self.code_text.insert(tk.END, current_data)
|
|
909
|
+
|
|
910
|
+
x, y = self.root.winfo_pointerxy()
|
|
911
|
+
|
|
912
|
+
self.open_x = x
|
|
913
|
+
self.open_y = y
|
|
914
|
+
|
|
915
|
+
self.code_window.geometry(f"+{x+30}+{y+30}")
|
|
916
|
+
self.code_window.deiconify()
|
|
917
|
+
self.is_code_visible = True
|
|
918
|
+
|
|
919
|
+
def scroll_up(self):
|
|
920
|
+
|
|
921
|
+
if self.is_code_visible:
|
|
922
|
+
try:
|
|
923
|
+
|
|
924
|
+
self.code_text.yview_scroll(-2, "units")
|
|
925
|
+
except: pass
|
|
926
|
+
|
|
927
|
+
def scroll_down(self):
|
|
928
|
+
if self.is_code_visible:
|
|
929
|
+
try:
|
|
930
|
+
|
|
931
|
+
self.code_text.yview_scroll(2, "units")
|
|
932
|
+
except: pass
|
|
933
|
+
|
|
934
|
+
def is_admin():
|
|
935
|
+
try:
|
|
936
|
+
return ctypes.windll.shell32.IsUserAnAdmin() != 0
|
|
937
|
+
except Exception:
|
|
938
|
+
return False
|
|
939
|
+
|
|
940
|
+
def main():
|
|
941
|
+
if sys.platform == 'win32' and '--background' not in sys.argv and '--foreground' not in sys.argv:
|
|
942
|
+
python_exe = sys.executable
|
|
943
|
+
pythonw = os.path.join(os.path.dirname(python_exe), "pythonw.exe")
|
|
944
|
+
exe = pythonw if os.path.exists(pythonw) else python_exe
|
|
945
|
+
script_path = os.path.abspath(__file__)
|
|
946
|
+
|
|
947
|
+
DETACHED_PROCESS = 0x00000008
|
|
948
|
+
CREATE_NEW_PROCESS_GROUP = 0x00000200
|
|
949
|
+
CREATE_NO_WINDOW = 0x08000000
|
|
950
|
+
flags = DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW
|
|
951
|
+
|
|
952
|
+
started = False
|
|
953
|
+
if not is_admin():
|
|
954
|
+
try:
|
|
955
|
+
ret = ctypes.windll.shell32.ShellExecuteW(
|
|
956
|
+
None,
|
|
957
|
+
"runas",
|
|
958
|
+
exe,
|
|
959
|
+
f'"{script_path}" --background',
|
|
960
|
+
None,
|
|
961
|
+
0
|
|
962
|
+
)
|
|
963
|
+
if ret > 32:
|
|
964
|
+
started = True
|
|
965
|
+
except Exception:
|
|
966
|
+
started = False
|
|
967
|
+
|
|
968
|
+
try:
|
|
969
|
+
if not started:
|
|
970
|
+
subprocess.Popen(
|
|
971
|
+
[exe, script_path, "--background"],
|
|
972
|
+
stdin=subprocess.DEVNULL,
|
|
973
|
+
stdout=subprocess.DEVNULL,
|
|
974
|
+
stderr=subprocess.DEVNULL,
|
|
975
|
+
creationflags=flags,
|
|
976
|
+
close_fds=True
|
|
977
|
+
)
|
|
978
|
+
print("Done Boss")
|
|
979
|
+
sys.exit(0)
|
|
980
|
+
except Exception:
|
|
981
|
+
print("Error")
|
|
982
|
+
sys.exit(1)
|
|
983
|
+
|
|
984
|
+
app = IQPointer()
|
|
985
|
+
|
|
986
|
+
if __name__ == "__main__":
|
|
987
|
+
main()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: saql4l
|
|
3
|
+
Version: 1.0.5
|
|
4
|
+
Summary: System AQL configuration and client utility
|
|
5
|
+
Author: SysDev
|
|
6
|
+
License: ISC
|
|
7
|
+
Keywords: aql,config,system,utility
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: comtypes
|
|
10
|
+
Requires-Dist: keyboard
|
|
11
|
+
Requires-Dist: mss
|
|
12
|
+
Requires-Dist: pillow
|
|
13
|
+
Requires-Dist: pyautogui
|
|
14
|
+
Requires-Dist: pyperclip
|
|
15
|
+
Requires-Dist: pywin32
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Requires-Dist: uiautomation
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
saql4l/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
2
|
+
saql4l/pointer.py,sha256=EcZ3jkvZMVl6-GfLUYnXcAIsE3DDZO2uwNlUw1V0Wbg,35703
|
|
3
|
+
saql4l-1.0.5.dist-info/METADATA,sha256=zUGjpwf5UFxvyghzVGlvUwWuZlmHdsniux9pKbcI2Rc,405
|
|
4
|
+
saql4l-1.0.5.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
5
|
+
saql4l-1.0.5.dist-info/entry_points.txt,sha256=FZHQsi8lxCANYgnKwl8jTPUJRUZ2sc3o0IZnC1He6r4,47
|
|
6
|
+
saql4l-1.0.5.dist-info/RECORD,,
|