-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (26 loc) · 826 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (26 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from flask import Flask, request, render_template
from time import time
app = Flask(__name__)
def convertToBinary(int):
num = bin(int).replace("0b", "")
if len(num) < 8:
ext = "0" *(8 - len(num))
num = ext + num
return num.replace('1','▀').replace('0','▄')
@app.route('/tweet', methods=['POST'])
def tweet():
ip = request.remote_addr
with open("tweet.log", "a") as f:
f.write(f"{ip} - {time()}\n")
return "200 OK"
@app.route('/')
def index():
ip = request.remote_addr
code=[]
for i in ip.split('.'):
code.append(convertToBinary(int(i)))
with open("http.log", "a") as f:
f.write(f"{ip} - {time()}\n")
return render_template("index.html", code=code, host="uniqcodez.vercel.app")
if __name__ = "__main__":
app.run(debug=True)