From: Jorge Pereira Date: Tue, 19 Oct 2021 14:41:19 +0000 (-0300) Subject: Some cosmetics around the scripts/util/pcap2decode-proto.py (#4260) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65ddee8c0303eccc5d447f9a7a5c9b75a5fc494c;p=thirdparty%2Ffreeradius-server.git Some cosmetics around the scripts/util/pcap2decode-proto.py (#4260) --- diff --git a/scripts/util/pcap2decode-proto.py b/scripts/util/pcap2decode-proto.py index fd1afca0234..c9f2aa32e3a 100755 --- a/scripts/util/pcap2decode-proto.py +++ b/scripts/util/pcap2decode-proto.py @@ -100,6 +100,11 @@ def load_args(): help="Perform the lookup adding the 'encode-proto attrs' and 'decode_proto -'", action="store_true", ) + parser.add_argument( + "-s", + dest="source", + help="Source of .pcap file. just to comment.'" + ) return parser.parse_args() @@ -112,7 +117,10 @@ def _main(): print("# -*- text -*-") print("# ATTENTION: It was generated automatically, be careful! :)") - print("# Based on {}".format(os.path.basename(args.pcap_file))) + if args.source: + print("# Based on {}".format(args.source)) + else: + print("# Based on {}".format(os.path.basename(args.pcap_file))) print("#") print("") print("proto {}".format(args.decode_proto)) @@ -145,7 +153,7 @@ def _main(): # lookup the attrs from the payload attrs = unit_lookup_payload2attrs(args.decode_proto, payload) if not attrs: - raise Exception("Error", "Problems to convert the payload to attrs") + raise Exception("Error", "Problems to convert the payload to attrs for: -p {} -f {}".format(args.decode_proto, args.pcap_file)) if args.both: count_mat += 4