š
Online Notepad
+
ADD NEW TEXT
Untitled Note
Last saved: May 17, 10:54 AM
Untitled Note
Last saved: Apr 19, 8:09 AM
Untitled Note
Last saved: Apr 19, 7:24 AM
Untitled Note
Last saved: Apr 19, 7:21 AM
Untitled Note
Last saved: Apr 19, 7:19 AM
Untitled Note
Last saved: Apr 19, 6:19 AM
Untitled Note
Last saved: Apr 19, 5:48 AM
Untitled Note
Last saved: Apr 19, 5:44 AM
Untitled Note
Last saved: Apr 11, 10:20 AM
Untitled Note
Last saved: Apr 11, 8:34 AM
Untitled Note
Last saved: Apr 11, 8:23 AM
Untitled Note
Last saved: Apr 11, 8:14 AM
Untitled Note
Last saved: Apr 11, 7:44 AM
Untitled Note
Last saved: Apr 11, 7:43 AM
Untitled Note
Last saved: Apr 11, 7:35 AM
Untitled Note
Last saved: Apr 11, 7:32 AM
š¾ Save to Server
šļø Delete
import os import subprocess from datetime import datetime BASE_DIR = "/root/FirefoxProfiles" DESKTOP_BACKUP_DIR = "/root/Desktop" # ================= CREATE PROFILES ================= def create_profiles(): try: count = int(input("š How many profiles (persons) you want to create? ")) except: print("ā Invalid number") return print("\nš Creating profiles...\n") # Create profile folders for i in range(1, count + 1): path = os.path.join(BASE_DIR, f"person{i}") os.makedirs(path, exist_ok=True) # Fix permissions subprocess.run(f"chown -R root:root {BASE_DIR}", shell=True) subprocess.run(f"chmod -R 700 {BASE_DIR}", shell=True) # Remove lock files subprocess.run(f"rm -f {BASE_DIR}/*/.parentlock {BASE_DIR}/*/lock 2>/dev/null", shell=True) print("\nā” Initializing profiles (VERY IMPORTANT)...\n") # Initialize profiles so they contain real data for i in range(1, count + 1): profile_path = f"{BASE_DIR}/person{i}" print(f"ā Initializing person{i}") subprocess.run( f"firefox --headless --no-sandbox --profile {profile_path} & sleep 3; pkill firefox", shell=True ) print("\nā Profiles created & initialized:") subprocess.run(f"ls {BASE_DIR}", shell=True) # Create aliases print("\nā” Creating launch aliases (ff1, ff2, ...)") bashrc_path = os.path.expanduser("~/.bashrc") with open(bashrc_path, "a") as f: for i in range(1, count + 1): f.write(f"alias ff{i}='firefox --no-sandbox --profile {BASE_DIR}/person{i}'\n") subprocess.run("source ~/.bashrc", shell=True, executable="/bin/bash") print("ā Aliases created! Use ff1, ff2, ff3 ...") # ================= BACKUP ================= def backup_profiles(): print("\nš¦ Creating backup...\n") if not os.path.exists(BASE_DIR): print("ā No profiles found!") return date = datetime.now().strftime("%Y-%m-%d_%H-%M") backup_path = f"{DESKTOP_BACKUP_DIR}/firefox-backup-{date}.tar.gz" cmd = f"tar -czvf {backup_path} -C /root FirefoxProfiles" subprocess.run(cmd, shell=True) print(f"\nā Backup created: {backup_path}") subprocess.run("ls -lh /root/Desktop/firefox-backup-*.tar.gz", shell=True) # ================= RESTORE ================= def restore_profiles(): print("\nā»ļø Restoring backup...\n") subprocess.run("ls -lh /root/Desktop/firefox-backup-*.tar.gz", shell=True) confirm = input("\nā ļø This will DELETE existing profiles. Continue? (y/n): ") if confirm.lower() != "y": print("ā Cancelled") return # Remove old profiles subprocess.run("rm -rf /root/FirefoxProfiles", shell=True) # Extract backup subprocess.run("tar -xzf /root/Desktop/firefox-backup-*.tar.gz -C /root/", shell=True) # Fix permissions subprocess.run("chown -R root:root /root/FirefoxProfiles", shell=True) subprocess.run("chmod -R 700 /root/FirefoxProfiles", shell=True) # Remove lock files subprocess.run("rm -f /root/FirefoxProfiles/*/.parentlock /root/FirefoxProfiles/*/lock 2>/dev/null", shell=True) print("\nā Restore completed!") subprocess.run("ls /root/FirefoxProfiles/", shell=True) # ================= MENU ================= def main(): while True: print("\n================ FIREFOX PROFILE MANAGER ================\n") print("1ļøā£ Create Profiles") print("2ļøā£ Backup Profiles") print("3ļøā£ Restore Profiles") print("0ļøā£ Exit\n") choice = input("š Select option: ") if choice == "1": create_profiles() elif choice == "2": backup_profiles() elif choice == "3": restore_profiles() elif choice == "0": print("š Exit") break else: print("ā Invalid option") if __name__ == "__main__": main()
ā Saved online