]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Some cosmetics around the scripts/util/pcap2decode-proto.py (#4260)
authorJorge Pereira <jpereira@users.noreply.github.com>
Tue, 19 Oct 2021 14:41:19 +0000 (11:41 -0300)
committerGitHub <noreply@github.com>
Tue, 19 Oct 2021 14:41:19 +0000 (10:41 -0400)
scripts/util/pcap2decode-proto.py

index fd1afca0234b9f55585138bded7b548d9b0b7480..c9f2aa32e3af12122f7936a2c01e4e38f69bc6a9 100755 (executable)
@@ -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