diff --git a/src/base/FindUrlAction.java b/src/base/FindUrlAction.java index 89afd38..050eb99 100644 --- a/src/base/FindUrlAction.java +++ b/src/base/FindUrlAction.java @@ -48,25 +48,25 @@ public class FindUrlAction implements ActionListener { + "sheetjs.openxmlformats.org\r\n" + "www.w3.org"); - public static final List blackPath = TextUtils.textToLines("application/zip\r\n" - + "application/x-www-form-urlencoded\r\n" + public static final List blackPath = TextUtils.textToLines("application/json\r\n" + + "application/octet-stream\r\n" + + "application/pdf\r\n" + + "application/vnd.\r\n" + "application/x-mso\r\n" + + "application/x-www-form-urlencoded\r\n" + "application/xml\r\n" - + "application/vnd.\r\n" - + "application/pdf\r\n" - + "application/octet-stream\r\n" - + "application/json\r\n" - + "text/css\r\n" - + "text/html\r\n" - + "text/plain\r\n" + + "application/zip\r\n" + + "image/bmp\r\n" + + "image/gif\r\n" + + "image/jpeg\r\n" + "image/pdf\r\n" - + "image/x-wmf\r\n" - + "image/x-emf\r\n" - + "image/tiff\r\n" + "image/png\r\n" - + "image/jpeg\r\n" - + "image/gif\r\n" - + "image/bmp"); + + "image/tiff\r\n" + + "image/x-\r\n" + + "text/css\r\n" + + "text/html\r\n" + + "text/javascript\r\n" + + "text/plain"); public static Proxy CurrentProxy; @@ -83,16 +83,23 @@ public static List buildUrls(String baseurl, List urlPath){ List result = new ArrayList<>(); for (String url : urlPath) { - if (!url.startsWith("http://") && !url.startsWith("https://")) { - if (url.startsWith("/")) { - url = url.replaceFirst("/", ""); - } - if (url.startsWith("./")) { - url = url.replaceFirst("\\./", ""); - } - url = baseurl + url; //baseurl统一以“/”结尾;url统一删除“/”的开头 + if (StringUtils.isBlank(baseurl)) { + continue; + } + url = url.toLowerCase(); + if (url.startsWith("http://") || url.startsWith("https://")) { result.add(url); + continue; + } + + if (url.startsWith("/")) { + url = url.replaceFirst("/", ""); + } + if (url.startsWith("./")) { + url = url.replaceFirst("\\./", ""); } + url = baseurl + url; //baseurl统一以“/”结尾;url统一删除“/”的开头 + result.add(url); } return result; } diff --git a/src/base/blackPath.txt b/src/base/blackPath.txt index 1e61249..7e77df3 100644 --- a/src/base/blackPath.txt +++ b/src/base/blackPath.txt @@ -1,19 +1,19 @@ -application/zip -application/x-www-form-urlencoded +application/json +application/octet-stream +application/pdf +application/vnd. application/x-mso +application/x-www-form-urlencoded application/xml -application/vnd. -application/pdf -application/octet-stream -application/json -text/css -text/html -text/plain +application/zip +image/bmp +image/gif +image/jpeg image/pdf -image/x-wmf -image/x-emf -image/tiff image/png -image/jpeg -image/gif -image/bmp \ No newline at end of file +image/tiff +image/x- +text/css +text/html +text/javascript +text/plain \ No newline at end of file diff --git a/src/messageTab/Info/InfoTable.java b/src/messageTab/Info/InfoTable.java index a931080..b15f934 100644 --- a/src/messageTab/Info/InfoTable.java +++ b/src/messageTab/Info/InfoTable.java @@ -201,13 +201,31 @@ public void doRequestUrl(List urlsToRequest) { } public void doOpenUrlInBrowser(List urlsToRequest) { - String targetBaseUrl = getOrFindBaseUrl(); - List full_urls = FindUrlAction.buildUrls(targetBaseUrl, urlsToRequest); + List full_urls; + if (needBaseUrl(urlsToRequest)) { + String targetBaseUrl = getOrFindBaseUrl(); + full_urls = FindUrlAction.buildUrls(targetBaseUrl, urlsToRequest); + }else { + full_urls = urlsToRequest; + } + String browserPath = BurpExtender.getConfigTableModel().getConfigValueByKey("browserPath"); for (String url:full_urls) { SystemUtils.browserOpen(url, browserPath); } } + + public boolean needBaseUrl(List urlsToRequest) { + + for (String urlOrPath:urlsToRequest) { + if (StringUtils.isNotBlank(urlOrPath)) { + if (!urlOrPath.toLowerCase().startsWith("http://") && !urlOrPath.toLowerCase().startsWith("https://")) { + return true; + } + } + } + return false; + } public List getSelectedUrls() { int[] rows = this.getSelectedRows();