Skip to content

Commit 487ba77

Browse files
committed
fix(main): Handle winerror 225 with fix suggestion
1 parent 09ce15a commit 487ba77

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

ShadowCrypt.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import os
2323
import sys
2424
import time
25+
import errno
2526
import subprocess
2627
try:
2728
from modules.common_utils import get_dir_path, hold_console_for_input
@@ -48,6 +49,7 @@ def display_banner():
4849
print(" /____/_/\n")
4950
print("=" * 75)
5051

52+
5153
def should_reinitialize_db():
5254
"""
5355
Checks if the required .dll files exist in the db directory and if their file sizes are valid.
@@ -181,10 +183,26 @@ def main():
181183

182184
try:
183185
subprocess.run(command, check=True)
186+
except OSError as e:
187+
winerror = getattr(e, "winerror", None)
188+
if e.errno == errno.EPERM or winerror == 225:
189+
print("\n[!] It looks like a security program is preventing this application from running.")
190+
print("\n[*] To fix this, please try the following steps:")
191+
print(" 1. Reinstall ShadowCrypt.")
192+
print(" 2. Add the installation directory (e.g., 'C:\\Program Files (x86)\\ShadowCrypt') to your antivirus or security software's exclusion list.")
193+
print(" 3. Restart your computer and try again.\n\nExiting...\n")
194+
else:
195+
print(f"\n[!] OS Error occurred: {e}")
196+
hold_console_for_input()
197+
sys.exit(1)
184198
except subprocess.CalledProcessError as e:
185199
sys.exit(1)
186200
except (KeyboardInterrupt, EOFError):
187201
sys.exit(1)
202+
except Exception as e:
203+
print(f"\n[!] An unexpected error occurred: {e}")
204+
hold_console_for_input()
205+
sys.exit(1)
188206

189207
return module
190208

0 commit comments

Comments
 (0)