30 lines
797 B
Text
30 lines
797 B
Text
|
#!/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()
|