invixco 1.0.6

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.
@@ -0,0 +1,245 @@
1
+ import sys
2
+ import time
3
+ import re
4
+ import ctypes
5
+ from ctypes import wintypes
6
+
7
+ try:
8
+ import uiautomation as auto
9
+ except ImportError:
10
+ print("ERROR: Missing 'uiautomation'")
11
+ sys.exit(1)
12
+
13
+ # ═══════════════════════════════════════════
14
+ # STEALTH UIA EXTRACTOR v4.0
15
+ # SEB Editor + Code Editor Support
16
+ # ═══════════════════════════════════════════
17
+
18
+ user32 = ctypes.windll.user32
19
+ WNDENUMPROC = ctypes.WINFUNCTYPE(ctypes.c_bool, wintypes.HWND, wintypes.LPARAM)
20
+
21
+ SKIP_TITLES = {'chatgpt', 'windows service diagnostics', 'windows diagnostic utility', 'electron', ''}
22
+
23
+ def get_real_foreground_hwnd():
24
+ """Find the actual exam/browser window, skipping our Electron windows."""
25
+ candidates = []
26
+
27
+ def enum_callback(hwnd, lparam):
28
+ if not user32.IsWindowVisible(hwnd):
29
+ return True
30
+ title = get_window_title(hwnd)
31
+ if not title or len(title) < 2:
32
+ return True
33
+ low = title.lower()
34
+ if any(skip in low for skip in ['chatgpt', 'windows service', 'windows diagnostic', 'electron', 'searchapp']):
35
+ return True
36
+ if low in {'program manager', 'start', 'settings', 'task view', 'windows input experience'}:
37
+ return True
38
+ if 'safe exam browser' in low:
39
+ candidates.insert(0, (hwnd, title))
40
+ else:
41
+ candidates.append((hwnd, title))
42
+ return True
43
+
44
+ fg = user32.GetForegroundWindow()
45
+ if fg:
46
+ title = get_window_title(fg).lower()
47
+ if not any(skip in title for skip in ['chatgpt', 'electron', 'searchapp']):
48
+ return fg
49
+
50
+ user32.EnumWindows(WNDENUMPROC(enum_callback), 0)
51
+ if candidates:
52
+ return candidates[0][0]
53
+ return fg
54
+
55
+ def get_window_title(hwnd):
56
+ length = user32.GetWindowTextLengthW(hwnd)
57
+ if length == 0:
58
+ return ""
59
+ buf = ctypes.create_unicode_buffer(length + 1)
60
+ user32.GetWindowTextW(hwnd, buf, length + 1)
61
+ return buf.value
62
+
63
+ def get_universal_text():
64
+ auto.uiautomation.DEBUG_SEARCH_TIME = False
65
+ auto.uiautomation.SET_TEXT_WAIT_TIME = 0.1
66
+
67
+ hwnd = get_real_foreground_hwnd()
68
+ if not hwnd:
69
+ return "ERROR: No window"
70
+
71
+ root = auto.ControlFromHandle(hwnd)
72
+
73
+ try:
74
+ root.GetPropertyValue(auto.PropertyId.IsPasswordPropertyId)
75
+ except Exception:
76
+ pass
77
+ time.sleep(0.3)
78
+
79
+ extracted = []
80
+ seen = set()
81
+ start_time = time.time()
82
+
83
+ SKIP = {'TitleBarControl', 'MenuBarControl', 'ScrollBarControl'}
84
+ NOISE_EXACT = {"minimize", "maximize", "close", "chrome legacy window", "logo.", "version:"}
85
+ NOISE_PATTERNS = [
86
+ r'^https?://',
87
+ r'^file://',
88
+ r'\.asar',
89
+ r'image descriptions',
90
+ r'context menu',
91
+ r'powered by',
92
+ r'to exit please',
93
+ r'appdata/local'
94
+ ]
95
+
96
+ def add_text(text):
97
+ if not text:
98
+ return
99
+ cl = re.sub(r'\s+', ' ', str(text)).strip()
100
+ low = cl.lower()
101
+ if len(low) < 4:
102
+ return
103
+ if low in NOISE_EXACT:
104
+ return
105
+ for pat in NOISE_PATTERNS:
106
+ if re.search(pat, low):
107
+ return
108
+ if cl not in seen:
109
+ is_subset = False
110
+ for exist in list(seen):
111
+ if cl in exist:
112
+ is_subset = True
113
+ break
114
+ if not is_subset:
115
+ extracted.append(cl)
116
+ seen.add(cl)
117
+
118
+ def extract_node(ctrl):
119
+ try:
120
+ add_text(ctrl.Name)
121
+ except Exception:
122
+ pass
123
+ try:
124
+ vp = ctrl.GetValuePattern()
125
+ if vp and vp.Value:
126
+ add_text(vp.Value)
127
+ except Exception:
128
+ pass
129
+ try:
130
+ lp = ctrl.GetLegacyIAccessiblePattern()
131
+ if lp:
132
+ if lp.Value:
133
+ add_text(lp.Value)
134
+ if lp.Description:
135
+ add_text(lp.Description)
136
+ except Exception:
137
+ pass
138
+ try:
139
+ tp = ctrl.GetTextPattern()
140
+ if tp:
141
+ txt = tp.DocumentRange.GetText(-1)
142
+ if txt:
143
+ if len(txt) > 200:
144
+ for line in txt.split('\n'):
145
+ add_text(line)
146
+ else:
147
+ add_text(txt)
148
+ except Exception:
149
+ pass
150
+
151
+ def walk(ctrl, depth=0):
152
+ if depth > 50 or (time.time() - start_time) > 5.0:
153
+ return
154
+ try:
155
+ ctl_type = ctrl.ControlTypeName
156
+ if ctl_type in SKIP:
157
+ return
158
+ if ctl_type not in {'WindowControl'}:
159
+ extract_node(ctrl)
160
+ for child in ctrl.GetChildren():
161
+ walk(child, depth + 1)
162
+ except Exception:
163
+ pass
164
+
165
+ # ── STRATEGY 0: Focused Element (best for code editors) ──
166
+ try:
167
+ focused = auto.GetFocusedControl()
168
+ if focused:
169
+ extract_node(focused)
170
+ # Walk siblings and parent for more context
171
+ try:
172
+ parent = focused.GetParentControl()
173
+ if parent:
174
+ walk(parent, depth=0)
175
+ except Exception:
176
+ pass
177
+ except Exception:
178
+ pass
179
+
180
+ # ── STRATEGY 1: Cursor-based extraction ──
181
+ if len(extracted) < 2:
182
+ extracted.clear()
183
+ seen.clear()
184
+ try:
185
+ cursor_ctrl = auto.ControlFromCursor()
186
+ if cursor_ctrl:
187
+ ctl_type = cursor_ctrl.ControlTypeName
188
+ if ctl_type in {'DocumentControl', 'TextControl', 'EditControl', 'CustomControl', 'PaneControl'}:
189
+ doc = cursor_ctrl
190
+ while doc and doc.ControlTypeName not in {'DocumentControl', 'WindowControl'}:
191
+ parent = doc.GetParentControl()
192
+ if not parent:
193
+ break
194
+ doc = parent
195
+ walk(doc)
196
+ except Exception:
197
+ pass
198
+
199
+ # ── STRATEGY 2: Full window walk ──
200
+ if len(extracted) < 2:
201
+ walk(root)
202
+
203
+ # ── STRATEGY 3: Class Hunter Search (Specific for restricted browser editors) ──
204
+ if len(extracted) < 2:
205
+ extracted.clear()
206
+ seen.clear()
207
+ # Look specifically for Chrome/Monaco Render widgets which hold the text
208
+ try:
209
+ # Common class names for SEB/AMCAT/Chrome editors
210
+ targets = root.GetChildren()
211
+ queue = list(targets)
212
+ while queue:
213
+ curr = queue.pop(0)
214
+ try:
215
+ cn = curr.ClassName
216
+ ct = curr.ControlTypeName
217
+ # If it looks like an editor container, force extract it
218
+ if 'Chrome_RenderWidgetHostHWND' in cn or ct in {'DocumentControl', 'EditControl'}:
219
+ extract_node(curr)
220
+ # We found a major target, don't stop but prioritize it
221
+ if len(queue) < 100: # Safety cap for queue depth
222
+ queue.extend(curr.GetChildren())
223
+ except: pass
224
+ if (time.time() - start_time) > 6.0: break
225
+ except: pass
226
+
227
+ # Final output
228
+ try:
229
+ header = f"TARGET: {get_window_title(hwnd)}"
230
+ except:
231
+ header = "TARGET: Unknown Window"
232
+
233
+ if extracted:
234
+ return header + "\n" + "\n\n".join(extracted)
235
+ else:
236
+ return header
237
+
238
+ if __name__ == "__main__":
239
+ try:
240
+ sys.stdout.reconfigure(encoding='utf-8')
241
+ # Run the engine
242
+ res = get_universal_text()
243
+ print(res)
244
+ except Exception:
245
+ print("ERROR: Engine failed.")
@@ -0,0 +1,132 @@
1
+ # ══════════════════════════════════════════════════════════════════════════
2
+ # UNIVERSAL NATIVE TEXT EXTRACTOR v5.2 (FORCE MODE)
3
+ # Specialized for Chrome/Edge/Firefox Legacy Bridges
4
+ # ══════════════════════════════════════════════════════════════════════════
5
+
6
+ Add-Type -AssemblyName UIAutomationClient
7
+ Add-Type -AssemblyName UIAutomationTypes
8
+
9
+ $OutputEncoding = [System.Text.Encoding]::UTF8
10
+
11
+ try {
12
+ $sig = @'
13
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
14
+ [DllImport("user32.dll")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
15
+ [DllImport("user32.dll")] public static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount);
16
+ [DllImport("user32.dll")] public static extern int GetClassName(IntPtr hWnd, System.Text.StringBuilder lpString, int nMaxCount);
17
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
18
+ '@
19
+ $user32 = Add-Type -MemberDefinition $sig -Name "Win32" -Namespace Win32Functions -PassThru
20
+
21
+ $hWnd = $user32::GetForegroundWindow()
22
+ if ($hWnd -eq [IntPtr]::Zero) { exit }
23
+
24
+ # Get Process ID for targeted search
25
+ $targetPid = 0
26
+ $user32::GetWindowThreadProcessId($hWnd, [ref]$targetPid) | Out-Null
27
+
28
+ # 🎯 STEP 1: TARGETED BRIDGE SEARCH
29
+ # Specifically look for Chrome_LegacyWindow (The UIA Port)
30
+ function Find-Bridge($parent) {
31
+ $child = [IntPtr]::Zero
32
+ while ($true) {
33
+ $child = $user32::FindWindowEx($parent, $child, $null, $null)
34
+ if ($child -eq [IntPtr]::Zero) { break }
35
+
36
+ $sb = New-Object System.Text.StringBuilder 256
37
+ $user32::GetClassName($child, $sb, 256) | Out-Null
38
+ $className = $sb.ToString()
39
+
40
+ # Browser UIA Bridges
41
+ if ($className -match "(Chrome_LegacyWindow|Chrome_RenderWidgetHostHWND|Intermediate D3D Window|MozillaWindowClass)") {
42
+ return $child
43
+ }
44
+
45
+ $sub = Find-Bridge $child
46
+ if ($sub -ne [IntPtr]::Zero) { return $sub }
47
+ }
48
+ return [IntPtr]::Zero
49
+ }
50
+
51
+ $hBridge = Find-Bridge $hWnd
52
+ $root = $null
53
+
54
+ if ($hBridge -ne [IntPtr]::Zero) {
55
+ $root = [System.Windows.Automation.AutomationElement]::FromHandle($hBridge)
56
+ } else {
57
+ $root = [System.Windows.Automation.AutomationElement]::FromHandle($hWnd)
58
+ }
59
+
60
+ # 🎯 STEP 2: ACCESSIBILITY FORCE-ACTIVATE
61
+ try {
62
+ for ($i=0; $i -lt 4; $i++) {
63
+ $null = $root.GetCurrentPropertyValue([System.Windows.Automation.AutomationElement]::NameProperty)
64
+ $null = $root.GetSupportedPatterns()
65
+ Start-Sleep -Milliseconds 150
66
+ }
67
+ } catch {}
68
+
69
+ $textBuffer = New-Object System.Text.StringBuilder
70
+ $seenText = New-Object System.Collections.Generic.HashSet[string]
71
+ $startTime = [DateTime]::Now
72
+
73
+ function Add-CleanText($text) {
74
+ if ($null -eq $text) { return }
75
+ $clean = $text.Replace("`r", " ").Replace("`n", " ").Trim()
76
+ $clean = [regex]::Replace($clean, "\s+", " ")
77
+ if ($clean.Length -le 1 -or $clean -match "^(Search|Close|Minimize|Maximize|Restore|Bookmark|Extensions|New Tab|Address and search bar|Profile|Downloads|History|Menu|Tabs|Reload|Forward|Back|View site information)$") { return }
78
+
79
+ $norm = $clean.ToLower()
80
+ if (-not $seenText.Contains($norm)) {
81
+ [void]$textBuffer.AppendLine($clean)
82
+ [void]$seenText.Add($norm)
83
+ }
84
+ }
85
+
86
+ function Walk($element, $depth) {
87
+ if ($depth -gt 60 -or ([DateTime]::Now - $startTime).TotalSeconds -gt 5) { return }
88
+ try {
89
+ # Extract Value or Text
90
+ Add-CleanText $element.Current.Name
91
+
92
+ try {
93
+ $content = $element.GetCurrentPattern([System.Windows.Automation.TextPattern]::Pattern).DocumentRange.GetText(-1)
94
+ $content.Split("`n") | ForEach-Object { Add-CleanText $_ }
95
+ } catch {}
96
+
97
+ $children = $element.FindAll([System.Windows.Automation.TreeScope]::Children, [System.Windows.Automation.Condition]::TrueCondition)
98
+ foreach ($child in $children) { Walk $child ($depth + 1) }
99
+ } catch {}
100
+ }
101
+
102
+ # 🎯 STEP 3: DUAL-SEARCH STRATEGY
103
+ # A) Try to find a Document within the found handle
104
+ $docCond = New-Object System.Windows.Automation.PropertyCondition([System.Windows.Automation.AutomationElement]::ControlTypeProperty, [System.Windows.Automation.ControlType]::Document)
105
+ $doc = $root.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $docCond)
106
+
107
+ if ($null -ne $doc) {
108
+ Walk $doc 0
109
+ }
110
+
111
+ # B) GLOBAL FALLBACK: Search entire UI tree filtered by Process ID
112
+ if ($textBuffer.Length -lt 50) {
113
+ $procCond = New-Object System.Windows.Automation.PropertyCondition([System.Windows.Automation.AutomationElement]::ProcessIdProperty, [int]$targetPid)
114
+ $orCond = New-Object System.Windows.Automation.OrCondition($docCond, $procCond)
115
+ $globalDocs = [System.Windows.Automation.AutomationElement]::RootElement.FindAll([System.Windows.Automation.TreeScope]::Descendants, $orCond)
116
+ foreach ($g in $globalDocs) {
117
+ # Only walk if it's actually a document or has our PID
118
+ if ($g.Current.ProcessId -eq $targetPid) { Walk $g 0 }
119
+ }
120
+ }
121
+
122
+ $result = $textBuffer.ToString().Trim()
123
+ if ($result.Length -gt 0) {
124
+ Write-Output $result
125
+ } else {
126
+ $sb = New-Object System.Text.StringBuilder 256
127
+ $user32::GetWindowText($hWnd, $sb, 256) | Out-Null
128
+ Write-Output "TARGET: $($sb.ToString())"
129
+ }
130
+ } catch {
131
+ Write-Output "ERROR: $($_.Exception.Message)"
132
+ }
package/config.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "prompt": "Solve this with 100% accuracy. Think step-by-step for every part of the question to be sure. If the question is an MCQ, provide the option letter along with the full option text in your answer.",
3
+ "proxy": "http://toeyvirg:jmvt9k4bgnqd@142.111.67.146:5611",
4
+ "chatgptSessionToken": [
5
+
6
+ ]
7
+ }
package/index.html ADDED
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="styles.css">
5
+ </head>
6
+ <body>
7
+ <div id="container">
8
+ <div id="top-bar">
9
+ <span id="batch-counter">[0/10]</span>
10
+ <span id="section-badge">GEN</span>
11
+ </div>
12
+ <div id="answer-area"></div>
13
+ </div>
14
+ <script src="renderer.js"></script>
15
+ </body>
16
+ </html>