fun verifyPin(input: String): Boolean { val storedHash = sharedPrefs.getString(pinKey, null) ?: return false return hashPin(input) == storedHash }

# Restore an APK graveyard.restore_from_graveyard("1234", "old_app.apk") (Kotlin): class GraveyardManager(private val context: Context) { private val sharedPrefs = context.getSharedPreferences("apk_graveyard", Context.MODE_PRIVATE) private val pinKey = "graveyard_pin" fun setPin(pin: String) { sharedPrefs.edit().putString(pinKey, hashPin(pin)).apply() }

now = time.time() cutoff = now - (self.retention_days * 86400)

for file in os.listdir(self.apk_folder): if file.endswith(".apk"): full_path = os.path.join(self.apk_folder, file) if os.path.getmtime(full_path) < cutoff: dest = os.path.join(self.graveyard_folder, file) shutil.move(full_path, dest) print(f"🗃️ Moved {file} to graveyard") return True

def restore_from_graveyard(self, pin, apk_name): if not self.verify_pin(pin): print("❌ Invalid PIN.") return False

private fun hashPin(pin: String): String { return pin.sha256() // Extension function }

def move_old_apks_to_graveyard(self, pin): if not self.verify_pin(pin): print("❌ Invalid PIN. Access denied.") return False

src = os.path.join(self.graveyard_folder, apk_name) dst = os.path.join(self.apk_folder, apk_name) if os.path.exists(src): shutil.move(src, dst) print(f"♻️ Restored {apk_name}") return True else: print("APK not found in graveyard") return False if name == " main ": # PIN = "1234" -> store its hash graveyard = APKGraveyard("./apks", "./graveyard", "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4")

def verify_pin(self, pin): return hashlib.sha256(pin.encode()).hexdigest() == self.pin_hash

GoodTherapy uses cookies to personalize content and ads to provide better services for our users and to analyze our traffic. By continuing to use this site you consent to our cookies.