Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't locate SeccubusV2.pm in @INC (you may need to install the SeccubusV2 module) #138

Closed
Tushar-AB opened this issue Oct 8, 2014 · 34 comments
Labels

Comments

@Tushar-AB
Copy link

I successfully installed seccubus as per instruction given at https://www.seccubus.com/how-to-install-seccubus-v2/
However, I am getting error while creating workspace. It gets stuck on creating workspace window:

When I ran ConfigTest.pl to check the same, I got below error:
Can't locate SeccubusV2.pm in @inc (you may need to install the SeccubusV2 module) (@inc contains: .. /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at ConfigTest.pl line 74.

I followed #12 but no luck.
Please help us.

@MrSeccubus
Copy link
Member

@Tushar-AB I need a little bit more information before I can help you.

  • What operating system are you installing on?
  • What installation method are you using? RPM, Deb, Tarball or directly from GitHub
  • If you installed via Tarball of GitHub what is the installation directory?
  • In you config.xml what value is set for paths->modules?

@Tushar-AB
Copy link
Author

Thanks for your reply.. :)
Below are answers to your queries

What operating system are you installing on?
Ubuntu-14.04.1

What installation method are you using? RPM, Deb, Tarball or directly from GitHub
Tarball (Seccubus-2.9.B170.tar.gz)

If you installed via Tarball of GitHub what is the installation directory?
/home/seccubus/

In you config.xml what value is set for paths->modules? /home/seccubus/SeccubusV2

Below are snaps of errors:
http://oi60.tinypic.com/dme99w.jpg
http://oi57.tinypic.com/289hsnq.jpg

@MrSeccubus
Copy link
Member

@Tushar-AB I recommend installing using the Deb package from https://github.com/schubergphilis/Seccubus_v2/releases this has all dependancies in the right places.

From the screenshots it doesn't look like you ran the install script. If you did there should be a directory /home/seccubus/www/json does the ConfigTest.pl in this directory given the same error?

@dreschda
Copy link

This will fix the issue temporarily:

export PERL5LIB=

I have built this numerous times and I always seem to have this same problem no matter the steps that I follow.

@MrSeccubus
Copy link
Member

Have you tried installing via de deb file already?

@dreschda
Copy link

Yes numerous times today, clean install of Raspbian, following the instructions at (#168) this is the error I get:

root@FF-SECCUBUS:/home/pi# dpkg -i seccubus_2.14.B262_all.deb
Selecting previously unselected package seccubus.
(Reading database ... 79179 files and directories currently installed.)
Unpacking seccubus (from seccubus_2.14.B262_all.deb) ...
Setting up seccubus (2.14.B262) ...
Adding user www-data' to groupseccubus' ...
Adding user www-data to group seccubus
Done.
ERROR: Site seccubus does not exist!
dpkg: error processing seccubus (--install):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing: seccubus

So there is either more needed to the instructions or I am missing something. I am not complaining about the @inc error I can work around it which is why I thought I would share it here.

@MrSeccubus
Copy link
Member

MrSeccubus commented Feb 25, 2015 via email

@dreschda
Copy link

The pi is debian based so it shouldn't be all that different. If that helps these is the basic outline of my install which so far has given me the @inc error every time. That way you can tell me if I am doing a wrong step somewhere.

apt-get install apache2 mysql-server nmap ruby libalgorithm-diff-perl libjson-perl libxml-simple-perl libhtml-tree-perl libapache2-mod-perl2 liburi-perl libtest-mock-lwp-perl perl-modules libcrypt-ssleay-perl libwww-perl libexpat1-dev
sudo cpan -i REST::Client

Web Server Setup

vi /etc/apache2/sites-enabled/000-default

make it match below

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AddHandler cgi-script .pl
AllowOverride None
Order allow,deny
allow from all

Database Setup

create database Seccubus;

grant all privileges on Seccubus.* to seccubus@localhost identified by 'seccubus';

use Seccubus;

. /opt/seccubus/db/structure_v6.mysql

. /opt/seccubus/db/data_v6.mysql

Install Seccubus

perl Makefile.PL (case sensitive)

make

./install.pl —basedir /opt/seccubus —wwwdir /var/www

copy to the config.xml

edit /opt/seccubus/etc/config.xml to the correct settings of your database.

@debojyotib
Copy link

I do have the same issue and could not solve it. Some help will really be appreciated. I ran the ConfigTest.pl and got the following output

[
{
"message" : "Configuration file found at '/home/seccubus/etc/config.xml'",
"result" : "OK",
"name" : "Configuration file"
},
{
"message" : "The path for 'modules', '/home/seccubus/SeccubusV2' defined in '/home/seccubus/etc/config.xml', was found",
"name" : "Path modules",
"result" : "OK"
},
{
"result" : "OK",
"name" : "Path scanners",
"message" : "The path for 'scanners', '/home/seccubus/scanners' defined in '/home/seccubus/etc/config.xml', was found"
},
{
"name" : "Path bindir",
"result" : "OK",
"message" : "The path for 'bindir', '/home/seccubus/bin' defined in '/home/seccubus/etc/config.xml', was found"
},
{
"message" : "The path for 'configdir', '/home/seccubus/etc' defined in '/home/seccubus/etc/config.xml', was found",
"result" : "OK",
"name" : "Path configdir"
},
{
"name" : "Path dbdir",
"result" : "OK",
"message" : "The path for 'dbdir', '/home/seccubus/db' defined in '/home/seccubus/etc/config.xml', was found"
},
{
"name" : "Database login",
"result" : "OK",
"message" : "Login to database 'Seccubus' on host 'localhost' with the credentials from '/home/seccubus/etc/config.xml', was successful"
},
{
"message" : "Your database does have datastructures in it.",
"name" : "Database structure",
"result" : "OK"
},
{
"name" : "Database version",
"result" : "Error",
"message" : "Your database is not current, please execute the sql statements in '/home/seccubus/db/upgrade_v1_v2.mysql' to update the database to the next version and rerun this test"
}

]

@blabla1337
Copy link
Contributor

So it looks like you are using the Seccubus v1 mysql schema and you need the v2:

{
"name" : "Database version",
"result" : "Error",
"message" : "Your database is not current, please execute the sql statements in '/home/seccubus/db/upgrade_v1_v2.mysql' to update the database to the next version and rerun this test"
}

Seccubus has a convert script for this and it's called upgrade_v1_v2.mysql

This mysql file can be found here:
/home/seccubus/db/upgrade_v1_v2.mysql

Let me know if that helped.

@debojyotib
Copy link

Hi,

Thanks for the quick reply. I tried to run this. Nothing happenned. I can change the schema and load the Srtcuture_v2 and Data_v2. Will that help?

@blabla1337
Copy link
Contributor

Well yes, you need to have the database setup and use the structure_v2 and the data_v2.
I would suggest to delete the old Seccubus database and follow the steps again from the installation.
Below is from the installation page:

mysql << EOF
create database Seccubus;
grant all privileges on Seccubus.* to seccubus@localhost identified by ‘seccubus’;
flush privileges;
EOF

mysql -u seccubus -pseccubus Seccubus < /…/structure_vX.mysql # Use version
and path indicated on the screen > mysql -u seccubus -pseccubus Seccubus < /…/data_vX.mysql
Use version and path indicated on the screen and replace the X

https://www.seccubus.com/documentation/how-to-install-seccubus-v2/

Let me know if you get stuck again.

@MrSeccubus
Copy link
Member

MrSeccubus commented Jul 15, 2015

Depending on the version of Seccubus you installed you may need to install the latest version which is v6. It is best to drop and recreate the database and see which version is desired.

@debojyotib
Copy link

Hi,

I dropped the db and updated the same with structure_v6 and data_v6. The Configtest.pl does not throw up any error.

However, I am not able to create the workspace at all. It gets stuck and shows creating. Is there anything that I am missing?

@debojyotib
Copy link

Hi,

Please let me know how to go ahead. The workspace creation simply does not work.

@MrSeccubus
Copy link
Member

@bebojyotib I just returned from a period of being offline. Is there any more information you can offer? Any errors in your web server log?

@sandroded
Copy link

I installed Seccubus V 2.17 on Kali 2.0 with deb package.
When try to run scan - get the same error.
./do-scan --workspace test_workspace --scan test_nessus -v
Can't locate SeccubusV2.pm in @inc (you may need to install the SeccubusV2 module) (@inc contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at ./do-scan line 20.
BEGIN failed--compilation aborted at ./do-scan line 20.

/opt/seccubus/www/seccubus/json/ConfigTest.pl
Expires: Mon, 05 Oct 2015 14:21:14 GMT
Date: Tue, 06 Oct 2015 14:21:14 GMT
Cache-control: no-store, no-cache, must-revalidate
X-clacks-overhead: GNU Terry Pratchett
Content-Type: application/json; charset=ISO-8859-1

[
{
"message" : "Configuration file found at '/etc/seccubus/config.xml'",
"result" : "OK",
"name" : "Configuration file"
},
{
"message" : "The path for 'modules', '/opt/seccubus/SeccubusV2' defined in '/etc/seccubus/config.xml', was found",
"result" : "OK",
"name" : "Path modules"
},
{
"message" : "The path for 'scanners', '/opt/seccubus/scanners' defined in '/etc/seccubus/config.xml', was found",
"result" : "OK",
"name" : "Path scanners"
},
{
"name" : "Path bindir",
"result" : "OK",
"message" : "The path for 'bindir', '/opt/seccubus/bin' defined in '/etc/seccubus/config.xml', was found"
},
{
"message" : "The path for 'configdir', '/etc/seccubus' defined in '/etc/seccubus/config.xml', was found",
"name" : "Path configdir",
"result" : "OK"
},
{
"name" : "Path dbdir",
"result" : "OK",
"message" : "The path for 'dbdir', '/var/lib/seccubus' defined in '/etc/seccubus/config.xml', was found"
},
{
"message" : "Login to database 'seccubus' on host 'localhost' with the credentials from '/etc/seccubus/config.xml', was successful",
"name" : "Database login",
"result" : "OK"
},
{
"name" : "Database structure",
"result" : "OK",
"message" : "Your database does have datastructures in it."
},
{
"message" : "Your database has the base data and is the current version.",
"result" : "OK",
"name" : "Database version"
},
{
"message" : "No smtp configuration specified in you config file, notification will NOT be sent",
"name" : "SMTP configuration",
"result" : "Warn"
}
]

@MrSeccubus
Copy link
Member

MrSeccubus commented Oct 6, 2015

Go to /opt/seccubus and run bin/do-scan instead of ./do-scan

@sandroded
Copy link

Thank you. It works now

@MrSeccubus
Copy link
Member

Need to add this to the faq.

@randakar
Copy link
Contributor

randakar commented Apr 1, 2016

Recreated this problem on debian after installation using git clone from the repo.

The problem is simply that the perl package policy on debian (https://www.debian.org/doc/packaging-manuals/perl-policy/ch-site.html) does not include /opt. By doing that "cd /opt/seccubus" you're temporarily fixing that but .. it's a workaround. The right way to do it would probably be to somehow link all of the perl modules into /usr/local/lib somewhere. Link, not move, because you want to retain git's version tracking if you do that.

Something similar should happen to the files in bin, btw. Those belong in /usr/local/bin or alternatively, /opt/seccubus/bin should be added to $PATH. The latter is easy to fix on a per-user basis (a mild edit of ~/.profile is enough) but this include path problem remains.

@randakar
Copy link
Contributor

randakar commented Apr 1, 2016

Actually, there's another workaround:

cat <<EOF >> ~/.bashrc
export PATH=$PATH:/opt/seccubus/bin
export PERL5LIB=/opt/seccubus:/opt/seccubus/SeccubusV2:$PERL5LIB
EOF

Login, logout, and do-scan should simply work without tricks.
Or run those two lines:

export PATH=$PATH:/opt/seccubus/bin
export PERL5LIB=/opt/seccubus:/opt/seccubus/SeccubusV2:$PERL5LIB

.. and fix it for the current session.

Still a workaround, mind, but at least we don't have to cd to /opt/seccubus every time anymore.

@MrSeccubus
Copy link
Member

@randakar this way all users will ba able to run the code as admin. The new rpm packaing restricts that ability to the seccubus user in which case I don;t see the need to add it to the path.

@randakar
Copy link
Contributor

randakar commented Jun 8, 2016

You realise that this whole thread is about running the program outside of any of the packaging systems, right?

Unless you plan to make RPM / deb package installation the only supported mode of operation I don't see how RPM packaging policy is relevant.

@MrSeccubus
Copy link
Member

I used the rpm policy to illustrate why I feel it is generally not a good thing to have this in your path and accessible for all users.
If you are installing manually you can use the options for install.pl (especially the --moddir option) to put the pm files in the location you desire.

However Infeel like I may be misinterpreting your question. If this doesn't answer it, can you please clarify?

@MrSeccubus MrSeccubus reopened this Jun 8, 2016
@randakar
Copy link
Contributor

randakar commented Jun 8, 2016

It's been a while since I did that seccubus installation. I may be a little fuzzy on the details.

However, it seems to me that if running 'install.pm' (I only see a install.pl in the seccubus dir) is something that should be part of the installation procedure, this should be mentioned in the document detailing how to install seccubus.
Furthermore, it may be nice if do-scan did not blow up with a 'cannot find module' error but actually informed the user they need to run install.pl or (re)install the package.

So documentation and clear error messages is the actual issue here.

As for /opt .. Normally on debian systems /usr/local is the correct place to stash custom installs outside the packaging system. I suspect that simply dropping the modules in there (in the right library dir) would also be enough to solve this. I'm surprised that somebody installed things in /opt on this particular system. It's still better than /home/seccubus (which IMHO is an abomination - /home is for user directories, not system software) but definitely not supported by debian very well.

@jeannotteb
Copy link

I've installed seccubus a few times on my debian machine and have been having the same issues. Even with including /opt/seccubus into PATH and the PERL5LIB variables I've noticed some problems. On the command line I can execute any seccubus executable. But trying to surf to the GUI only the HTML loads. Using OWASP-Zap as a sorta debugger I found out that the scripts are executing, but returning 500 Internal server issue codes. Looking at the logs for apache I notice that all of them can't find Seccubus.pm. I decided to check out the perl executables themselves and noticed that it specifies to
use lib "..";
and then going a directory back there is a symlink from Seccubus.pm to /opt/seccubus/Seccubus.pm. I don't know if this was very much intentional or not, but then I noticed that if I were to change an executable to
use lib "/opt/seccubus";
that that ONE executable would run in the GUI correctly.(using Zap to see which ones throw 500 codes or not). So I guess I'm asking if there's something very wrong with changing where use lib points to, or if doing that will break something eventually and it was intentionally done that way with a sym link.

@jeannotteb
Copy link

Now the scripts are running just fine, but there seems to be a problem with seccubus relaying information to the database.(I've installed and re-installed several times and these problems persist every time on my debian system). I ran a scan from the command line and navigated to the web interface to check on it(I've been having problems with the GUI) and going to the results of the nmap scan I get this..
Problem with execution of sql statement SELECT count(*)
FROM rights, user2group, user
WHERE
rights.workspace_id = ? and
rights.allow_read > 0 and
rights.group_id = user2group.group_id and
user2group.user_id = user.id and
user.username = ?

Table 'seccubus.user' doesn't exist at /opt/seccubus/SeccubusV2/SeccubusDB.pm line 159.
SeccubusDB::sql("return", "array", "query", "SELECT count(*)\x{a}\x{9}\x{9}\x{9} \x{9}\x{9} FROM rights, user2group, user\x{a}\x{9}\x{9}\x{9}\x{9}\x{9}"..., "values", ARRAY(0x563dd982bc50)) called at /opt/seccubus/SeccubusV2/SeccubusRights.pm line 190
SeccubusRights::may_read(100) called at /opt/seccubus/SeccubusV2/SeccubusRuns.pm line 217
SeccubusRuns::get_attachment(100, 2, 1, 3) called at /opt/seccubus/www/html/seccubus/json/getAttachment.pl line 54
ModPerl::ROOT::ModPerl::PerlRun::opt_seccubus_www_html_seccubus_json_getAttachment_2epl::handler(Apache2::RequestRec=SCALAR(0x563dd9062c90)) called at /usr/lib/x86_64-linux-gnu/perl5/5.24/ModPerl/RegistryCooker.pm line 207
eval {...} called at /usr/lib/x86_64-linux-gnu/perl5/5.24/ModPerl/RegistryCooker.pm line 207
ModPerl::RegistryCooker::run(ModPerl::PerlRun=HASH(0x563dd9293568)) called at /usr/lib/x86_64-linux-gnu/perl5/5.24/ModPerl/RegistryCooker.pm line 173
ModPerl::RegistryCooker::default_handler(ModPerl::PerlRun=HASH(0x563dd9293568)) called at /usr/lib/x86_64-linux-gnu/perl5/5.24/ModPerl/PerlRun.pm line 32
ModPerl::PerlRun::handler("ModPerl::PerlRun", Apache2::RequestRec=SCALAR(0x563dd9062c90)) called at -e line 0
eval {...} called at -e line 0

@jeannotteb
Copy link

This error occured an hour or two ago, I've done nothing to fix it except now I reloaded the webpage a few times to be able to copy that error message and now it's communicating with the DB server just fine and my results are formatted and appear..(?)

@MrSeccubus
Copy link
Member

This should be fixed with #411 as well

MrSeccubus added a commit that referenced this issue Jun 15, 2017
@MrSeccubus
Copy link
Member

@lianfeng30 your do-scan command is reporting that it cannot find a configuration file. The configuration file holds the location of the modules.
How did youninstall seccubus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants