MCPcopy Index your code
hub / github.com/API-Security/APIKit / getUrlWithPath

Method getUrlWithPath

src/main/java/burp/utils/CommonUtils.java:19–37  ·  view source on GitHub ↗

获取当前第一级路径的 URL, 比如访问/xxx/xxx/aaa 返回的是/xxx

(URL url)

Source from the content-addressed store, hash-verified

17 * 获取当前第一级路径的 URL, 比如访问/xxx/xxx/aaa 返回的是/xxx
18 */
19 public static String getUrlWithPath(URL url) {
20
21 String urlRootPath = getUrlRootPath(url);
22 try {
23 URL tmpurl = new URL(getUrlWithoutFilename(url));
24 String path = tmpurl.getPath();
25 while (path.startsWith("/")) {
26 path = path.substring(1);
27 }
28 if (path.isEmpty()) {
29 return urlRootPath;
30 } else {
31 return urlRootPath + "/" + path.substring(0, path.indexOf("/"));
32 }
33 } catch (MalformedURLException e) {
34 BurpExtender.getStderr().println(CommonUtils.exceptionToString(e));
35 return urlRootPath;
36 }
37 }
38
39 /**
40 * 获取根目录的 URL

Callers 4

isFingerprintMatchMethod · 0.95
isFingerprintMatchMethod · 0.95
isFingerprintMatchMethod · 0.95
isFingerprintMatchMethod · 0.95

Calls 4

getUrlRootPathMethod · 0.95
getUrlWithoutFilenameMethod · 0.95
getStderrMethod · 0.95
exceptionToStringMethod · 0.95

Tested by

no test coverage detected