[
  {
    "path": ".gitignore",
    "content": "/out/\n/target\n/.idea\n/*.iml\ndependency-reduced-pom.xml"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# SpringSpider\n\n该工具为被动扫描Spring Actuator端点的BurpSuite插件，用于解决多层级目录下隐藏的Actuator端点、或端点需要Bypass才能访问的情况下的漏报问题。\n\n## 安装方法\n\n导航至BurpSuite的`Extender->Extensions`界面，点击`Add`按钮，在弹出的窗口中点击`Select file ...`按钮，在文件打开页面中找到插件的jar文件，安装即可。\n\n## 使用\n\n该插件安装完成后，将无需特殊设置，自动启用被动扫描，扫描发现的端点将会生成漏洞条目出现在BurpSuite首页的`Issue activity`中。另外，若要优化扫描过程中的参数，则需要根据需要，修改插件设置，插件设置位于BurpSuite的SpringSpider选项卡。\n\n本插件具有如下设置项：\n\n#### Enable\n\n该复选框为修改该插件的启用状态，当该复选框选中时插件才会执行被动扫描。当取消选中时，插件将不会再接受新的扫描任务，在当前正在执行的扫描任务结束后将会停止扫描。\n\n#### Dir Scan Deeper\n\n该设置项为修改插件的目录扫描深度，设置范围为`1~∞`，默认建议值为`3`，假设当前目录扫描深度设置为`3`，在用户访问目标「`http://test.com/backend/api/admin/user/`」时，将会拆分为「`http://test.com/`」、「`http://test.com/backend/`」、「`http://test.com/backend/api/`」分别扫描，该参数请尽量控制在1~5以内，以避免产生过大的请求流量。\n\n#### Use Bypass\n\n该设置项为修改启用的Bypass字符列表，默认启用`;`、`.`，当正常请求无果后，将会尝试在路径中插入Bypass字符尝试进行绕过，例如在启用`;`字符后，对「`http://test.com/api/actuator/env`」的绕过URL则是「`http://test.com/api/;/actuator/;/env`」\n\n#### Scan Point\n\n该设置项为修改启动扫描的端点，为了避免请求频率过大，目前支持启用的端点有「/actuator/env」、「/actuator」、「/env」，建议全部启用。\n\n# 鸣谢\n插件中部分代码借鉴于以下项目\n\nhttps://github.com/sting8k/BurpSuite_403Bypasser\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <groupId>cn.wanghw</groupId>\n    <artifactId>SpringSpider</artifactId>\n    <version>1.0-SNAPSHOT</version>\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-shade-plugin</artifactId>\n                <executions>\n                    <execution>\n                        <phase>package</phase>\n                        <goals>\n                            <goal>shade</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-compiler-plugin</artifactId>\n                <configuration>\n                    <source>8</source>\n                    <target>8</target>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n    <dependencies>\n        <!-- https://mvnrepository.com/artifact/net.portswigger.burp.extender/burp-extender-api -->\n        <dependency>\n            <groupId>net.portswigger.burp.extender</groupId>\n            <artifactId>burp-extender-api</artifactId>\n            <version>1.7.22</version>\n        </dependency>\n        <!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->\n        <dependency>\n            <groupId>com.jayway.jsonpath</groupId>\n            <artifactId>json-path</artifactId>\n            <version>2.7.0</version>\n        </dependency>\n        <!-- https://mvnrepository.com/artifact/net.jodah/expiringmap -->\n        <dependency>\n            <groupId>net.jodah</groupId>\n            <artifactId>expiringmap</artifactId>\n            <version>0.5.10</version>\n        </dependency>\n    </dependencies>\n</project>"
  },
  {
    "path": "src/main/java/burp/BurpExtender.java",
    "content": "package burp;\n\nimport burp.scanner.SpringScanner;\nimport burp.ui.UIHandler;\nimport burp.utils.Utils;\n\nimport java.io.FileNotFoundException;\nimport java.io.FileWriter;\nimport java.io.PrintWriter;\n\npublic class BurpExtender implements IBurpExtender, IExtensionStateListener {\n\n    public IExtensionHelpers helpers;\n    public IBurpExtenderCallbacks callbacks;\n    public PrintWriter stdout;\n    public PrintWriter stderr;\n    public String version = \"1.0\";\n    public UIHandler uiHandler;\n    public SpringScanner scanner;\n\n    @Override\n    public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {\n        Utils.Callback = this.callbacks = callbacks;\n        Utils.Helpers = this.helpers = callbacks.getHelpers();\n        this.stdout = new PrintWriter(callbacks.getStdout(), true);\n        this.stderr = new PrintWriter(callbacks.getStderr(), true);\n        callbacks.setExtensionName(\"SpringSpider\");\n        this.stdout.println(\"SpringSpider v\" + version);\n        this.stdout.println(\"Author: whwlsfb\");\n        this.stdout.println(\"Github: https://github.com/whwlsfb/SpringSpider\");\n        this.uiHandler = new UIHandler(this);\n        callbacks.addSuiteTab(this.uiHandler);\n        scanner = new SpringScanner();\n        callbacks.registerScannerCheck(scanner);\n        callbacks.registerExtensionStateListener(this);\n    }\n\n    @Override\n    public void extensionUnloaded() {\n    }\n\n}\n"
  },
  {
    "path": "src/main/java/burp/Issue.java",
    "content": "package burp;\n\nimport java.net.URL;\n\npublic class Issue implements IScanIssue {\n\n    private IHttpService httpService;\n    private URL url;\n    private IHttpRequestResponse[] httpMessages;\n    private String name;\n    private String detail;\n    private String severity;\n    private boolean isCertain;\n\n\n    public Issue(\n            IHttpService httpService,\n            URL url,\n            IHttpRequestResponse[] httpMessages,\n            String name,\n            String detail,\n            String severity) {\n        this.httpService = httpService;\n        this.url = url;\n        this.httpMessages = httpMessages;\n        this.name = name;\n        this.detail = detail;\n        this.severity = severity;\n        this.isCertain = false;\n    }\n\n    public Issue(\n            IHttpService httpService,\n            URL url,\n            IHttpRequestResponse[] httpMessages,\n            String name,\n            String detail,\n            String severity, boolean isCertain) {\n        this.httpService = httpService;\n        this.url = url;\n        this.httpMessages = httpMessages;\n        this.name = name;\n        this.detail = detail;\n        this.severity = severity;\n        this.isCertain = isCertain;\n    }\n\n    @Override\n    public URL getUrl() {\n        return url;\n    }\n\n    @Override\n    public String getIssueName() {\n        return name;\n    }\n\n    @Override\n    public int getIssueType() {\n        return 0;\n    }\n\n    @Override\n    public String getSeverity() {\n        return severity;\n    }\n\n    @Override\n    public String getConfidence() {\n        return isCertain ? \"Certain\" : \"Firm\";\n    }\n\n    @Override\n    public String getIssueBackground() {\n        return null;\n    }\n\n    @Override\n    public String getRemediationBackground() {\n        return null;\n    }\n\n    @Override\n    public String getIssueDetail() {\n        return detail;\n    }\n\n    @Override\n    public String getRemediationDetail() {\n        return null;\n    }\n\n    @Override\n    public IHttpRequestResponse[] getHttpMessages() {\n        return httpMessages;\n    }\n\n    @Override\n    public IHttpService getHttpService() {\n        return httpService;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/IResponseChecker.java",
    "content": "package burp.scanner;\n\nimport burp.*;\n\nimport java.net.URL;\n\npublic interface IResponseChecker {\n    Issue checkResponse(IHttpRequestResponse baseRequestResponse, IHttpRequestResponse checkRequest, URL newUrl);\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/ISubScanner.java",
    "content": "package burp.scanner;\n\nimport burp.IHttpRequestResponse;\nimport burp.Issue;\n\nimport java.net.URL;\nimport java.util.List;\n\npublic interface ISubScanner {\n    String getName();\n\n    List<Issue> check(URL url, IHttpRequestResponse originRequestResponse);\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/Payload.java",
    "content": "package burp.scanner;\n\nimport java.util.List;\n\npublic class Payload {\n    public List<String[]> resources = null;\n    public IResponseChecker responseChecker = null;\n\n    public Payload(List<String[]> resources, IResponseChecker responseChecker) {\n        this.resources = resources;\n        this.responseChecker = responseChecker;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/SpringScanner.java",
    "content": "package burp.scanner;\n\nimport burp.*;\nimport burp.scanner.sub.SpringActuator;\nimport burp.utils.BypassPayloadUtils;\nimport burp.utils.ConfigUtils;\nimport burp.utils.Utils;\nimport net.jodah.expiringmap.ExpiringMap;\n\nimport java.net.URL;\nimport java.net.URLClassLoader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.TimeUnit;\n\npublic class SpringScanner implements IScannerCheck {\n\n    private final String[] STATIC_FILE_EXT = new String[]{\n            \"png\",\n            \"jpg\",\n            \"jpeg\",\n            \"gif\",\n            \"pdf\",\n            \"bmp\",\n            \"js\",\n            \"css\",\n            \"ico\",\n            \"woff\",\n            \"woff2\",\n            \"ttf\",\n            \"otf\",\n            \"ttc\",\n            \"svg\",\n            \"psd\",\n            \"exe\",\n            \"zip\",\n            \"rar\",\n            \"7z\",\n            \"msi\",\n            \"tar\",\n            \"gz\",\n            \"mp3\",\n            \"mp4\",\n            \"mkv\",\n            \"swf\",\n            \"xls\",\n            \"xlsx\",\n            \"doc\",\n            \"docx\",\n            \"ppt\",\n            \"pptx\",\n            \"iso\",\n            \"map\",\n            \"php\",\n            \"aspx\",\n            \"ashx\",\n            \"asp\"\n    };\n\n    List<String> scannedUrls = new ArrayList<>();\n\n    Map<String, Object> scannedNewUrls = ExpiringMap.builder().expiration(1, TimeUnit.HOURS).build();\n    List<ISubScanner> subScanners = new ArrayList<ISubScanner>() {{\n//        add(new APIDoc());\n        add(new SpringActuator(SpringScanner.this));\n    }};\n\n    @Override\n    public List<IScanIssue> doPassiveScan(IHttpRequestResponse baseRequestResponse) {\n        if (ConfigUtils.getBoolean(ConfigUtils.ENABLE, true)) {\n            URL originUrl = cleanURL(Utils.Helpers.analyzeRequest(baseRequestResponse).getUrl());\n            List<IScanIssue> result = new ArrayList<>();\n            URL[] urls = Utils.splitUrls(originUrl);\n            for (URL url : urls) {\n                if (!isChecked(url.toString()))\n                    for (ISubScanner subScanner : subScanners) {\n                        result.addAll(subScanner.check(url, baseRequestResponse));\n                    }\n            }\n            return result;\n        } else {\n            return null;\n        }\n    }\n\n    public synchronized IHttpRequestResponse doRequest(List<String> originHeaders, IHttpRequestResponse originRequestResponse, URL newUrl) {\n        String urlMd5 = Utils.MD5(newUrl.toString());\n        if (!scannedNewUrls.containsKey(urlMd5)) {\n            scannedNewUrls.put(urlMd5, newUrl);\n            byte[] newRequest = BypassPayloadUtils.makeNewGETRequest(originHeaders, newUrl);\n            return Utils.Callback.makeHttpRequest(originRequestResponse.getHttpService(), newRequest);\n        } else {\n            return null;\n        }\n    }\n\n    public URL cleanURL(URL originUrl) {\n        String baseUrl = originUrl.getProtocol() + \"://\" + originUrl.getAuthority();\n        String path = originUrl.getPath();\n        if (isStaticFile(originUrl)) {\n            path = path.substring(0, path.lastIndexOf(\"/\"));\n        }\n        try {\n            return new URL(baseUrl + (path.isEmpty() ? \"/\" : path));\n        } catch (Exception ex) {\n            return originUrl;\n        }\n    }\n\n    public boolean isChecked(String url) {\n        String urlMd5 = Utils.MD5(url);\n        synchronized (scannedUrls) {\n            if (scannedUrls.contains(urlMd5)) {\n                return true;\n            } else {\n                scannedUrls.add(urlMd5);\n                return false;\n            }\n        }\n    }\n\n    private boolean isStaticFile(URL url) {\n        return Arrays.stream(STATIC_FILE_EXT).anyMatch(s -> s.equalsIgnoreCase(Utils.getUrlFileExt(url.toString())));\n    }\n\n    @Override\n    public List<IScanIssue> doActiveScan(IHttpRequestResponse baseRequestResponse, IScannerInsertionPoint insertionPoint) {\n        return null;\n    }\n\n    @Override\n    public int consolidateDuplicateIssues(IScanIssue existingIssue, IScanIssue newIssue) {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/sub/APIDoc.java",
    "content": "package burp.scanner.sub;\n\nimport burp.*;\nimport burp.scanner.IResponseChecker;\nimport burp.scanner.ISubScanner;\nimport burp.scanner.Payload;\nimport burp.utils.BypassPayloadUtils;\nimport burp.utils.ConfigUtils;\nimport burp.utils.Utils;\n\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class APIDoc implements ISubScanner {\n    private final List<Payload> payloads = new ArrayList<Payload>() {{\n        add(new Payload(new ArrayList<String[]>() {{\n            add(new String[]{\"swagger-ui.html\"});\n        }}, (baseRequestResponse, checkRequest, newUrl) -> {\n            IResponseKeywords founds = Utils.Helpers.analyzeResponseKeywords(new ArrayList<String>() {{\n                add(\"Swagger UI\");\n                add(\"swagger-ui/lib\");\n            }}, checkRequest.getResponse());\n            if (BypassPayloadUtils.hasFound(founds, 0) && Utils.Helpers.analyzeResponse(checkRequest.getResponse()).getStatusCode() == 200) {\n                Utils.Callback.printOutput(\"found \" + newUrl + \".\\r\\n\");\n                return new Issue(\n                        baseRequestResponse.getHttpService(),\n                        newUrl,\n                        new IHttpRequestResponse[]{checkRequest},\n                        \"Swagger UI found.\",\n                        \"URL: \" + newUrl,\n                        \"Medium\", true);\n            } else {\n                return null;\n            }\n        }));\n        add(new Payload(new ArrayList<String[]>() {{\n            add(new String[]{\"api-docs\"});\n            add(new String[]{\"v2\", \"api-docs\"});\n            add(new String[]{\"v2\", \"api-docs-ext\"});\n            add(new String[]{\"swagger\", \"v1\", \"swagger.json\"});\n        }}, (baseRequestResponse, checkRequest, newUrl) -> {\n            IResponseKeywords founds = Utils.Helpers.analyzeResponseKeywords(new ArrayList<String>() {{\n                add(\"\\\"swagger\\\":\");\n            }}, checkRequest.getResponse());\n            if (BypassPayloadUtils.hasFound(founds, 0) && Utils.Helpers.analyzeResponse(checkRequest.getResponse()).getStatusCode() == 200) {\n                Utils.Callback.printOutput(\"found \" + newUrl + \".\\r\\n\");\n                return new Issue(\n                        baseRequestResponse.getHttpService(), newUrl,\n                        new IHttpRequestResponse[]{checkRequest},\n                        \"API-Docs found.\",\n                        \"URL: \" + newUrl,\n                        \"Medium\", false);\n            } else {\n                return null;\n            }\n        }));\n        add(new Payload(new ArrayList<String[]>() {{\n            add(new String[]{\"doc.html\"});\n        }}, (baseRequestResponse, checkRequest, newUrl) -> null));\n    }};\n\n    @Override\n    public String getName() {\n        return \"API Doc\";\n    }\n\n    @Override\n    public List<Issue> check(URL url, IHttpRequestResponse originRequestResponse) {\n        IRequestInfo originRequest = Utils.Helpers.analyzeRequest(originRequestResponse);\n        List<String> originHeaders = originRequest.getHeaders();\n        List<Issue> result = new ArrayList<>();\n        for (Payload payload : payloads) {\n            List<Issue> issues = new ArrayList<>();\n            for (String[] resParts : payload.resources) {\n                for (URL newUrl : BypassPayloadUtils.getBypassPayloads(url, resParts, ConfigUtils.getDict(ConfigUtils.DIR_BYPASS))) {\n                    byte[] newRequest = BypassPayloadUtils.makeNewGETRequest(originHeaders, newUrl);\n                    IHttpRequestResponse resp = Utils.Callback.makeHttpRequest(originRequestResponse.getHttpService(), newRequest);\n                    Issue issue = payload.responseChecker.checkResponse(originRequestResponse, resp, newUrl);\n                    if (issue != null) {\n                        issues.add(issue);\n                        break;\n                    }\n                }\n                if (issues.size() > 0) {\n                    break;\n                }\n            }\n            result.addAll(issues);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/scanner/sub/SpringActuator.java",
    "content": "package burp.scanner.sub;\n\nimport burp.*;\nimport burp.scanner.IResponseChecker;\nimport burp.scanner.ISubScanner;\nimport burp.scanner.Payload;\nimport burp.scanner.SpringScanner;\nimport burp.utils.BypassPayloadUtils;\nimport burp.utils.ConfigUtils;\nimport burp.utils.Utils;\n\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class SpringActuator implements ISubScanner {\n    private SpringScanner scanner;\n\n    public SpringActuator(SpringScanner scanner) {\n        this.scanner = scanner;\n    }\n\n    private final List<Payload> payloads = new ArrayList<Payload>() {{\n        add(new Payload(new ArrayList<String[]>() {{\n            add(new String[]{\"env\"});\n            add(new String[]{\"actuator\", \"env\"});\n        }}, (baseRequestResponse, checkRequest, newUrl) -> {\n            IResponseKeywords founds = Utils.Helpers.analyzeResponseKeywords(new ArrayList<String>() {{\n                add(\"java.version\");\n                add(\"os.arch\");\n            }}, checkRequest.getResponse());\n            if (BypassPayloadUtils.hasFound(founds, 0) && Utils.Helpers.analyzeResponse(checkRequest.getResponse()).getStatusCode() == 200) {\n                Utils.Callback.printOutput(\"found \" + newUrl + \".\\r\\n\");\n                return new Issue(\n                        baseRequestResponse.getHttpService(),\n                        newUrl,\n                        new IHttpRequestResponse[]{checkRequest},\n                        \"Spring Actuator-Env found.\",\n                        \"URL: \" + newUrl,\n                        \"Medium\", true);\n            } else {\n                return null;\n            }\n        }));\n        add(new Payload(new ArrayList<String[]>() {{\n            add(new String[]{\"actuator\"});\n        }}, (baseRequestResponse, checkRequest, newUrl) -> {\n            IResponseKeywords founds = Utils.Helpers.analyzeResponseKeywords(new ArrayList<String>() {{\n                add(\"health\");\n                add(\"{\\\"self\\\":{\");\n                add(\"{\\\"_links\\\":{\");\n            }}, checkRequest.getResponse());\n            if (BypassPayloadUtils.hasFound(founds, 0) && Utils.Helpers.analyzeResponse(checkRequest.getResponse()).getStatusCode() == 200) {\n                Utils.Callback.printOutput(\"found \" + newUrl + \".\\r\\n\");\n                return new Issue(\n                        baseRequestResponse.getHttpService(),\n                        newUrl,\n                        new IHttpRequestResponse[]{checkRequest},\n                        \"Spring Actuator found.\",\n                        \"URL: \" + newUrl,\n                        \"Medium\", false);\n            } else {\n                return null;\n            }\n        }));\n    }};\n\n    @Override\n    public String getName() {\n        return \"Spring Actuator\";\n    }\n\n\n    @Override\n    public List<Issue> check(URL url, IHttpRequestResponse originRequestResponse) {\n        IRequestInfo originRequest = Utils.Helpers.analyzeRequest(originRequestResponse);\n        List<String> originHeaders = originRequest.getHeaders();\n        List<Issue> result = new ArrayList<>();\n        for (Payload payload : payloads) {\n            List<Issue> issues = new ArrayList<>();\n            for (String[] resParts : payload.resources) {\n                if (Utils.urlAllowScan(resParts)) {\n                    for (URL newUrl : BypassPayloadUtils.getBypassPayloads(url, resParts, ConfigUtils.getDict(ConfigUtils.DIR_BYPASS))) {\n                        IHttpRequestResponse resp = scanner.doRequest(originHeaders, originRequestResponse, newUrl);\n                        if (resp != null) {\n                            Issue issue = payload.responseChecker.checkResponse(originRequestResponse, resp, newUrl);\n                            if (issue != null) {\n                                issues.add(issue);\n                                break;\n                            }\n                        }\n                    }\n                }\n                if (issues.size() > 0) {\n                    break;\n                }\n            }\n            result.addAll(issues);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/ui/UIHandler.java",
    "content": "package burp.ui;\n\nimport burp.BurpExtender;\nimport burp.ITab;\nimport burp.utils.ConfigUtils;\nimport burp.utils.UIUtil;\nimport burp.utils.Utils;\nimport jdk.nashorn.internal.runtime.regexp.joni.Config;\n\nimport javax.swing.*;\nimport javax.swing.border.EmptyBorder;\nimport java.awt.*;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class UIHandler implements ITab {\n    public JPanel mainPanel;\n    public BurpExtender parent;\n    public JTextField dirScanDeeper;\n    public static final List<String> DefaultBypass = new ArrayList<String>() {{\n        add(\".\");\n        add(\";\");\n    }};\n    public static final List<String> DefaultScanPoint = new ArrayList<String>() {{\n        add(\"/env\");\n        add(\"/actuator\");\n        add(\"/actuator/env\");\n    }};\n\n    public UIHandler(BurpExtender parent) {\n        this.parent = parent;\n        this.initUI();\n    }\n\n    private void applyDefaultBypassIfNotSet() {\n        String val = ConfigUtils.get(ConfigUtils.DIR_BYPASS);\n        if (val == null || val.isEmpty()) {\n            for (String str : DefaultBypass) {\n                ConfigUtils.setStrToDict(ConfigUtils.DIR_BYPASS, str, true);\n            }\n        }\n    }\n\n    private void applyDefaultScanPointIfNotSet() {\n        String val = ConfigUtils.get(ConfigUtils.SCAN_POINT);\n        if (val == null || val.isEmpty()) {\n            for (String str : DefaultScanPoint) {\n                ConfigUtils.setStrToDict(ConfigUtils.SCAN_POINT, str, true);\n            }\n        }\n    }\n\n    private void initUI() {\n        applyDefaultBypassIfNotSet();\n        applyDefaultScanPointIfNotSet();\n        Utils.SplitDeep = ConfigUtils.getInt(ConfigUtils.DIR_SCAN_DEEPER, 3);\n        this.mainPanel = new JPanel();\n        mainPanel.setAlignmentX(0.0f);\n        mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));\n        mainPanel.setLayout(new BoxLayout(mainPanel, 1));\n        EmptyBorder border = new EmptyBorder(5, 5, 6, 6);\n\n\n        JPanel panel1 = UIUtil.GetXJPanel();\n\n        JLabel savedTip0 = new JLabel(\"Saved!\");\n        savedTip0.setVisible(false);\n        savedTip0.setBorder(border);\n        savedTip0.setForeground(Color.GREEN);\n        JCheckBox enableBox = new JCheckBox();\n        enableBox.addActionListener(a -> {\n            ConfigUtils.setBoolean(ConfigUtils.ENABLE, enableBox.isSelected());\n            startTimerHide(savedTip0);\n        });\n        enableBox.setSelected(ConfigUtils.getBoolean(ConfigUtils.ENABLE, true));\n        panel1.add(new JLabel(\"Enable: \"));\n        panel1.add(enableBox);\n        panel1.add(savedTip0);\n        mainPanel.add(panel1);\n\n        panel1 = UIUtil.GetXJPanel();\n        dirScanDeeper = new JTextField(10);\n        dirScanDeeper.setText(String.valueOf(ConfigUtils.getInt(ConfigUtils.DIR_SCAN_DEEPER, 3)));\n        dirScanDeeper.setMaximumSize(dirScanDeeper.getPreferredSize());\n        panel1.add(new JLabel(\"Dir Scan Deeper: \"));\n        panel1.add(dirScanDeeper);\n        panel1.add(new JButton(\"Save\") {{\n            addActionListener(l -> {\n                try {\n                    int val = Integer.parseInt(dirScanDeeper.getText());\n                    Utils.SplitDeep = val;\n                    ConfigUtils.setInt(ConfigUtils.DIR_SCAN_DEEPER, val);\n                    JOptionPane.showMessageDialog(mainPanel, \"OK!\");\n                } catch (Exception ex) {\n                    JOptionPane.showMessageDialog(mainPanel, \"Must be number!\");\n                }\n            });\n        }});\n        mainPanel.add(panel1);\n\n        panel1 = UIUtil.GetXJPanel();\n        panel1.add(new JLabel(\"Use Bypass: \"));\n        JLabel savedTip1 = new JLabel(\"Saved!\");\n        savedTip1.setVisible(false);\n        savedTip1.setBorder(border);\n        savedTip1.setForeground(Color.GREEN);\n        for (String str : new String[]{\n                \".\",\n                \";\",\n                \"..;\",\n                \";%09..;\",\n                \";%09..\",\n                \";%2f..\",\n                \"*\",\n                \"%09\",\n                \"%20\",\n                \"%23\",\n                \"%2e\",\n                \"%2f\"\n        }) {\n            JCheckBox checkBox = new JCheckBox();\n            checkBox.setText(str);\n            checkBox.addActionListener(a -> {\n                ConfigUtils.setStrToDict(ConfigUtils.DIR_BYPASS, str, checkBox.isSelected());\n                startTimerHide(savedTip1);\n            });\n            checkBox.setSelected(ConfigUtils.getStrInDict(ConfigUtils.DIR_BYPASS, str, false));\n            panel1.add(checkBox);\n        }\n        panel1.add(savedTip1);\n        mainPanel.add(panel1);\n\n        panel1 = UIUtil.GetXJPanel();\n        panel1.add(new JLabel(\"Scan Point: \"));\n        JLabel savedTip2 = new JLabel(\"Saved!\");\n        savedTip2.setVisible(false);\n        savedTip2.setBorder(border);\n        savedTip2.setForeground(Color.GREEN);\n        for (String str : new String[]{\n                \"/env\",\n                \"/actuator\",\n                \"/actuator/env\"\n        }) {\n            JCheckBox checkBox = new JCheckBox();\n            checkBox.setText(str);\n            checkBox.addActionListener(a -> {\n                ConfigUtils.setStrToDict(ConfigUtils.SCAN_POINT, str, checkBox.isSelected());\n                startTimerHide(savedTip2);\n            });\n            checkBox.setSelected(ConfigUtils.getStrInDict(ConfigUtils.SCAN_POINT, str, false));\n            panel1.add(checkBox);\n        }\n        panel1.add(savedTip2);\n        mainPanel.add(panel1);\n\n\n//        BackendUIHandler bui = new BackendUIHandler(parent);\n//        POCUIHandler pui = new POCUIHandler(parent);\n//        FuzzUIHandler fui = new FuzzUIHandler(parent);\n//        this.mainPanel.addTab(\"Backend\", bui.getPanel());\n//        this.mainPanel.addTab(\"POC\", pui.getPanel());\n//        this.mainPanel.addTab(\"Fuzz\", fui.getPanel());\n    }\n\n    public void startTimerHide(JComponent component) {\n        component.setVisible(true);\n        Thread thread = new Thread(new Runnable() {\n            @Override\n            public void run() {\n                try {\n                    Thread.sleep(4000);\n                    component.setVisible(false);\n                } catch (InterruptedException e) {\n                    e.printStackTrace();\n                }\n            }\n        });\n        thread.setDaemon(true);\n        thread.start();\n    }\n\n    @Override\n    public String getTabCaption() {\n        return \"SpringSpider\";\n    }\n\n    @Override\n    public Component getUiComponent() {\n        return mainPanel;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/utils/BypassPayloadUtils.java",
    "content": "package burp.utils;\n\nimport burp.IResponseKeywords;\n\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\npublic class BypassPayloadUtils {\n    public static final String[] URL_BYPASS = new String[]{\n            \".\",\n            \";\",\n //           \"..;\",\n/*            \";%09..;\",\n            \";%09..\",\n            \";%2f..\",\n            \"*\",\n            \"%09\",\n            \"%20\",\n            \"%23\",\n            \"%2e\",\n            \"%2f\"*/\n    };\n    public static final String[] HEADER_BYPASS = new String[]{\n            \"Client-IP\",\n            \"X-Real-IP\",\n            \"Redirect\",\n            \"Referer\",\n            \"X-Client-IP\",\n            \"X-Custom-IP-Authorization\",\n            \"X-Forwarded-By\",\n            \"X-Forwarded-For\",\n            \"X-Forwarded-Host\",\n            \"X-Forwarded-Port\",\n            \"X-True-IP\"\n    };\n    public static final String[] GET_SKIPED_HEADERS = new String[]{\"content-type\", \"content-length\"};\n\n    public static URL[] getBypassPayloads(URL baseUrl, String[] resParts, String[] bypass) {\n        List<URL> result = new ArrayList<>();\n        String originUrl = baseUrl.toString();\n        originUrl = originUrl.endsWith(\"/\") ? originUrl : originUrl + \"/\";\n        try {\n            result.add(new URL(originUrl + String.join(\"/\", resParts)));\n            for (String bypassPayload : bypass) {\n                result.add(new URL(originUrl + bypassPayload + \"/\" + String.join(\"/\" + bypassPayload + \"/\", resParts)));\n            }\n        } catch (Exception ex) {\n            System.out.println(ex);\n        }\n        return result.toArray(new URL[0]);\n    }\n\n    public static byte[] makeNewGETRequest(List<String> originHeaders, URL url) {\n        List<String> headers = new ArrayList<String>() {{\n            add(\n                    \"GET \" + url.getPath() + \" HTTP/1.1\"\n            );\n        }};\n        List<String> headerBypass = new ArrayList(Arrays.asList(HEADER_BYPASS));\n        for (int i = 1; i < originHeaders.size(); i++) { //skip url line.\n            HttpHeader header = new HttpHeader(originHeaders.get(i));\n            List<String> needSkipheader = headerBypass.stream().filter(h -> h.equalsIgnoreCase(header.Name)).collect(Collectors.toList());\n            needSkipheader.forEach(headerBypass::remove);\n            if (Arrays.stream(GET_SKIPED_HEADERS).anyMatch(e -> e.equalsIgnoreCase(header.Name))) {\n                continue;\n            } else {\n                if (header.Name.equalsIgnoreCase(\"accept\")) {\n                    headers.add(\"Accept: */*\");\n                } else {\n                    headers.add(header.toString());\n                }\n            }\n        }\n        for (String headerName : headerBypass) {\n            switch (headerName) {\n                case \"X-Forwarded-Port\":\n                    headers.add(String.format(\"%s: %s\", headerName, url.getPort()));\n                    break;\n                default:\n                    headers.add(String.format(\"%s: %s\", headerName, \"127.0.0.1\"));\n            }\n        }\n        return Utils.Helpers.buildHttpMessage(headers, null);\n    }\n\n    public static boolean hasFound(IResponseKeywords keywords, int responseIndex) {\n        for (String keyword : keywords.getInvariantKeywords()) {\n            if (keywords.getKeywordCount(keyword, responseIndex) > 0) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/utils/ConfigUtils.java",
    "content": "package burp.utils;\n\nimport com.jayway.jsonpath.DocumentContext;\nimport com.jayway.jsonpath.JsonPath;\nimport net.minidev.json.JSONArray;\n\n\npublic class ConfigUtils {\n    public static final String DIR_SCAN_DEEPER = \"dir_scan_deeper\";\n    public static final String DIR_BYPASS = \"dir_bypass\";\n    public static final String SCAN_POINT = \"scan_point\";\n    public static final String ENABLE = \"enable\";\n\n    public static String get(String name) {\n        return Utils.Callback.loadExtensionSetting(name);\n    }\n\n    public static String get(String name, String defaultValue) {\n        String val = get(name);\n        return val == null || val.isEmpty() ? defaultValue : val;\n    }\n\n    public static int getInt(String name, int defaultValue) {\n        String val = get(name);\n        return val == null || val.isEmpty() ? defaultValue : Integer.parseInt(val);\n    }\n\n    public static boolean getBoolean(String name, boolean defaultValue) {\n        String val = get(name);\n        return val == null || val.isEmpty() ? defaultValue : val.equals(\"1\");\n    }\n\n    public static boolean getStrInDict(String name, String str, boolean defaultValue) {\n        String val = get(name);\n        if (val == null || val.isEmpty())\n            return defaultValue;\n        try {\n            DocumentContext array = JsonPath.parse(val);\n            if (array.json() instanceof JSONArray) {\n                return ((JSONArray) array.json()).contains(str);\n            } else {\n                return defaultValue;\n            }\n        } catch (Exception ex) {\n            return defaultValue;\n        }\n    }\n\n    public static void setStrToDict(String name, String str, boolean value) {\n        String val = get(name);\n        if (val == null || val.isEmpty())\n            val = \"[]\";\n        DocumentContext array = null;\n        try {\n            array = JsonPath.parse(val);\n        } catch (Exception ex) {\n            array = JsonPath.parse(\"[]\");\n        }\n        JSONArray arr = array.json();\n        if (value && !arr.contains(str)) {\n            arr.add(str);\n        } else if (!value && arr.contains(str)) {\n            arr.remove(str);\n        }\n        set(name, arr.toJSONString());\n    }\n\n    public static String[] getDict(String name) {\n        String val = get(name);\n        if (val == null || val.isEmpty())\n            return new String[0];\n        DocumentContext array = null;\n        try {\n            array = JsonPath.parse(val);\n        } catch (Exception ex) {\n            return new String[0];\n        }\n        JSONArray arr = array.json();\n        return arr.toArray(new String[0]);\n    }\n\n    public static void set(String name, String value) {\n        Utils.Callback.saveExtensionSetting(name, value);\n    }\n\n    public static void setBoolean(String name, boolean value) {\n        set(name, value ? \"1\" : \"0\");\n    }\n\n    public static void setInt(String name, int value) {\n        set(name, String.valueOf(value));\n    }\n\n    public static void main(String[] args) {\n\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/utils/HttpHeader.java",
    "content": "package burp.utils;\n\npublic class HttpHeader {\n    public String Name;\n    public String Value = \"\";\n\n    public HttpHeader(String src) {\n        int headerLength = src.indexOf(':');\n        if (headerLength > -1) {\n            Name = src.substring(0, headerLength);\n            Value = src.substring(headerLength + 1).trim();\n        } else {\n            Name = src;\n        }\n    }\n\n    @Override\n    public String toString() {\n        return String.format(\"%s: %s\", Name, Value);\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/utils/UIUtil.java",
    "content": "package burp.utils;\n\nimport javax.swing.*;\nimport javax.swing.border.EmptyBorder;\nimport java.awt.*;\n\npublic class UIUtil {\n    public static JPanel GetXJPanel() {\n        JPanel panel1 = new JPanel();\n        panel1.setAlignmentX(0.0f);\n        panel1.setLayout(new BoxLayout(panel1, 0));\n        panel1.setForeground(new Color(249, 130, 11));\n        panel1.setBorder(new EmptyBorder(5, 0, 5, 0));\n        return panel1;\n    }\n\n    public static JPanel GetYJPanel() {\n        JPanel panel1 = new JPanel();\n        panel1.setAlignmentX(0.0f);\n        panel1.setLayout(new BoxLayout(panel1, 1));\n        panel1.setForeground(new Color(249, 130, 11));\n        panel1.setBorder(new EmptyBorder(5, 0, 5, 0));\n        return panel1;\n    }\n}\n"
  },
  {
    "path": "src/main/java/burp/utils/Utils.java",
    "content": "package burp.utils;\n\n\nimport burp.IBurpExtenderCallbacks;\nimport burp.IExtensionHelpers;\n\nimport java.lang.reflect.Field;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.nio.charset.StandardCharsets;\nimport java.security.MessageDigest;\nimport java.security.NoSuchAlgorithmException;\nimport java.security.SecureRandom;\nimport java.util.*;\nimport java.util.concurrent.ThreadLocalRandom;\n\npublic class Utils {\n    public static IBurpExtenderCallbacks Callback;\n    public static IExtensionHelpers Helpers;\n    private static MessageDigest md;\n    private static SecureRandom rand = new SecureRandom();\n    public static int SplitDeep = 3;\n\n    public static long getRandomLong() {\n        return rand.nextLong();\n    }\n\n    public static int GetRandomNumber(int min, int max) {\n        return rand.nextInt(max - min + 1) + min;\n    }\n\n    public static Boolean GetRandomBoolean() {\n        return rand.nextInt(100) > 50;\n    }\n\n    public static String GetRandomString(int length) {\n        String str = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n        StringBuffer sb = new StringBuffer();\n        for (int i = 0; i < length; i++) {\n            int number = rand.nextInt(str.length() - 1);\n            sb.append(str.charAt(number));\n        }\n        return sb.toString();\n    }\n\n    public static int[] getRandomIndex(int size, int max) {\n        if (size > max) size = max;\n        return ThreadLocalRandom.current().ints(0, max).distinct().limit(size).toArray();\n    }\n\n    public static String confusionChars(String[] _chars) {\n        int confusionCount = Utils.GetRandomNumber(1, _chars.length);\n        return confusionChars(_chars, confusionCount);\n    }\n\n    public static String confusionChars(String[] _chars, int confusionCount) {\n        StringBuilder result = new StringBuilder();\n        int[] confustionCharIndexs = Utils.getRandomIndex(confusionCount, _chars.length);\n        for (int i = 0; i < _chars.length; i++) {\n            int finalI = i;\n            if (Arrays.stream(confustionCharIndexs).anyMatch(c -> c == finalI)) {\n                result.append(confusionChar(_chars[i]));\n            } else {\n                result.append(_chars[i]);\n            }\n        }\n        return result.toString();\n    }\n\n    public static String confusionChar(String _char) {\n        int garbageCount = Utils.GetRandomNumber(2, 5);\n        StringBuilder garbage = new StringBuilder();\n        for (int i = 0; i < garbageCount; i++) {\n            int garbageLength = Utils.GetRandomNumber(3, 6);\n            String garbageWord = Utils.GetRandomString(garbageLength);\n            garbage.append(garbageWord).append(\":\");\n        }\n        return String.format(\"${%s-%s}\", garbage, _char);\n    }\n\n    public static byte[] byteMerger(byte[] bt1, byte[] bt2) {\n        byte[] bt3 = new byte[bt1.length + bt2.length];\n        System.arraycopy(bt1, 0, bt3, 0, bt1.length);\n        System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length);\n        return bt3;\n    }\n\n\n    public static String getUrlFileExt(String url) {\n        String pureUrl = url.substring(0, url.contains(\"?\") ? url.indexOf(\"?\") : url.length());\n        return (pureUrl.lastIndexOf(\".\") > -1 ? pureUrl.substring(pureUrl.lastIndexOf(\".\") + 1) : \"\").toLowerCase();\n    }\n\n    public static URL[] splitUrls(URL url) {\n        List<URL> urls = new ArrayList<>();\n        try {\n            String baseUrl = url.getProtocol() + \"://\" + url.getAuthority() + \"/\";\n            String[] paths = url.getPath().split(\"/\");\n            for (String path : paths) {\n                if (urls.size() >= SplitDeep) break;\n                String tmpUrl = baseUrl + path;\n                urls.add(new URL(tmpUrl));\n                //urls.add(new URL(tmpUrl + (tmpUrl.endsWith(\"/\") ?  \"..\" : \"/..\")));\n                baseUrl += path + (path.isEmpty() ? \"\" : \"/\");\n            }\n        } catch (Exception ex) {\n            System.out.println(ex);\n        }\n        return urls.toArray(new URL[0]);\n    }\n\n    public static boolean urlAllowScan(String[] urlParts) {\n        String url = \"/\" + String.join(\"/\", urlParts);\n        return ConfigUtils.getStrInDict(ConfigUtils.SCAN_POINT, url, false);\n    }\n\n    public static String getCurrentTimeMillis() {\n        return String.valueOf(System.currentTimeMillis());\n    }\n\n    public static byte[] Replace(byte[] request, int[] selectedIndexRange, byte[] targetBytes) {\n        byte[] result = new byte[request.length - (selectedIndexRange[1] - selectedIndexRange[0]) + targetBytes.length];\n        System.arraycopy(request, 0, result, 0, selectedIndexRange[0]);\n        System.arraycopy(targetBytes, 0, result, selectedIndexRange[0], targetBytes.length);\n        System.arraycopy(request, selectedIndexRange[1], result, selectedIndexRange[0] + targetBytes.length, request.length - selectedIndexRange[1]);\n        return result;\n    }\n\n    public static String MD5(String src) {\n        return Base64.getEncoder().encodeToString(MD5(src.getBytes(StandardCharsets.UTF_8)));\n    }\n\n    public static byte[] MD5(byte[] src) {\n        if (md == null) {\n            try {\n                md = MessageDigest.getInstance(\"md5\");\n            } catch (NoSuchAlgorithmException e) {\n                throw new RuntimeException(\"MD5 not found!\");\n            }\n        }\n        byte[] secretBytes = null;\n        secretBytes = md.digest(src);\n        return secretBytes;\n    }\n\n    public static String[] splitString(String str) {\n        String[] result = new String[str.length()];\n        for (int i = 0; i < str.length(); i++) {\n            result[i] = String.valueOf(str.charAt(i));\n        }\n        return result;\n    }\n}\n"
  }
]