From ff794033e144b01899ee8e55fa9dcb93465b31b7 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Thu, 13 Jun 2024 16:56:06 +0800 Subject: [PATCH] Finished Traceroute --- src/dashboard_new.py | 37 +++++ .../app/src/components/configurationList.vue | 3 +- src/static/app/src/components/navbar.vue | 6 +- src/static/app/src/router/index.js | 6 + src/static/app/src/views/ping.vue | 2 +- src/static/app/src/views/traceroute.vue | 136 ++++++++++++++++++ 6 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 src/static/app/src/views/traceroute.vue diff --git a/src/dashboard_new.py b/src/dashboard_new.py index 4ca58a6..0cc40f9 100644 --- a/src/dashboard_new.py +++ b/src/dashboard_new.py @@ -1346,6 +1346,43 @@ def API_ping_execute(): return ResponseObject(False, "Please provide ipAddress and count") +@app.route('/api/traceroute/execute') +def API_traceroute_execute(): + if "ipAddress" in request.args.keys() and len(request.args.get("ipAddress")) > 0: + ipAddress = request.args.get('ipAddress') + try: + tracerouteResult = traceroute(ipAddress) + result = [] + for hop in tracerouteResult: + if len(result) > 1: + skipped = False + for i in range(result[-1]["hop"] + 1, hop.distance): + result.append( + { + "hop": i, + "ip": "*", + "avg_rtt": "*", + "min_rtt": "*", + "max_rtt": "*" + } + ) + skip = True + if skipped: continue + result.append( + { + "hop": hop.distance, + "ip": hop.address, + "avg_rtt": hop.avg_rtt, + "min_rtt": hop.min_rtt, + "max_rtt": hop.max_rtt + }) + return ResponseObject(data=result) + except Exception as exp: + return ResponseObject(False, exp) + else: + return ResponseObject(False, "Please provide ipAddress") + + ''' Sign Up ''' diff --git a/src/static/app/src/components/configurationList.vue b/src/static/app/src/components/configurationList.vue index 27841eb..eb50577 100644 --- a/src/static/app/src/components/configurationList.vue +++ b/src/static/app/src/components/configurationList.vue @@ -30,8 +30,9 @@ export default {

WireGuard Configurations

+ Configuration - +
diff --git a/src/static/app/src/components/navbar.vue b/src/static/app/src/components/navbar.vue index 56f3f19..084ee40 100644 --- a/src/static/app/src/components/navbar.vue +++ b/src/static/app/src/components/navbar.vue @@ -44,8 +44,10 @@ export default {