尝试在 Burp 中导入插件时出现 ClassNotFoundException
ClassNotFoundException when trying to import plugin in Burp
我从昨天开始就遇到了这个问题,Burp 在尝试导入插件的 .jar 文件时开始显示以下错误,但是 Netbeans 编译它没有问题。我通过 pom.xml 文件中的 Maven 依赖项导入了 Selenium,每次我将插件加载到 Burp 中时,我都会 运行 Clean and build 选项以避免任何问题
然而我运行的代码是这样的:
void runBrowserAutomatization(File fileDriver, String seleniumTrack, boolean isHeadless) {
WebDriver driver;
if (gui.usedBrowser().toLowerCase().contains("chrome")) {
ChromeOptions options = new ChromeOptions();
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8080");
proxy.setSslProxy("localhost:8080");
options.setCapability(CapabilityType.PROXY, proxy);
options.setHeadless(isHeadless);
System.setProperty("webdriver.chrome.driver", fileDriver.getPath());
driver = new ChromeDriver(options);
} else if (gui.usedBrowser().toLowerCase().contains("firefox")) {
FirefoxOptions options = new FirefoxOptions();
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8080");
proxy.setSslProxy("localhost:8080");
options.setCapability(CapabilityType.PROXY, proxy);
options.setHeadless(isHeadless);
System.setProperty("webdriver.gecko.driver", fileDriver.getPath());
driver = new FirefoxDriver(options);
} else {
printMsg("No browser selected...");
return;
}
/// other stuff here
driver.close();
}
显示的错误如下
java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:416)
at burp.ehm.a(Unknown Source)
at burp.ehm.<init>(Unknown Source)
at burp.b6.a(Unknown Source)
at burp.c3u.lambda$panelLoaded[=11=](Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
尴尬的是,如果我注释 driver 对象的两个实现,Burp 不会显示导入它的错误。它似乎在实现 WebDriver 对象时有问题,但在声明它时没有问题,这对于 ClassNotFoundException 来说很奇怪。另一个工具,其代码与这些组件具有相同的结构,如果加载它没有错误并且运行没问题。
将此插件添加到 pom.xml 文件为我修复了错误,它在构建项目时在 jar 中包含 Maven 依赖项。
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
可以在这里找到最新版本的插件https://maven.apache.org/plugins/maven-shade-plugin/usage.html
我从昨天开始就遇到了这个问题,Burp 在尝试导入插件的 .jar 文件时开始显示以下错误,但是 Netbeans 编译它没有问题。我通过 pom.xml 文件中的 Maven 依赖项导入了 Selenium,每次我将插件加载到 Burp 中时,我都会 运行 Clean and build 选项以避免任何问题
然而我运行的代码是这样的:
void runBrowserAutomatization(File fileDriver, String seleniumTrack, boolean isHeadless) {
WebDriver driver;
if (gui.usedBrowser().toLowerCase().contains("chrome")) {
ChromeOptions options = new ChromeOptions();
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8080");
proxy.setSslProxy("localhost:8080");
options.setCapability(CapabilityType.PROXY, proxy);
options.setHeadless(isHeadless);
System.setProperty("webdriver.chrome.driver", fileDriver.getPath());
driver = new ChromeDriver(options);
} else if (gui.usedBrowser().toLowerCase().contains("firefox")) {
FirefoxOptions options = new FirefoxOptions();
Proxy proxy = new Proxy();
proxy.setHttpProxy("localhost:8080");
proxy.setSslProxy("localhost:8080");
options.setCapability(CapabilityType.PROXY, proxy);
options.setHeadless(isHeadless);
System.setProperty("webdriver.gecko.driver", fileDriver.getPath());
driver = new FirefoxDriver(options);
} else {
printMsg("No browser selected...");
return;
}
/// other stuff here
driver.close();
}
显示的错误如下
java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:416)
at burp.ehm.a(Unknown Source)
at burp.ehm.<init>(Unknown Source)
at burp.b6.a(Unknown Source)
at burp.c3u.lambda$panelLoaded[=11=](Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
尴尬的是,如果我注释 driver 对象的两个实现,Burp 不会显示导入它的错误。它似乎在实现 WebDriver 对象时有问题,但在声明它时没有问题,这对于 ClassNotFoundException 来说很奇怪。另一个工具,其代码与这些组件具有相同的结构,如果加载它没有错误并且运行没问题。
将此插件添加到 pom.xml 文件为我修复了错误,它在构建项目时在 jar 中包含 Maven 依赖项。
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
可以在这里找到最新版本的插件https://maven.apache.org/plugins/maven-shade-plugin/usage.html