@@ -60,6 +60,7 @@ class FindUrl_Action implements ActionListener {
6060 public BurpExtender burp ;
6161 public static final String [] blackHostList = {"www.w3.org" , "ns.adobe.com" , "iptc.org" , "openoffice.org"
6262 , "schemas.microsoft.com" , "schemas.openxmlformats.org" , "sheetjs.openxmlformats.org" };
63+ private static Proxy proxy ;
6364
6465 public FindUrl_Action (BurpExtender burp , IContextMenuInvocation invocation ) {
6566 this .burp = burp ;
@@ -74,8 +75,8 @@ public FindUrl_Action(BurpExtender burp, IContextMenuInvocation invocation) {
7475 public void actionPerformed (ActionEvent event ) {
7576 Runnable requestRunner = new Runnable () {
7677 String siteBaseUrl = null ;
77- Set <String > baseUrls = new HashSet <String >();
78- List <String > urls = new ArrayList <String >();
78+ Set <String > baseUrls = new HashSet <>();
79+ List <String > urls = new ArrayList <>();
7980
8081 @ Override
8182 public void run () {
@@ -85,7 +86,7 @@ public void run() {
8586 return ;
8687 }
8788
88- BlockingQueue <RequestTask > inputQueue = new LinkedBlockingQueue <RequestTask >();
89+ BlockingQueue <RequestTask > inputQueue = new LinkedBlockingQueue <>();
8990
9091 try {
9192 findUrls (messages [0 ]);
@@ -129,7 +130,7 @@ public void run() {
129130
130131 /**
131132 * 根据当前web的baseUrl找JS,特征就是referer以它开头
132- * @param currentBaseUrl
133+ * @param message
133134 * @return
134135 */
135136 public void findUrls (IHttpRequestResponse message ) {
@@ -139,31 +140,31 @@ public void findUrls(IHttpRequestResponse message) {
139140 String current_fullUrl = getter .getFullURL (message ).toString ();
140141
141142 if (current_referUrl != null ) {
143+ //认为当前数据包是前端触发的
142144 baseUrls .add (current_referUrl );
143- }
144- baseUrls .add (current_fullUrl );
145-
146- if (current_fullUrl != null ) {
147145 siteBaseUrl = UrlUtils .getBaseUrl (current_referUrl );
148- }
149- if (siteBaseUrl == null ) {
146+ } else {
147+ //认为其是当前数据包是浏览器地址栏访问直接触发的
148+ baseUrls .add (current_fullUrl );
150149 siteBaseUrl = UrlUtils .getBaseUrl (current_fullUrl );
151150 }
152151
153152
154153 IHttpRequestResponse [] messages = BurpExtender .getCallbacks ().getSiteMap (null );
155154 for (IHttpRequestResponse item : messages ) {
156- int code = getter .getStatusCode (item );
157155 URL url = getter .getFullURL (item );
158- String referUrl = getter .getHeaderValueOf (true , item , "Referer" );
159- if (referUrl == null || url == null || code <= 0 ) {
156+ if (url == null || (!url .toString ().toLowerCase ().endsWith (".js" ) && !url .toString ().toLowerCase ().endsWith (".js.map" ))) {
160157 continue ;
161158 }
162- if (!url .toString ().toLowerCase ().endsWith (".js" )) {
159+
160+ int code = getter .getStatusCode (item );
161+ String referUrl = getter .getHeaderValueOf (true , item , "Referer" );
162+ if (referUrl == null || code <= 0 ) {
163163 continue ;
164164 }
165- if (referUrl .toLowerCase ().startsWith (siteBaseUrl .toLowerCase () + "/" )) {
166- byte [] respBody = getter .getBody (false , item );
165+
166+ if (referUrl .toLowerCase ().startsWith (siteBaseUrl .toLowerCase ())) {
167+ byte [] respBody = HelperPlus .getBody (false , item );
167168 String body = new String (respBody );
168169 urls .addAll (UrlUtils .grepUrls (body ));
169170 baseUrls .addAll (findPossibleBaseURL (urls ));
@@ -182,7 +183,9 @@ public void findUrls(IHttpRequestResponse message) {
182183 * @param inputQueue
183184 */
184185 public void doRequest (BlockingQueue <RequestTask > inputQueue , String referUrl ) {
185- Proxy proxy = Proxy .inputProxy ();
186+ if (proxy == null ) {
187+ proxy = Proxy .inputProxy ();
188+ }
186189 if (proxy == null ) {
187190 return ;
188191 }
@@ -199,7 +202,7 @@ public void doRequest(BlockingQueue<RequestTask> inputQueue, String referUrl) {
199202 * 根据已有的域名梳理,预估应该使用的线程数
200203 * 假设1个任务需要1秒钟。线程数在1-100之间,如何选择线程数使用最小的时间?
201204 *
202- * @param domains
205+ * @param domainNum
203206 * @return
204207 */
205208 public static int threadNumberShouldUse (int domainNum ) {
@@ -215,7 +218,7 @@ public static int threadNumberShouldUse(int domainNum) {
215218 }
216219
217220 public static Set <String > findPossibleBaseURL (List <String > urls ) {
218- Set <String > baseURLs = new HashSet <String >();
221+ Set <String > baseURLs = new HashSet <>();
219222 for (String tmpurl : urls ) {
220223 //这部分提取的是含有协议头的完整URL地址
221224 if (tmpurl .toLowerCase ().startsWith ("http://" )
0 commit comments