PDA

Bekijk de volledige versie : How to make Wi-viz to work with Oleg's firmware!



nerodark
30-08-2005, 05:48
What is Wi-viz?

Read it at its homepage (http://students.washington.edu/natetrue/wiviz/)!

1. You have to have read some of the macsat's tutorials (http://www.macsat.com/index.php?menu=1&PHPSESSID=ac70334f0dabf5958fca52a98fc655ec) before starting. You will need the following packages before installing Wi-viz: ipkg, microperl, cron and thttpd.

2. Proceed to install ipkg if you didn't install it before. Refer to macsat's ipkg tutorial (http://www.macsat.com/ipkg.php) to install it. This package is needed to install all other packages required by Wi-viz.

3. Proceed to install microperl if you didn't install it before. Refer to macsat's perl tutorial (http://www.macsat.com/CGIPerlGuide.php) to install it. This package is needed to install a perl interpreter to make the cgi-bin directory active, also needed by Wi-viz.

4. Proceed to install cron if you didn't install it before. Refer to macsat's cron tutorial (http://www.macsat.com/cron.php) to install it. I say we need this package because I was not able to get Wi-viz to renew the packets at intervals. So, by installing a cron job, the Wi-viz binary is going to refresh those packets.

5. Proceed to install thttpd if you didn't install it before. Refer to macsat's web server tutorial (http://www.macsat.com/php_web.php) to install it. You need another http daemon because you cannot extract the Wi-viz files to the default www directory, you have to extract them to read/write path.

6. Of course, you either need a USB memory stick or a hard drive to mount a read/write access to /opt, or you cannot install Wi-viz. ALSO BE SURE TO INSTALL LIBPCAP FOR PACKET CAPTURING OR YOU WONT SEE ANYTHING ON THE WEBPAGE: ipkg install http://nthill.free.fr/openwrt/ipkg/experimental/20050418/libpcap_0.8.3-7_mipsel.ipk

7. Before continuing, you can use all macsat's default configurations described in his tutorials without any problems. The best thing is to follow everything, step by step, to avoid unknown errors.

----- TIME TO INSTALL WI-VIZ -----

8. Use the wget command to get its binaries as followed: wget http://students.washington.edu/natetrue/wiviz/wiviz-binaries.tar.gz

I know there are already a french and an english package of Wi-viz(fr/en) 1.0 but they are a pain in the ass :P

9. Now you can extract the files in your www directory (/opt/share): tar xvzf wiviz-binaries.tar.gz

You must now have a ./www/wiviz, ./usr/sbin, ./www/cgi-bin directories in the above folder.

10. This is very important, Make sure you locate the Wi-viz binary. It must be in /opt/share/usr/sbin/wiviz. This path will be used in your cron job you will set later.

11. Now you need to change some access, type in the following commands in your shell:

chmod 755 /opt/share/www
chmod 755 /opt/share/www/wiviz
chmod 644 /opt/share/www/wiviz/*
chmod 755 /opt/share/www/cgi-bin
chmod 755 /opt/share/www/cgi-bin/*

12. Now it is time to set up the cron job to receive packets. Remember to refer to the cron job tutorial mentioned earlier.

I suggest you set a cron job to execute an instance of /opt/share/usr/sbin/wiviz every 5 minutes for good results on the web output and to not overload the router's cpu too much.

13. Oh yeah, I think for better results, try to change the frequency channel to 11 using this link:
http://<router's ip address>/Advanced_Wireless_Content.asp

----- SET MONITOR MODE ON THE ROUTER -----

Another very important step: you have to put your router in monitor mode so it will load the "prism0" adapter that wiviz is looking for when it is trying to capture packets in the sky. To do this, type in your linux prompt:
wl monitor 1

----- FINAL STEPS -----

14. You are now ready to reboot your router and test Wi-viz.

15. Once your router has rebooted, try it at this address:

http://<router's ip address>/wiviz/wiviz.html

and hope it works :cool:

----- LITTLE BYPASS -----

I saw that I couldn't make the functions on the right of the webpage to work. Those functions are just timers but they would not start the wiviz binary when set to a new thing. This explains the cron job :confused:


IF YOU FIND ANYTHING INCORRECT IN THIS TUTORIAL, PLEASE POST A SOLUTION NEXT TO THIS, THANX!

dankan
13-09-2005, 02:55
Well nerodark am not a linux guru so please be patient with my questions.
Before I followed your instructions I had everything running perfect from Mascat's tutorials even the rrdtool.....but I am still not able to use Wi-viz.
Files were exctracted succesfully and all the directories were created ok.

What I did with cron is I created a /opt/etc/cron.5mins/wiviz.sh including :
#!/bin/sh
/opt/share/usr/sbin/wiviz

After saving to flash, rebooting and waiting for 10-15 min I got no results trying to access the webpage and I also cant see the images created from rrdtool. "500 Internal Error" while I can access my test web page at http://router_ip:81

trying to run wiviz directly gives me the following:
root]$ /opt/share/usr/sbin/wiviz
Wi-Viz infogathering daemon by Nathan True
Wireless magic not correct, not querying wl for info
Loading config file
Wiviz: No config file (/tmp/wiviz-cfg) present, using defaults
Failure to open pcap!
Err=ioctl: No such device

What I cant follow in your tutorial is :
i) what do you mean "You need another http daemon because you cannot extract the Wi-viz files to the default www directory, you have to extract them to read/write path." and how am I supposed to do this ?

ii) Can you give some more information regarding the cron set up part of your tutorial?

Thank you in advance for your help.

OlegI
13-09-2005, 18:33
i think it is a good idea rebuild distrib, because it has invalid file owner and permissions. So, after install /opt/shar/www has no permissions and webserver could not work.
wiviz not in PATH, it must be copied to /opt/sbin
unterminated string constant in wiviz-get.cgi line 8 must ends with ";"
and.... last effort... page is blank - wiviz does not work :)

nerodark
13-09-2005, 20:00
1) you already have an httpd daemon pointing to /www but this directory is readonly, i mean by this that you cannot install wiviz in /www. so you need to install another httpd daemon which is going to point to another directory like /opt/share/www that is readable/writable. but you could skip that part because i see you already have it because you were running other tools with it.

2) for the cron job: when you load wiviz.html into your browser you can see a little menu on the right to set the channel and intervals. i tried to play with that menu but wiviz would not load in the background with the new settings. so this is the reason for the cron job: i wanted it to load at some intervals (5mins). i will try to find a solution to that problem because it is unusual that wiviz wont reload by itself :P

concering your main error give me some days i will look at it more deeply

thanx

nerodark
13-09-2005, 23:36
everything works fine
it was only the chmod part of the tutorial
take a look at it, i modified it
also install libpcap (6th step) very important!!!

thanx

dankan
17-09-2005, 08:45
Thanks guys...the chmod did the work. I have at least the rrd graphs back and I can access the Wi-viz webpage but unfortunatelly with no graphs/information in it, just the menu on the right :confused: . I dont know how exactly is supposed to work but I assume that I should get some basic graphical info for my wireless network. Again when I try to run it directly from prompt I have the same output:
root]$ /opt/share/usr/sbin/wiviz
Wi-Viz infogathering daemon by Nathan True
Wireless magic not correct, not querying wl for info
Loading config file
Wiviz: No config file (/tmp/wiviz-cfg) present, using defaults
Failure to open pcap!
Err=ioctl: No such device

I had libpcap correctly installed. Also the content of the www folder looks ok:
root]$ ls -l /opt/share/www/wiviz/
-rw-r--r-- 1 admin root 332 Apr 8 22:48 adhoc-idle.gif
-rw-r--r-- 1 admin root 730 Apr 8 22:48 adhoc-idle.png
-rw-r--r-- 1 admin root 451 Apr 8 22:48 adhoc.gif
-rw-r--r-- 1 admin root 714 Apr 8 22:48 adhoc.png
-rw-r--r-- 1 admin root 812 Apr 8 22:48 ap-idle.gif
-rw-r--r-- 1 admin root 814 Apr 8 22:48 ap-idle.png
-rw-r--r-- 1 admin root 812 Apr 8 22:48 ap-wep-idle.gif
-rw-r--r-- 1 admin root 814 Apr 8 22:48 ap-wep-idle.png
-rw-r--r-- 1 admin root 1455 Apr 8 22:48 ap-wep.gif
-rw-r--r-- 1 admin root 1997 Apr 8 22:48 ap-wep.png
-rw-r--r-- 1 admin root 1468 Apr 8 22:48 ap.gif
-rw-r--r-- 1 admin root 1825 Apr 8 22:48 ap.png
-rw-r--r-- 1 admin root 190 Apr 8 22:48 pip-idle.gif
-rw-r--r-- 1 admin root 331 Apr 8 22:48 pip-idle.png
-rw-r--r-- 1 admin root 190 Apr 8 22:48 pip.gif
-rw-r--r-- 1 admin root 323 Apr 8 22:48 pip.png
-rw-r--r-- 1 admin root 754 Apr 8 22:48 station-idle.gif
-rw-r--r-- 1 admin root 1778 Apr 8 22:48 station-idle.png
-rw-r--r-- 1 admin root 929 Apr 8 22:48 station.gif
-rw-r--r-- 1 admin root 2476 Apr 8 22:48 station.png
-rw-r--r-- 1 admin root 1649 Apr 10 05:40 wiviz.css
-rw-r--r-- 1 admin root 2739 Apr 10 05:40 wiviz.html
-rw-r--r-- 1 admin root 8474 Apr 10 05:40 wiviz.js

Any suggestions welcome.....

nerodark
17-09-2005, 13:02
it still does not find libpcap though
you should look in your /opt/lib and see if you have the following files:
libpcap.so.0.8 -> libpcap.so.0.8.3
libpcap.so.0.8.3
(i use version 0.8.3 but you can have another version, it does not matter)

if you have them we will see for another possibility after

if you are sure you have them installed but you dont know where and want to copy them in /opt/lib, use this little script i made to search for them:
just type: ./find.sh / libpcap* and it will start searching. if you have any results, copy them to /opt/lib and try wiviz again

#!/bin/sh
# file: find.sh (chmod to +x)
# usage: ./find.sh <path> <file>
# example: ./find.sh / myfile

for i in $(du $1 2>/dev/null); do
if test -f $i/$2; then
echo $i/$2
fi
done

dankan
17-09-2005, 18:42
You were right, libpcap was not installed- I get the following error:
root]$ ipkg install libpcap_0.8.3-7_mipsel.ipk
Installing libpcap (0.8.3-7) to root...
ipkg: Cannot create symlink from ./usr/lib/libpcap.so.0.8 to 'libpcap.so.0.8.3': Read-only file system
ipkg: /usr/lib/libpcap.so.0.8.3: Read-only file system
Configuring libpcap
Successfully terminated.

Now what? I noticed the link you have in your tutorial for libpcap points for OpenWRT while am running Oleg's latest firmware. I dont know if there is a point here....

nerodark
17-09-2005, 19:21
by default, you have "dest root /" in /opt/etc/ipkg.conf (which is read-only)

so just add another line like (to point to read-write path) in /opt/etc/ipkg.conf:
dest harddisk /opt

then type: ipkg install libpcap_0.8.3-7_mipsel.ipk -d harddisk
(you might need to remove bad files before: ipkg remove libpcap)

after that you should be good :P

dankan
17-09-2005, 20:23
nerodark thanks for the quick replies. I did as you said and now I succesfully have these files in /opt/lib/ :
lrwxrwxrwx 1 admin root 16 Sep 17 21:06 libpcap.so.0.8 -> libpcap.so.0.8.3
-rw-r--r-- 1 admin root 171246 Apr 18 22:43 libpcap.so.0.8.3

Rebooted and tried again wiviz but no joy :( On the webpage i only have the menu and an empty main window....Running wiviz from prompt :
root]$ /opt/share/usr/sbin/wiviz
Wi-Viz infogathering daemon by Nathan True
Wireless magic not correct, not querying wl for info
Loading config file
Wiviz: No config file (/tmp/wiviz-cfg) present, using defaults
Failure to open pcap!
Err=ioctl: No such device

Well am thinking to remove all the directories/files of wiviz and do the thing from scratch now that I know how to install libpcap, but I doubt for the outcome....sorry for all this fuss...I will keep this thread updated.

dankan
17-09-2005, 21:21
Something that may help is a snap from my syslog:
Sep 17 22:20:45 thttpd[154]: spawned CGI process 1887 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 22:20:50 thttpd[154]: spawned CGI process 1898 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 22:20:55 thttpd[154]: spawned CGI process 1909 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 22:21:00 thttpd[154]: spawned CGI process 1922 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 22:21:05 thttpd[154]: spawned CGI process 1933 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 22:21:10 thttpd[154]: spawned CGI process 1944 for file 'cgi-bin/wiviz-get.cgi'

nerodark
17-09-2005, 22:36
can you paste what "tail /tmp/syslog.log" returns immediately after running wiviz? (if there are any errors of course made by wiviz)

or im starting to think your card wont call up packet capturing because it may not be in monitor mode
try this command and reply back:
wl monitor 1

dankan
17-09-2005, 22:47
Imediatelly after trying the webpage I get these at tail /tmp/syslog.log:
Sep 17 23:46:06 thttpd[154]: spawned CGI process 3890 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 23:46:11 thttpd[154]: spawned CGI process 3902 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 23:46:16 thttpd[154]: spawned CGI process 3916 for file 'cgi-bin/wiviz-get.cgi'
Sep 17 23:46:21 thttpd[154]: spawned CGI process 3931 for file 'cgi-bin/wiviz-get.cgi'

As I already wrote when I try to run wiviz from the router i get this:
[admin@newpc root]$ /opt/share/usr/sbin/wiviz
Wi-Viz infogathering daemon by Nathan True
Wireless magic not correct, not querying wl for info
Loading config file
Wiviz: No config file (/tmp/wiviz-cfg) present, using defaults
Failure to open pcap!
Err=ioctl: No such device


libpcap files are in /opt/lib ok

nerodark
17-09-2005, 23:00
Wireless magic not correct, not querying wl for info


do you have the wl binary?

dankan
18-09-2005, 06:21
Yes I have it:
/lib/modules/2.4.20/kernel/drivers/net/wl/wl.o :confused: :confused: :confused:

nerodark
18-09-2005, 14:58
what i meant was if you had THIS file: /usr/sbin/wl

dankan
18-09-2005, 15:58
Yes I have it:
-rwxr-xr-x 1 admin root 126628 Jun 28 22:54 wl

nerodark
18-09-2005, 17:48
i think i know why, after looking at the wiviz source:

wiviz is looking for the device "prism0" (you can see if it is loaded by typing "ifconfig" on your linux prompt)

wiviz then tries to capture packets, using the pcap methods, from that device and if that device does not exist or it cannot capture anything, it crashes when the pcap error message like the one you got

like i said before, on your linux prompt, type: wl monitor 1

this must load the wireless device

dankan
19-09-2005, 20:06
Thanks nerodarker, now it works after issuing "wl monitor 1" and then running wiviz from its path... I think you should update your tutorial in the first post to make it clear about these...Thanks again mate :D :D :D