blob: 81ba1a51bfa240da6be8af977f1b1f81a4fde93a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/env python3
import os
import subprocess
import sys
RED = "\033[0;31m"
RESET = "\033[0m"
def main():
if os.geteuid() != 0:
print(f"{RED}[!] Superuser access is required{RESET}")
sys.exit(1)
if not os.path.exists("/dev/sda"):
print(f"{RED}[!] USB not found!{RESET}")
sys.exit(1)
print(f"{RED}[*] Decrypting /dev/sda1...{RESET}")
try:
subprocess.run(["cryptsetup", "open", "/dev/sda1", "sda1_crypt"], check=True)
subprocess.run(["mount", "/dev/mapper/sda1_crypt", "/mnt/usb", "--mkdir"], check=True)
print(f"{RED}[*] Decrypted and mounted to /mnt/usb!{RESET}")
except subprocess.CalledProcessError as e:
print(f"{RED}[!] Error: {e}{RESET}")
sys.exit(1)
if __name__ == "__main__":
main()
|