MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / vault_encrypt

Function vault_encrypt

Scripts/Developer Base/Free Internet.py:827–839  ·  view source on GitHub ↗
(master: str, text: str)

Source from the content-addressed store, hash-verified

825
826
827def vault_encrypt(master: str, text: str) -> Optional[str]:
828 text = (text or "").strip()
829 if not text:
830 return None
831 env = os.environ.copy()
832 env["FS_PASS"] = master
833 res = subprocess.run(
834 ["openssl", "enc", "-aes-256-cbc", "-pbkdf2", "-salt", "-a", "-A", "-pass", "env:FS_PASS"],
835 input=text.encode("utf-8"), capture_output=True, env=env, check=False
836 )
837 if res.returncode != 0:
838 raise RuntimeError(res.stderr.decode("utf-8", "ignore") or "Encryption failed")
839 return res.stdout.decode("utf-8").strip()
840
841
842def vault_decrypt(master: str, token: Optional[str]) -> str:

Callers 3

vault_addFunction · 0.70
vault_editFunction · 0.70
vault_settingsFunction · 0.70

Calls 1

runMethod · 0.45

Tested by

no test coverage detected