<s> from burp import IBurpExtender <EOL> from burp import IHttpListener <EOL> from burp import IProxyListener <EOL> import os <EOL> import re <EOL> urls_in_scope = [ '<STR_LIT>' ] <EOL> download_path = '<STR_LIT>' <EOL> module_folder = os . path . dirname ( '<STR_LIT>' ) <EOL> sys . path . insert ( <NUM_LIT:0> , module_folder ) <EOL> import webcommon <EOL> class BurpExtender ( IBurpExtender , IHttpListener , IProxyListener ) : <EOL> def registerExtenderCallbacks ( self , callbacks ) : <EOL> self . _helpers = callbacks . getHelpers ( ) <EOL> callbacks . setExtensionName ( "<STR_LIT>" ) <EOL> callbacks . registerHttpListener ( self ) <EOL> callbacks . registerProxyListener ( self ) <EOL> def processProxyMessage ( self , messageIsRequest , message ) : <EOL> BurpExtender . download_all_JS_files ( self , messageIsRequest , message ) <EOL> def download_all_JS_files ( self , messageIsRequest , message ) : <EOL> request_byte_array = message . getMessageInfo ( ) . getRequest ( ) <EOL> if messageIsRequest : <EOL> request_http_service = message . getMessageInfo ( ) . getHttpService ( ) <EOL> request_byte_array = message . getMessageInfo ( ) . getRequest ( ) <EOL> request_object = self . _helpers . analyzeRequest ( request_http_service , request_byte_array ) <EOL> hostname = webcommon . get_host_header_from_request ( self , request_object ) <EOL> if hostname and hostname [ <NUM_LIT:1> ] in urls_in_scope : <EOL> request_url = request_object . getUrl ( ) <EOL> if str ( request_url ) . endswith ( '<STR_LIT>' ) : <EOL> print request_url <EOL> os . chdir ( download_path ) <EOL> os . system ( "<STR_LIT>" + str ( request_url ) ) </s>
