Flask App to list file and metadata for each file
Budget: $10 – $30 USD
I am tiny flask app which can serve certificate file and also display metadata of the cert file (cert expiry)
Already have following code for serving the files
```
from flask import Flask
from flask_autoindex import AutoIndex
app = Flask(__name__)
files_dir = "files"
app = Flask(__name__)
AutoIndex(app, browse_root=files_dir)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
```
Extracting certificate expiry
```
from datetime import datetime
from OpenSSL import crypto as c
f = open("/flask/files/client.crt", "r")
cert = c.load_certificate(c.FILETYPE_PEM, f.read())
datetime.strptime(cert.get_notAfter().decode("utf-8"),"%Y%m%d%H%M%SZ").strftime("%Y-%m-%d-%H:%M:%S")
```
Need someone to help me in combining it together.
Already have following code for serving the files
```
from flask import Flask
from flask_autoindex import AutoIndex
app = Flask(__name__)
files_dir = "files"
app = Flask(__name__)
AutoIndex(app, browse_root=files_dir)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
```
Extracting certificate expiry
```
from datetime import datetime
from OpenSSL import crypto as c
f = open("/flask/files/client.crt", "r")
cert = c.load_certificate(c.FILETYPE_PEM, f.read())
datetime.strptime(cert.get_notAfter().decode("utf-8"),"%Y%m%d%H%M%SZ").strftime("%Y-%m-%d-%H:%M:%S")
```
Need someone to help me in combining it together.