Bekijk de volledige versie : Compiled some tools for x-mas!

Rob ter Veer
22-12-2004, 18:29

Compiled some goodies for the WL500g. First is Darkstat, a graphical IP accounting tool:




Second is iplog, which can log portscans smurf attacks and so on:


And last but not least ltraf which can show realtime throughput:


Have fun!

22-12-2004, 20:50
Gee, thanks! :)

Ho Ho Ho

Rob ter Veer
24-12-2004, 13:04
Also compiled axel which is an wget alternative. Axel tries to accelerate downloads by using multiple connections (possibly to multiple servers) for one download.


And the lutz portscanner with OS identifier:


27-12-2004, 01:46
Tnx for the x-mas present :)
Can you tell me how can I use the ltraf tool? It appears to require some bpf something. I need it to show me the realtime throughput. Tnx again.

Rob ter Veer
27-12-2004, 08:52
Tnx for the x-mas present :)
Can you tell me how can I use the ltraf tool? It appears to require some bpf something. I need it to show me the realtime throughput. Tnx again.

What message do you get excactly?

27-12-2004, 13:22
I also have some troubles getting it to work:

[admin@wifi sbin]$ ltraf -s -Dk
Segmentation fault
Using: Oleg CR2

27-12-2004, 13:30
Just remove -s or specify valid filter string.

ltraf -I eth1 -Dk

27-12-2004, 17:39
ltraf -I eth1 -Dk
This does the job, tnx Oleg. I got confused by the options line of ltraf:

ltraf -s bpf|-d bpf [-i interface][-v]
I thought (-s bpf or -d bpf) is mandatory. What is this bpf anyway? Some sort of filter language perhaps? Is there some easy way to learn it?

28-12-2004, 00:53
Hi. Will somebody so good and can post here all steps of instalation the x-mas stuff ;-) pls from plugin the usb key with files into ap plssss. I do that first time. :( :( :( :( :( plsssssss


28-12-2004, 08:03
Because you don't say how much you actually know, I'll be generous :) and detailed.

First you plug the USB stick (or disk) into the wl500g. It will automount.
From command prompt type
telnet x.x.x.x (where x.x.x.x is the ip address of the wl500g). Use the same username and password you use to log to the web interface.

When you are in the wl500g
cd /tmp/harddisk , where you should find your files.
mkdir /tmp/xmas
cp ltraf.gz /tmp/xmas
cd /tmp/xmas
gunzip ltraf.gz
chmod 777 ltraf
./ltraf -I eth1 -Dk

If you want to stop the program, Ctrl+C.

Same goes for the other programs. You should get yourself acquainted with the linux shell if you are a completely new to linux though.

28-12-2004, 09:29
Rob, I use the following syntax that gives me segmentation fault:
./ltraf -d "host" or
./ltraf -s "host"

Probably it's a pcap issue. How did you compile the programs?

28-12-2004, 11:39
Chupra THNXXX very very mutch it works :D :D

Rob ter Veer
31-12-2004, 09:15
Rob, I use the following syntax that gives me segmentation fault:
./ltraf -d "host" or
./ltraf -s "host"

Probably it's a pcap issue. How did you compile the programs?

I have my compile environment setup at work ;) I will check out my compile configuration this afternoon.. I first compiled pcap (I think it was with defaults), installed it so that libraries can be found and then compiled ltraf.

Rob ter Veer
31-12-2004, 10:53
Compiled libpcap with:

./configure --host=mips --with-pcap=linux --prefix=/opt/brcm/hndtools-mipsel-uclibc

Edited the Makefile of ltraf and changed the CC:


I also used this version of the compiled libpcap for darkstat. With darkstat I had no problems at all so far.

07-01-2005, 04:14
A nice utilities. :) Thanks a lot! I have tested it under and firmwares. Everything is working fine. Just these libraries needs to be copied to /LIB folder:

Rob ter Veer
07-01-2005, 15:59
A nice utilities. :) Thanks a lot! I have tested it under and firmwares. Everything is working fine. These libraries needs to be copied to /LIB folder:

Humm... That's strange.. Are these libs default included in the 1.9 firmwares? Gonna check that out at home.

20-01-2005, 02:18
Hi, I can get darkstat to run fine of my USB pendrive, but I can't seem to get it to run as a daemon using the --detach keyword.

Her is what it prints when i start it:

[admin@myrouter /tmp]$ ./darkstat -d /tmp/harddisk/darkstats/ -p 81 --detach
darkstat v2.6 using libpcap v2.4 (mipsel-unknown-linux-gnu)
[admin@myrouter /tmp]$ Firing up threads...
Sniffing on device br0, local IP is
GRAPH: Starting at 5 secs, 55 mins, 1 hrs, 20 days.
Loaded /tmp/harddisk/darkstats/darkstat.db.
ACCT: Capturing traffic...
Point your browser at http://localhost:81/ to see the stats.

And when running ps i get this:

139 admin 636 S ./darkstat -d /tmp/harddisk/darkstats/ -p 81 --detach
140 admin 636 S ./darkstat -d /tmp/harddisk/darkstats/ -p 81 --detach
141 admin 636 S ./darkstat -d /tmp/harddisk/darkstats/ -p 81 --detach
Any ideas?
My firmware is

While I'm here I might as well ask a more general question..
I have a small network setup sharing my Internet connection with 4 neighbors. I want to be able to monitor my network a little, and specifically in two ways:
- Some network statistic over the usage of each neighbor. (What and how much)
- Some realtime information of who is on at the moment, and how much resources are they using (Ie. are they browsing, playing online or downloading (p2p))
Any ideas for the best way of accomplishing this? From this forum I have looked a bit into Iptraf and darkstat, and tried unsuccesfully to get the Graphical IP accounting running. But I am still unsure of the best way of achieving what I want, so all suggestions are welcome.. If you have a tool not mentioned above that I should try out, or if you have some suggestions of how I can use iptraf or darkstat..


PS: Didn't need any extra libs to run darkstat.. Could just run it right of my usb pendrive..

19-02-2005, 18:33
hi pls can you help me whit which parameter in command can ai changing switch device. Default is eth0 set and that is by me WLAN i want to mi WiFi site sniffing. Thnx

19-02-2005, 21:22
use ./darkstat -i br0 or ./darkstat -i eth1 or ./darkstat -i eth2

see which one is working for you. Somebody with wl500g could confirm this.

20-02-2005, 02:49
Thnx br0 has worked ethx not.

08-04-2005, 00:18
Could somebody how exactly to compile darkstat (and libpcap)? I tried all combinations of parameters for ./configure, environment variables and Makefile editing. No matter what I did, either it didn't work at some point or they compiled for i386 and not mips.

I'm using the tools from GPL_1927 as well as the official sources of darkstat and libpcap.

Thanks a lot!

08-04-2005, 17:40
Edited: This should have been posted in another thread at first:

Since nobody answered, I solved the problem myself. I'll give some details here in case somebody wants to do something similar.

I first compiled libcap using the compile-libcap.sh on the original sources.

Then I modified darkstat to include a check in the main accounting cycle. I modified darkstat.c, darkstat.h, bignum.h, acct.c and acct.h. The result is now in darkstat-2.6.tar.gz (updated, not original sources). I used compile-darkstat.sh to cross-compile it. I had to manually insert a new line 2092 (cross_compiling=no) in the configure script, to fool the compiler not to do some impossible tests. The resulting executable darkstat is included with this post.

I added a new cmd parameter to darkstat "-limit trafficLimitInMB" which specifies the traffic volume after which the connection will be terminated (route del default). By default this limit is 3000 MB.

Next I'll try to implement a similar functionality with iptables, scripts and cron as suggested. For now I needed this as an emergency solution.

Have fun!


02-05-2005, 20:42
Hi i want to add darkstat to start when i restarting the asus WL500G i have a usb key. On the usb key i have the darkstat, but when i restart the Asus then i mus manualy starting darkstat. How can i do that automaticly ?

02-05-2005, 21:45
Read up on post-boot, post-mount scripts!
I.e. http://oleg.wl500g.info


20-05-2005, 23:53
I tried but nothing works :-( Can you one examle to add me ?

21-05-2005, 00:39
mkdir -p /usr/local/sbin
echo "#!/bin/sh" > /usr/local/sbin/post-mount
echo "/tmp/harddisk/darkstat" >> /usr/local/sbin/post-mount
chmod +x /usr/local/sbin/post-mount
flashfs save
flashfs commit
flashfs enable

Edit location and parameters for darkstat.
Flashfs enable can be skipped if flashfs is already enabled.

See how that works.

Edit: Added chmod

22-05-2005, 11:06
I tryed it give to post-boot

22-05-2005, 11:14
Well post-boot will most likely run before harddisk is mounted. So if darkstat runs from harddisk it won't be found and can't be started. So use post-mount.


22-05-2005, 11:19
hmm nothing :-(

22-05-2005, 11:24
;-) it works thnx
i needed change mod to executable