For root users there is a solution by using iptables via the Superuser app.
I'm not sure if the below mentioned solution is working on all rooted devices.
Here is my configuration: Notion Ink Adam running AdamComb v0.3
If this works for you can easily be tested by copying the below code into the BeanShell Console of the PAW web application:
import de.fun2code.android.pawserver.util.*; execRootShell(String[] commands) { shellCmd = "su -c sh"; sh = Runtime.getRuntime().exec(shellCmd); os = sh.getOutputStream(); for(cmd : commands) { os.write((cmd + "\n").getBytes()); } os.write(("exit\n").getBytes()); os.flush(); sh.waitFor(); } /* ---- Config -------- */ ip = Utils.getLocalIpAddress(); redirectFrom = 80; redirectTo = 8080; action = "ADD"; // Can be ADD or DELETE /* -------------------- */ action = "-" + action.substring(0, 1); String[] iptablesCmds = new String[] { "iptables -t nat " + action + " OUTPUT -d 127.0.0.1 -p tcp --dport " + redirectFrom + " -j REDIRECT --to-ports " + redirectTo, "iptables -t nat " + action + " OUTPUT -d " + ip + " -p tcp --dport " + redirectFrom + " -j REDIRECT --to-ports " + redirectTo, "iptables -t nat " + action + " PREROUTING -d " + ip + " -p tcp --dport " + redirectFrom + " -j REDIRECT --to-ports " + redirectTo }; execRootShell(iptablesCmds);
After executing the code, PAW should respond to requests on port 80.
If not, this solution seems not to be working on your configuration.
To forward port 8080 to port 80 every time PAW starts up, create a file called S_forward.bsh inside the /sdcard/paw/etc/init/0 directory.
In order to stop the forwarding when the PAW service shuts down, create an additinal file called K_forward.bsh and copy the same code.
You only have to change the line action = "ADD"; to action = "DELETE"; to stop the forwarding.
Hope that's not just working on the Adam...
My rooted T-mobile rapport recognises that I have executed the code but I still have to enter the 192.168.x.x:8080 to get to the piratebox
ReplyDeleteFor PirateBox to work two things have to be working:
ReplyDelete1. Dnsmasq has to be working in order to respond to all DNS queries by the IP address of the Android device. To check if this is working, setup your device as hotspot and start PAW with PirateBox plugin. After startup connect with a PC and run nslookup. All lookups should be answered with the IP of the Android device.
2. Forward port 8080 -> 80 has to be working. You can use the code from this blog to try. After executing the code you should be able to access PAW by using http://192.168.x.x.
If both things are working PirateBox should work too.
If not have a look at the post http://fun2code-blog.blogspot.com/2011/12/piratebox-on-android.html and try to figure out what goes wrong.
I have a problem. I can't access to plugins page because my Antivirus blocks it saying it is a Malicious Injected Javascript. Can you solve the problem or publish links here?
ReplyDeleteThanks.
IMHO there is no problem with the page.
DeleteThe content of the iframe is this URL:
http://paw-android.fun2code.de/plugins/
There is no JavaScript in that page and the iframe is not manipulated (if your browser has no security issue that should not work anyway).
So please consider contacting your anti virus vendor about the issue.