[ previous ] [ next ] [ threads ]
 
 From:  "=?ISO-8859-1?Q?R=F6nnblom_Jan=E5ke_?= /Teknous" <jan dash ake dot ronnblom at skeria dot skelleftea dot se>
 To:  m0n0wall at lists dot m0n0 dot ch
 Subject:  scripts for testing captive portal
 Date:  Thu, 13 Dec 2007 16:44:44 +0100
Hi!

I thought I would share my simple scripts if anyone is interested in testing
captive portal with a higher load than you could manually create.

I use captive portal with a radius backend (Microsoft IAS and Active Directory).

I configure my m0n0wall with a 3 minutes idle timeout. I setup my lab m0n0wall
with a LAN address of 192.168.1.0 with 255.255.255.0 which gives me 254
addresses to play with. I give .1 to the CP and .2 to my test machine then
I use this script to set up another 240 ip aliases. 

---< cut >---
#!/bin/bash

for i in `seq 10 250`;
do
  ifconfig eth0:$i 192.168.1.$i 
done
---< cut >---

Which gives us eth0:10 to eth0:250 and now we can try it with:

ping 192.168.1.1 -I eth0:10

To simulate the login I use wget with --post-file which posts the data to the
webform.

get --bind-address=192.168.1.11 --no-check-certificate
https://wifiportal-test.skola.skelleftea.se:8001/index.html
--post-file=/tmp/post.data.txt

and post.data.txt contains this:
---< cut >---
auth_user=testuser&auth_pass=xxx&redirurl=http://www.sunet.se&accept=submit
---< cut >---

Now if that works we can automate this with a simple script to login 240 users:

---< cut >---
#!/bin/bash

for i in `seq 10 250`;
do
  echo $i
  wget --bind-address=192.168.1.$i --no-check-certificate
https://wifiportal-test.skola.skelleftea.se:8001/index.html
--post-file=/tmp/post.data.txt 
done
---< cut >---

If you name the above script to mw-login.sh we can run this forever. 

---< cut >---
#!/bin/bash

while [ 1 ];
do 
./mw-login.sh
sleep 30
done
---< cut >---

Or login 15 users at the same time (notice the & at the end of the line):

---< cut >---
#!/bin/bash

for i in `seq 10 25`;
do
  echo $i
  wget --bind-address=192.168.1.$i --no-check-certificate
https://wifiportal-test.skola.skelleftea.se:8001/index.html
--post-file=/tmp/post.data.txt -q & 
done
---< cut >---

I run this on Ubuntu Linux but it shouldn't be a problem under *BSD or whatever
you want.
You only have to adapt the creation of ip alias on your network interface.

Happy Hammering ;=)

=====================================================


Assistentgatan 23
931 77 Skelleftea (Sweden)
-----------------------------------------------------
Phone  : +46-910-58 54 24
Mobile : 070-397 07 43
Fax    : +46-910-58 54 99
URL    : http://skeria.skelleftea.se
-----------------------------------------------------
"Those who do not understand Unix are condemned to reinvent it, poorly." --
Henry Spencer