---
# System prepended metadata

title: local flag

---

---
title: local flag
---

# flag server
```python=
from flask import Flask, request, jsonify
import hashlib
import time
def hash(data):
    m = hashlib.md5()
    m.update(data.encode('utf-8'))
    return m.hexdigest()


def get_start_time():
    t = open("start_time.txt",'r')
    start_time = t.readline()
    t.close()
    return start_time

app = Flask(__name__)
try:
    start_time = get_start_time()
except:
    t = open("start_time.txt",'w')
    t.write(str(time.time()))
    t.close()
    start_time = get_start_time()


@app.route("/get_flag",methods=['POST'])
def get_flag():
    if request.method == 'POST':
        ip = request.remote_addr
        flag = hash(ip + str((time.time() - float(start_time))//(30*60)) + "OQGKJ")
        return flag
app.run(port=8080,debug=True)
```

# flag.exe
```python=
import requests
import  time
r = requests.post("http://127.0.0.1:8080/get_flag")
t = open("flag_{}.txt".format(time.time()),'w')
t.write(r.text)
t.close()
```