From 134eb1bb42795263d7601377012b511450d9ba4e Mon Sep 17 00:00:00 2001 From: xhdix Date: Sun, 6 Mar 2022 04:08:21 +0300 Subject: [PATCH 1/3] add trace options --- tracevis.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tracevis.py b/tracevis.py index f4d0240..2a3682f 100755 --- a/tracevis.py +++ b/tracevis.py @@ -62,9 +62,13 @@ def get_args(): parser.add_argument('--annot2', type=str, help="annotation for the second packets (dns and packet trace)") parser.add_argument('--rexmit', action='store_true', - help="change the behavior of the trace route to be similar to doing retransmission. (only one packet, and all steps, same stream)") - parser.add_argument('--rexmit2', action='store_true', - help="change the behavior of the trace route to be similar to doing retransmission. (each step, different stream)") + help="same as rexmit option (only one packet. all TTL steps, same stream)") + parser.add_argument('-o', '--options', type=str, default="new", + help="change the behavior of the trace route" + + " - 'rexmit' : to be similar to doing retransmission with incremental TTL (only one packet, one destination)" + + " - 'new' : to change source port, sequence number, etc in each request (default)" + + " - 'new,rexmit' : to beging with option 'new' on each of three steps for all destinations and then rexmit" + ) args = parser.parse_args() return args @@ -117,8 +121,14 @@ def main(args): edge_lable = args["label"].lower() if args.get("rexmit"): trace_retransmission = True - if args.get("rexmit2"): - trace_with_retransmission = True + if args.get("options"): + trace_options= args["ips"].replace(' ', '').split(',') + if "new" in trace_options and "rexmit" in trace_options: + trace_with_retransmission = True + elif "rexmit" in trace_options: + trace_retransmission = True + else: + pass # "new" is default if args.get("dns") or args.get("dnstcp"): do_traceroute = True name_prefix += "dns" @@ -127,7 +137,7 @@ def main(args): dns_over_tcp=(args["dnstcp"])) if len(request_ips) == 0: request_ips = DEFAULT_REQUEST_IPS - if args.get("packet"): + if args.get("packet") or args.get("rexmit"): do_traceroute = True name_prefix += "packet" packet_1, packet_2, do_tcph1, do_tcph2 = utils.packet_input.copy_input_packets( @@ -135,7 +145,7 @@ def main(args): if do_tcph1 or do_tcph2: name_prefix += "-tcph" if trace_with_retransmission: - name_prefix += "-rexmit2" + name_prefix += "-newrexmit" if do_traceroute: was_successful, measurement_path = utils.trace.trace_route( ip_list=request_ips, request_packet_1=packet_1, output_dir=output_dir, From 901b176ca0e0798827eeb8e57c38c9fa1f76087c Mon Sep 17 00:00:00 2001 From: xhdix Date: Sun, 6 Mar 2022 04:18:54 +0300 Subject: [PATCH 2/3] correction --- tracevis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracevis.py b/tracevis.py index 2a3682f..c0ca87c 100755 --- a/tracevis.py +++ b/tracevis.py @@ -67,7 +67,7 @@ def get_args(): help="change the behavior of the trace route" + " - 'rexmit' : to be similar to doing retransmission with incremental TTL (only one packet, one destination)" + " - 'new' : to change source port, sequence number, etc in each request (default)" - + " - 'new,rexmit' : to beging with option 'new' on each of three steps for all destinations and then rexmit" + + " - 'new,rexmit' : to begin with the 'new' option in each of the three steps for all destinations and then rexmit" ) args = parser.parse_args() return args From ac3bdea98ed253c1c859ddc19023473952f5e06d Mon Sep 17 00:00:00 2001 From: xhdix Date: Sun, 6 Mar 2022 04:27:25 +0300 Subject: [PATCH 3/3] =?UTF-8?q?fix=20(=E2=80=A2=5F=E2=80=A2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tracevis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracevis.py b/tracevis.py index c0ca87c..af83fba 100755 --- a/tracevis.py +++ b/tracevis.py @@ -122,7 +122,7 @@ def main(args): if args.get("rexmit"): trace_retransmission = True if args.get("options"): - trace_options= args["ips"].replace(' ', '').split(',') + trace_options= args["options"].replace(' ', '').split(',') if "new" in trace_options and "rexmit" in trace_options: trace_with_retransmission = True elif "rexmit" in trace_options: