Skip to content

Commit

Permalink
add user agent check
Browse files Browse the repository at this point in the history
  • Loading branch information
CrapsDorian authored and mux99 committed Apr 17, 2024
1 parent 2523994 commit 1593a16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flask_app/app.py
Expand Up @@ -17,6 +17,7 @@ def mptcp_status_page():

addr = request.remote_addr
port = request.environ.get('REMOTE_PORT')
user = request.environ.get('HTTP_USER_AGENT')

try:
conn = check_output(["ss", "-MnH", "dst", f"{addr}", "dport", f"{port}"]).decode("ascii")
Expand All @@ -30,6 +31,9 @@ def mptcp_status_page():
state_message = '[error: ' + str(e) + ']'
state_class = 'error'

if user.startswith("curl"):
return "You " + state_message + " using MPTCP.\n"

return render_template('index.html', state_message=state_message, state_class=state_class)

@app.route('/stream_audio')
Expand Down

0 comments on commit 1593a16

Please sign in to comment.