arfaoui haythem arfaoui haythem - 6 months ago 273
Perl Question

you may need to install the My::Module module

i work now in a project of web vulnerability scanner so i would run my perl script into my java the perl script is the uniscan open source tool from kali linux so when i click go to run the script this message appear


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.


However when i run hello world script it appear correctly with no probleme in my console. So this is my code of calling perl script in my java

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();
}


and the code of uniscan is here

Please i need help i'm blocked is for my final degree next week

Answer

The program relies on the script's directory being found in the module search path (@INC), but does not ensure this.

If you run the script from the script's directory, it works because . is in @INC by default. But you are running the script from a different directory.

Remove the following useless line:

use lib "./Uniscan";

Replace it with the following:

use FindBin qw( $RealBin );
use lib $RealBin;