我现在在一个Web漏洞扫描器项目中工作,所以我会在我的java中运行我的perl脚本,perl脚本是来自kali linux的uniscan开源工具,所以当我单击“go”运行脚本时,会出现此消息
Can't locate Uniscan/Crawler.pm in @INC (you may need to install the Uniscan::Crawler module) (@INC contains: ./Uniscan C:/Perl64/site/lib C:/Perl64/lib .) at C:\uniscan\uniscan.pl line 25. BEGIN failed--compilation aborted at test\uniscan.pl line 25.
但是,当我运行 hello world 脚本时,它在我的控制台中正确显示,没有问题。这是我在 java 中调用 perl 脚本的代码
try {
String[] commande = {"perl", "C:\\uniscan\uniscan.pl"};
Process p = Runtime.getRuntime().exec(commande);
AfficheurFlux fluxSortie = new AfficheurFlux(p.getInputStream());
AfficheurFlux fluxErreur = new AfficheurFlux(p.getErrorStream());
new Thread(fluxSortie).start();
new Thread(fluxErreur).start();
p.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
uniscan的代码是here
我需要帮助,下周我的最终学位被阻止
最佳答案
该程序依赖于在模块搜索路径 (@INC
) 中找到的脚本目录,但不能确保这一点。
如果从脚本目录运行脚本,它会起作用,因为默认情况下 .
位于 @INC
中。但是您正在从不同的目录运行脚本。
删除以下无用行:
use lib "./Uniscan";
将其替换为以下内容:
use FindBin qw( $RealBin );
use lib $RealBin;
关于java - 您可能需要安装 My::Module 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37358129/