LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-14-2012, 07:04 AM   #1
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Rep: Reputation: 21
Wapiti install script issue


I have setup Wapiti in /usr/local/wapiti but get the following error message upon during the install:

http://www.hacktoolrepository.com/tool/125/Wapiti

user@localhost:~$ sudo -s
root@localhost:~# sh /usr/local/src/Wapiti/Wapiti.sh
usage /usr/local/src/Wapiti/Wapiti.sh username
username is the person you normally log on with that will configure and make the program
root@localhost:~# sh /usr/local/src/Wapiti/Wapiti.sh user
/usr/local/sbin/setpath.sh: You must be root to run /usr/local/sbin/setpath.sh
bash: líne 7: cd: /usr/local/src/Wapiti/setpath: No such file or directory
cd: 122: can't cd to /usr/local/src/Wapiti/setpath
.....................................................
/usr/local/src/Wapiti/Wapiti.sh: 141: /usr/local/sbin/setpath: not found
root@localhost:~# sh /usr/local/src/Wapiti/Wapiti.sh root
grep: option requires an argument -- 'd'
Usage: grep [CHOICE]... [DIRECTORY]...


In the wapiti.sh

#The directory where the source can be downloaded and build
SRCDIR='/usr/local/src/Wapiti'
#The directory where the software should be installed
TRGDIR='/usr/local'

PATH185="http://www.hacktoolrepository.com/files/Miscellaneous/setpath/setpath.sh"
FILE185="setpath.sh"
DIR185="setpath"
PROG185="setpath"

PATH125="http://www.hacktoolrepository.com/files/Web%20applications/Wapiti/wapiti-2.2.1.tar.bz2"
FILE125="wapiti-2.2.1.tar.bz2"
DIR125="wapiti-2.2.1"
PROG125="wapiti"

line 122 cd "${SRCDIR}/${DIR185}"
line 141 ${TRGDIR}/sbin/setpath ${TRGDIR}/wapiti/

Directory setup:
root@localhost:~# ls -ld /usr/local/src/Wapiti/*
-rw-r--r-- 1 user user 545 2011-05-20 09:26 /usr/local/src/Wapiti/setpath.sh
drwxr-xr-x 4 user users 4096 2009-12-29 18:11 /usr/local/src/Wapiti/wapiti-2.2.1
-rw-r--r-- 1 user user 405418 2010-01-06 06:27 /usr/local/src/Wapiti/wapiti-2.2.1.tar.bz2
-rw-r--r-- 1 user user 4094 2012-03-14 10:35 /usr/local/src/Wapiti/Wapiti.sh

root@user:~# ls -ld /usr/local/sbin/*
-rwxr-xr-x 1 root root 545 2012-03-14 11:43 /usr/local/sbin/setpath.sh

How can I get the setpath.sh to run properly as part of wapiti.sh?

Last edited by shayno90; 03-14-2012 at 07:09 AM.
 
Old 03-14-2012, 09:48 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,731
Blog Entries: 1

Rep: Reputation: 224Reputation: 224Reputation: 224
You would need to hack the Wapiti.sh script so it works. From a quick look at Wapiti.sh, you should be able to comment out line 122 and then add a .sh to setpath in line 141. Of course, you could not use Wapiti.sh at all. I don't know what the setpath.sh script does, but Wapiti.sh just moves the wapiti-2.2.1 directory to /usr/local/wapiti. You could do that yourself if you wanted. You could also just keep wapiti-2.2.1 somewhere in your $HOME and execute it according to the INSTALL document that comes with wapiti.
 
Old 03-14-2012, 11:47 AM   #3
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by weibullguy View Post
You would need to hack the Wapiti.sh script so it works. From a quick look at Wapiti.sh, you should be able to comment out line 122 and then add a .sh to setpath in line 141. Of course, you could not use Wapiti.sh at all. I don't know what the setpath.sh script does, but Wapiti.sh just moves the wapiti-2.2.1 directory to /usr/local/wapiti. You could do that yourself if you wanted. You could also just keep wapiti-2.2.1 somewhere in your $HOME and execute it according to the INSTALL document that comes with wapiti.
I edited the wapiti.sh script to:
line 122 #cd "${SRCDIR}/${DIR185}"
line 144 ${TRGDIR}/sbin/setpath.sh ${TRGDIR}/wapiti/

but it still complains:
root@localhost:~# sh /usr/local/src/Wapiti/Wapiti.sh root
grep: option requires an argument -- 'd'
Use: grep [CHOICE]... [DIRECTORY]...
Run as `grep --help' to get more help.
grep: option requires an argument -- 'd'
Use: grep [CHOICE]... [DIRECTORY]...
Run as `grep --help' to get more help.
bash: line 7: cd: /usr/local/src/Wapiti/setpath: No such file or directory

Line 7 in wapiti.sh is
# (c) http://www.hacktoolrepostory.com

Line 7 in setpath.sh is
#!/bin/bash

if [ -z $1 ] ; then
echo "Need a directory as argument to add to the path"
exit 1
else
PREFIX="$1" (Line 7)
fi

I assume setpath.sh is to check the path variable and user running the script is correct?

I would like to compile it this way in order to confirm I can run it via this method.
 
Old 03-15-2012, 05:21 AM   #4
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
I am using Openvas and in the report it says about Wapiti:

"wapiti could not be found in your system path.
OpenVAS was unable to execute wapiti and to perform the scan you
requested.
Please make sure that wapiti is installed and that wapiti is
available in the PATH variable defined for your environment."

This is why I want to correct the setpath.sh script to work with the wapiti.sh script.
The setpath.sh script is a "bash script to set the path for all users including root".

I want to install it in /usr/local/bin or symlink it to there from /usr/local.

Any thoughts on this?

Last edited by shayno90; 03-15-2012 at 10:59 AM.
 
Old 03-15-2012, 12:16 PM   #5
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
Ok I solved one error by doing the following:

Remove existing wapiti package installations:

root@user:~# rm -r /usr/local/wapiti/
root@user:~# rm -r /usr/local/src/Wapiti/

Note**
/usr/local/sbin/setpath.sh: You must be root to run /usr/local/sbin/setpath.sh

Edit the Wapiti.sh script on line 144

root@localhost:~# nano Wapiti.sh
replace
${TRGDIR}/sbin/setpath ${TRGDIR}/wapiti/
change to
${TRGDIR}/sbin/setpath.sh ${TRGDIR}/wapiti/
root@shayno90:~# sh Wapiti.sh user

Running as root removes these warnings:
bash: line 6: setpath.sh: cannot find command

However this error still remains as it looks for a directory that was not created by the Wapiti.sh script:
bash: line 7: cd: /usr/local/src/Wapiti/setpath: No such file or directory

In the directory /usr/local/src/Wapiti/ it only contains:
root@localhost:~# ls -l /usr/local/src/Wapiti/
total 404
-rw-r--r-- 1 user user 545 2011-05-20 09:26 setpath.sh
drwxr-xr-x 4 user user 4096 2009-12-29 18:11 wapiti-2.2.1
-rw-r--r-- 1 user user 405418 2010-01-06 06:27 wapiti-2.2.1.tar.bz2

What else should be changed in the Wapiti.sh script to correct this? (The problem areas of the script are below)

PATH185="http://www.hacktoolrepository.com/files/Miscellaneous/setpath/setpath.sh"
FILE185="setpath.sh"
DIR185="setpath"
PROG185="setpath"

cd "${SRCDIR}/${DIR185}"
cp setpath.sh ${TRGDIR}/sbin/
chmod +x ${TRGDIR}/sbin/setpath.sh

cd "${SRCDIR}/${DIR125}"
mkdir -p ${TRGDIR}/wapiti/ && cp -R ${SRCDIR}/${DIR125}/* ${TRGDIR}/wapiti/
${TRGDIR}/sbin/setpath.sh ${TRGDIR}/wapiti/

Last edited by shayno90; 03-16-2012 at 04:09 AM.
 
Old 03-15-2012, 09:36 PM   #6
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,731
Blog Entries: 1

Rep: Reputation: 224Reputation: 224Reputation: 224
Commenting this line
Code:
cd "${SRCDIR}/${DIR185}"
doesn't resolve the error? Also, can you wrap the code in code tags? It's a lot easier to read.
 
Old 03-16-2012, 05:46 AM   #7
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
No commenting that did not work in Wapiti.sh:

#!/bin/bash
#cd "${SRCDIR}/${DIR185}"

Error message:
/usr/local/sbin/setpath.sh: You must be root to run /usr/local/sbin/setpath.sh
bash: líne 7: cd: /usr/local/src/Wapiti/setpath: No such file or directory


From setpath.sh:

#!/bin/bash

if [ -z $1 ] ; then
echo "Need a directory as argument to add to the path"
exit 1
else
PREFIX="$1"
fi
 
Old 03-16-2012, 09:31 AM   #8
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,731
Blog Entries: 1

Rep: Reputation: 224Reputation: 224Reputation: 224
I guess wrapping the code in code tags didn't work? Try removing this code in Wapiti.sh that starts around line 117
Code:
"${FILE185}" -d "${DIR185}"
cd "${SRCDIR}/${DIR185}"
 
1 members found this post helpful.
Old 03-17-2012, 05:23 PM   #9
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
Yes that worked thanks.

Comment out line 117/118
"${FILE185}" -d "${DIR185}"
cd "${SRCDIR}/${DIR185}"
to
# "${FILE185}" -d "${DIR185}"
# cd "${SRCDIR}/${DIR185}"

Comment out line 122
change
cd "${SRCDIR}/${DIR185}"
to
#cd "${SRCDIR}/${DIR185}"

edit and line 141
change
${TRGDIR}/sbin/setpath ${TRGDIR}/wapiti/
to
${TRGDIR}/sbin/setpath.sh ${TRGDIR}/wapiti/


Run the script as:

user@localhost:~$ sudo sh Wapiti.sh user

You should get no errors related to directories or user privileges.

However I am not sure why script wanted to create a setpath directory?

Next I want to run Wapiti with Openvas but have previously got this error:

"wapiti report filename is empty. that could mean that
wrong version of wapiti is used or tmp dir is not accessible.
Make sure to have wapiti 2.x as wapiti 1.x is not supported.
In short: check installation of wapiti and OpenVAS"

I tried symlinking wapiti.py to the following directories but this did not work:
/usr/local/bin
/usr/bin

Then I tried creating a small shellscript to run in $PATH:
Code:
#!/bin/sh
cd //usr/local/src/Wapiti/wapiti-2.2.1/src/
./wapiti.py $*
and adding this line to the end of ~/.profile
#run wapiti script
:/user/scripts/wapiti.sh

No luck with this unfortunately, any suggestions?

Last edited by shayno90; 03-19-2012 at 10:01 AM.
 
Old 03-19-2012, 08:00 AM   #10
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
According to this guide:
http://www.ict-romulus.eu/web/wapiti.../Users%20Guide

Examples

python wapiti.py http://server.com/base/url/ -o my_report_folder -f html
python wapiti.py http://server.com/base/url/ -v 2

This examples works if python executable is in the PATH environment variable and you are in the root directory of Wapiti. In other case you cannot execute the application like in the examples and you have to put all the path to Python executable.
For example:
Windows:

C:\Python25\python C:\Wapiti\wapiti.py http://server.com/base/url/ -o my_report_folder -f html

Linux:

/usr/bin/python /home/user/wapiti.py http://server.com/base/url/ -o my_report_folder -f html
---------------------------------------------------------------------------------------------------------------------
I will change the wapiti script to this:

Code:
#!/bin/sh
cd //usr/local/src/Wapiti/wapiti-2.2.1/src/
python wapiti.py $*
instead of
./wapiti.py

as when run in the command line it gave an error such as command not found.

I will launch a scan on Openvas to see if it can run the Wapiti scan.
 
Old 03-19-2012, 10:43 AM   #11
shayno90
Member
 
Registered: Oct 2009
Distribution: Debian Lenny 2.6.26 Ubuntu Lucid Lynx 10.04 Windows 7
Posts: 187
Blog Entries: 2

Original Poster
Rep: Reputation: 21
The Openvas scan still does not run script giving the same error:
"wapiti report filename is empty. that could mean that
wrong version of wapiti is used or tmp dir is not accessible.
Make sure to have wapiti 2.x as wapiti 1.x is not supported.
In short: check installation of wapiti and OpenVAS"

I testing the script command in the terminal and it runs.

I also increased the timeout for the Wapiti plugin to run to 900 seconds from the default and still no change.

I am running Wapiti 2.2.1 so need so more insight into resolving this.
 
  


Reply

Tags
error, path, root, script, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 13 Installation issue -- Unable to install multiple linux distributions ---partition issue navneethr Linux - General 6 12-22-2010 11:17 PM
Issue with Script?? linuxshadow Linux - Newbie 1 06-11-2008 01:28 AM
Script Issue ryanbrimmer Linux - Newbie 1 06-16-2007 04:23 AM
sh script issue. UltraSoul Solaris / OpenSolaris 4 03-29-2007 04:31 PM
Script Issue gauge73 Linux - General 8 07-14-2003 08:50 AM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration