From d1f42051b0eef23275c9497e7888a9badfe2ee51 Mon Sep 17 00:00:00 2001 From: Rajat Khandelwal Date: Fri, 1 Mar 2013 13:42:15 +0530 Subject: [PATCH 1/2] output now compatible with harviewer --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 64b3bf6..8d751f3 100755 --- a/main.py +++ b/main.py @@ -71,7 +71,9 @@ #write the HAR file with open(outputfile, 'w') as f: + f.write("onInputData(") json.dump(session, f, cls=har.JsonReprEncoder, indent=2, encoding='utf8', sort_keys=True) + f.write(");") if options.resource_usage: print_rusage() From 71391ca1829091343d5fa72cf62257becdc2b92a Mon Sep 17 00:00:00 2001 From: Rajat Khandelwal Date: Mon, 11 Mar 2013 18:07:39 +0530 Subject: [PATCH 2/2] jsonp function name configurable --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8d751f3..caaf806 100755 --- a/main.py +++ b/main.py @@ -37,6 +37,8 @@ parser.add_option('--strict-http-parsing', action='store_true', dest='strict_http_parsing', default=False) parser.add_option('-l', '--log', dest='logfile', default='pcap2har.log') +parser.add_option('-j', '--jsonp', metavar="JSONP-FUNCTION-NAME", + dest='jsonp_function_name', action='store') options, args = parser.parse_args() # copy options to settings module @@ -71,9 +73,11 @@ #write the HAR file with open(outputfile, 'w') as f: - f.write("onInputData(") + if options.jsonp_function_name: + f.write("%s(" % options.jsonp_function_name) json.dump(session, f, cls=har.JsonReprEncoder, indent=2, encoding='utf8', sort_keys=True) - f.write(");") + if options.jsonp_function_name: + f.write(");") if options.resource_usage: print_rusage()