added a very simple receiver that can handle POST requests similar to 0x0

This commit is contained in:
kageru 2017-10-17 15:26:00 +02:00
parent 840e0e767b
commit 5c9efaadb4
2 changed files with 20 additions and 0 deletions

View File

@ -3,6 +3,7 @@ A very simple python script that aims to replace the most basic functionalities
This wouldn't be necessary if ShareX had just been developed as a cross-platform project, but I digress. This wouldn't be necessary if ShareX had just been developed as a cross-platform project, but I digress.
Needless to say, this is being developed for and tested on Linux. If you're on Windows, just use ShareX.\ Needless to say, this is being developed for and tested on Linux. If you're on Windows, just use ShareX.\
Only (s)ftp uploads for now, but I might add simple curl commands (like used by 0x0) later on. Only (s)ftp uploads for now, but I might add simple curl commands (like used by 0x0) later on.
I should add that the focus will be on a self-hosted server. If you don't care about that, just `curl` 0x0.st or something.
#### What works: #### What works:
- Taking area screenshots - Taking area screenshots
- Uploading screenshots to (s)ftp - Uploading screenshots to (s)ftp

19
pyshare-receiver.py Normal file
View File

@ -0,0 +1,19 @@
# this file can be run on a server to act as the endpoint of the script.
# I mainly want to test whether this is faster than sftp
from flask import Flask, request
from werkzeug.utils import secure_filename
app = Flask(__name__)
@app.route('/', methods=['POST'])
def receive_file() -> tuple:
if 'file' in request.files:
file = request.files.get('file')
filename = secure_filename(file.filename)
file.save(filename)
return filename, 201
return 'you\'re doing this wrong', 418
if __name__ == "__main__":
app.run(ssl_context='adhoc')