mardi 27 octobre 2020

Building a secure web server to test dynamic .txt file for blocked ip's

I am attempting to test out an at home build for hosting an internal web server that will get a dynamic txt file uploaded to then be pulled down to my firewall for blocklists. I know this can be done with various alternatives already built but, i want to learn this on my own.

Concept: Build simple webserver with secure access via python using ssl. Send file from local linux box to web server daily have firewall pointed at my server web link to pull list daily

Any help is appreciated.

Current pieces of code:

from flask import Flask
app = Flask(__name__)

@app.route("/var/tmp/somefile.txt")
def test():
    return "/var/tmp/somefile.txt"

if __name__ == "__main__":
    app.run(ssl_context=('cert.pem', 'key.pem'))


'#SFTP to web server from linux box
import pysftp

with pysftp.Connection('host', username='test', password='password') as sftp:

    with pysftp.cd('/var/tmp'):
        'sftp.put('/test.txt')
print 'sftp.put' , "was uploaded"



Aucun commentaire:

Enregistrer un commentaire