20
loading...
This website collects cookies to deliver better user experience
from random import sample
from string import ascii_letters,digits
from base64 import b64decode
from json import load,dump
import flask
app = flask.Flask("Really Awesome Storage API!")
def write(ip:str,file:str):
with open("list.json","r") as i:
ips = load(i)
if ip not in list(ips):
ips[ip] = []
ips[ip].append(file)
with open("list.json","w") as i:
dump(ips,i)
return True
@app.route('/save',methods=['POST'])
def save():
image = b64decode(flask.request.data)
string = ''.join(sample(ascii_letters+digits,10)) + flask.request.headers.get("extension")
a = open("stuff/" + string,"wb")
a.write(image)
a.close()
write(flask.request.remote_addr,f"POST {string}")
return string ,202
save
uri so this will take file that was base 64 encoded in body of response and it gonna create a file and write a bytes after that we close the file and log the file after that we will return random string with extension of the file that storage in our server!@app.route('/<pic>')
def get(pic):
try:
a = flask.send_file("stuff/" + pic,as_attachment=True if flask.request.args.get("preview") is not None or flask.request.args.get("preview") == "false" else False)
write(flask.request.remote_addr,f"GET {pic} FILE ")
except Exception as e:
return str(e)
else:
return a
@app.route('/<pic>')
def get(pic):
try:
a = flask.send_from_directory("stuff",pic)
write(flask.request.remote_addr,f"GET {pic} FILE ")
except Exception as e:
return str(e)
else:
return a
as_attachment
ARGUMENT!)from requests import post
from base64 import b64encode
from PIL import ImageGrab
from sys import exit
from os import remove
from os.path import splitext
while True:
choices = input("Screenshot (s) or File (f) or Clipboard Text(ct) or Text (t) or Quit (q)\n")
if "s" in a or "S" in choices:
screen = ImageGrab.grabclipboard()
screen.save("pic.jpg")
print("Your screenshot is at https://content.biomooping.tk/" + post("yourlink/save",data=b64encode(open("pic.jpg","rb").read()),headers={"extension":splitext("./pic.jpg")[1]}).text)
remove("pic.jpg")
elif "f" in a or "F" in choices:
path = input("Your file path\n")
print("Your file is at is at https://content.biomooping.tk/" + post("yourlink/save",data=b64encode(open(path,"rb").read()),headers={"extension":splitext(path)[1]}).text)
elif choices.startswith("ct") or choices.startswith("CT"):
from clipboard import paste
print("Your file is at is at https://content.biomooping.tk/" + post("yourlink/save",data=b64encode(paste()),headers={"extension":"txt"}).text)
elif choices.startswith("T") or choices.startswith("t"):
print("Your file is at is at https://content.biomooping.tk/" + post("yourlink/save",data=b64encode(bytes(input("Text\n\a"),encoding="utf-8")),headers={"extension":"txt"}).text)
elif "q" in a or "Q" in choices:
exit("See you next time!")
else:
continue