1414# @TODO: args parser for: -c (comments) -s (links/src), -j (JavaScript)
1515
1616# find interesting string(s)
17- def analyze_line (_line , i ):
17+ def analyze_line (_line , i , include_comments ):
1818 """single HTML source line - code analyze"""
19- modules .detection_engine .detect_comments (_line , i )
19+ if include_comments == True :
20+ modules .detection_engine .detect_comments (_line , i )
21+
2022 modules .detection_engine .detect_admin_stuff (_line , i )
2123 modules .detection_engine .detect_debug (_line , i )
2224 modules .detection_engine .detect_external_resources (_line , i )
2325 modules .detection_engine .detect_javascript (_line , i )
2426 modules .detection_engine .detect_dombased_xss (_line , i )
2527
2628
27- def main (_filename ):
29+ def main (_filename , args ):
2830 """main program loop"""
2931 _ident = ""
3032 _fw = ""
3133
34+ # include comments?
35+ include_comments = True if args .c else False
36+
3237 try :
3338 _file = open (_filename , "r" )
3439 print "[+] {} opened, starting analysis...\n \n " .format (_filename )
@@ -42,7 +47,7 @@ def main(_filename):
4247
4348 for _line in _file :
4449 i += 1
45- analyze_line (_line , i )
50+ analyze_line (_line , i , include_comments )
4651 if _ident == "" :
4752 _ident = modules .detection_engine .identify (_line )
4853 if _fw == "" :
@@ -58,6 +63,9 @@ def main(_filename):
5863 parser .add_argument (
5964 '-u' , help = 'Target url - index.html will be downloaded' )
6065 parser .add_argument ('-f' , help = 'HTML file name to analyze' )
66+ parser .add_argument (
67+ '-c' , help = 'include comments in summary (excluded by default)' )
68+
6169 _filename = "index.html"
6270 args = parser .parse_args ()
6371
@@ -68,4 +76,4 @@ def main(_filename):
6876 if args .f and not args .u :
6977 _filename = args .f
7078
71- main (_filename )
79+ main (_filename , args )
0 commit comments