Meanwhile I have a rooted Notion Ink Adam running AdamComb v0.3. So I tried to get PirateBox running by using the built in tether app. Built in tethering uses Infrastructure mode, which solves above mentioned problem.
On my Adam this is really working fine and I hope that it will also run on other Android units.
I'll divide the post in two parts. The first part describes the technical details, so if someone has problems in getting this to work this might be helpful for further testing.
Along with setting up the scripts I have also written a plugin for PAW which should make setup really easy.
If you are not interested in the technical details you can right jump to the Installing the Plugin section.
Techical Details
Setting up the PirateBox during boot is done by PAW startup scripts.
The main tasks of these scripts are:
- Killing dnsmasq and restarting it with changed parameters, so that DNS requests always respond with the IP of the Android device.
- Configuring iptables so that requests to port 80 are redirected to the port PAW is listening on, because PAW can not operate on privileged ports.
- Change the PAW configuration to use the PirateBox Handler, which ensures that all unknown request are forwarded to the base URL (piratebox.org/).
The startup scripts are located in the subfolders 0 and 1 of the directory /sdcard/paw/etc/init. These folders represent PAW runlevels. Runlevel 0 is before the server starts and after server shutdown and 1 is after server start and before the server shuts down. Scripts beginning with S_ will be called on startup and scripts starting with K_ will be run at shutdown.
So here is a short summary what these scripts are doing.
0/S_PirateBox.bsh:
- Checks if tethering is running. If not none of the steps below will be performed.
- Kills the "original" dnsmasq process and starts a new one.
- Executesiptables commands to get port redirection working.
- Replaces the original PAW configuration with the PirateBox configuration.
1/S_SpirateBox.bsh:
- Checks if tethering is running. If not none of the steps below will be performed.
- Restores the original PAW configuration.
- Displays a PirateBox notification.
- Sets the max upload limit to 200MB.
1/K_S_SpirateBox.bsh:
- Clears the PirateBox notification.
- Kills dnsmasq process.
- Stops tetherig and restarts WiFi.
0/K_S_SpirateBox.bsh:
- Removes iptables rules for port redirection.
If you run into problems have a look at these scripts and try to run the commands inside the scripts individually.
Installing the Plugin
![]() |
| PAW Plug-in Menu |
After download extract the ZIP file to the /sdcard/paw/html/app/plugins directory of your Android device.
Now after re-entering the PAW web application, the PirateBox plugin should be visible in the Plugins menu.
If the plugin setup screen shows a warning in red, the installation is likely to fail, because some prerequisites are missing.
If no warnings are displayed, press the Install button. You can also try to setup a PirateBox Access Point (AP) automatically. I'm not sure, if this is working on all devices. If it's not working, please create an AP manually.
To uninstall the plugin, press the Uninstall button.
![]() |
| PirateBox Plugin |
It is important to note, that PirateBox will only be started if tethering is active before PAW starts up.
Otherwise the normal PAW configuration will be applied. So you can choose between these two configurations.
I hope that's not just working on my Adam but on many other devices as well.
Screenshost
Here are some screenshots from my setup...
![]() |
| PirateBox Startup |
![]() |
| Connected to PirateBox |
![]() |
| PirateBox on Nexus One |
![]() |
| PirateBox in Chromium |
Video
Here is a video that shows the PirateBox in action...
Update
Since version 0.3 of the plugin, PirateBox is also working on rooted Galaxy Nexus devices running Ice Cream Sandwich.
Here is a video...







I cant find these apps and all the PHP apps in the downloads. I think you have posted the PHP setup files instead. Also is the PAW server open source. I want to use it in a project.
ReplyDeleteThe link looks good to me.
ReplyDeleteHere is the direct download:
http://paw-android.fun2code.de/plugins/download/piratebox_plugin.zip
PAW for Android is not open source, but the project it is based on is:
http://paw-project.sourceforge.net/
If you would like to integrate PAW in your own project, have a look at PAW Runtime:
ReplyDeletehttp://fun2code-blog.blogspot.com/2010/09/paw-runtime.html
Thanks for that. Im a bit confused on the runtime. It doesnt seem to work for me. Im not sure of the difference between the two. I would be happy if I could get that to work. I will give it a try. The main thing I need is the connection bit at the moment. Is that in the runtime.
ReplyDeletemany thanks for quick reply.
I think there is a lot of scope for adding to this. I have speeded up a lot of the scripts but java etc are not my strong points. Just php etc.
Simon
If you send me a mail with a description what you want to do, I'll have a look.
ReplyDeletejochen[at]fun2code.de
Took me awhile to get piratebox plugin installed. Nowhere do you make it clear that the plugin menu is access through the web interface, but that's my only gripe about your amazing app. I'm still struggling with getting the piratebox plugin to run. It doesn't see Wi-fi Tether for Root is running I assume. I just flashed ICS onto this Nexus S 4G so perhaps there's a baked-in tether app onboard. I'll report back. So close!
ReplyDeleteThe plot thickens. I'm running an ICS rom (AOSP v6) on my Sprint Nexus S 4G. I installed Wi-fi Tether for Root Users, but there is a native tether application. The native tether app shuts down as soon as I turn it on. The Wi-fi Tether for Root Users causes this toast to pop up when I start the Paw Server. Screen Cap -> http://i.imgur.com/PbH2z.png
ReplyDeleteAny ideas?
This has been tested with HC/ICS with the native tethering app. The Galaxy Nexus was on stock 4.0.1 at the time of testing.
ReplyDeleteI now have 4.0.2 (without root), so I can't test that any more. The native tethering worked for me quite well, so it's strange, that it's crashing on your device.
Other tethering apps I haven't tested with HC/ICS but it might be that the tether app you used notices that dnsmasq is stopped and hence terminates.
I've installed POW and PirateBox plugin on my Samsung Galaxy S2 (Gingerbread 2.3.5, International). When I try to setup it with AP creation through the web interface, it reboots my phone. Without AP creation it works OK.
ReplyDeleteWith built-in tethering PirateBox works flawlessly and I can access it on my phone, I assume also upload/download files; haven't tried with remote device yet. When I try to use Wireless Tether for root users, POW starts as normal, without PirateBox interface.
Is there a way to change the directory with the PirateBox files? I would like to switch it to /sdcard/external_sd/piratebox/ to be able to use bigger SD cards.
The AP creation does not work on all devices, that's why it is optional.
DeleteInteresting that it forces the S2 to reboot.
The plugin works with built in tethering. Other tether apps will not work.
In principle it is possible to change the location of the upload files. This would mean quite some changes to the scripts and possibly configuration files.
Hmm... I just downloaded the newest version 0.84.1 of PAW Server. The server works fine but when I tried to install PirateBox, PAW Server has been denied superuser permissions. Restarted PAW Server with Wireless Tether on, nothing changed.
ReplyDeleteGalaxy Tab SGH-T849
Android 2.2
Rooted via z4root
This will only work if superuser permissions are granted. Otherwise the startup scripts can not change the network configuration.
DeleteI know it's probably something I screwed up and Superuser isn't your app but I can't for the life of me get Superuser to give access to PAW Server. I tried setting Automatic response to Prompt but it never asked me. Superuser just denied PAW Server permissions. I tried to set it Allow, but even that didn't work. Any suggestions?
DeleteThanks for all your work.
Sorry, I have no idea why that is not working. It always worked for me.
Deleteall is ok for me,
ReplyDeletenexus one miui rom only with the miui tether app (doesn't work with tether for root)
but how to upload big files bigger than 2M?
The upload size should be increased (I think to 200MB) by the startup scripts.
DeleteIf that isn't working you can try to set it manually. The size can be set in the file:
/sdcard/paw/conf/server.xml
After that a server restart is necessary.
oh you were right, i tried from my PC it is ok for 200mb.
DeleteBut before i was testing with my android tablet and it was not ok. i was thinking it was limited to 2mb.
So now it's all good. :)
If i want to make my piratebox in french can i just modify the text in the list.xhtml ?
Yes, just modify the xhtml files. These are html files mixed with BeanShell code.
DeleteThis comment has been removed by the author.
ReplyDelete