yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] daveba:
I was sitting at a customer (yes real work) the other day without access to VPN (ports blocked) and i was roaming so daren't switch on 3g due to the extortionate costs. They did have a wireless access and required a proxy for browsing, web mail, etc. Unfortunately if you're connected to wireless you can't also turn your wifi on your laptop into an adhoc hotspot for your phone (even though ad-hoc works perfectly now) so i quickly downloaded transproxy, compiled it (i did have access to the NDK on my lappie luckily) , and set up iptables and voila, a transparent proxy was up and running and everything sprung into life on my Desire. The nice thing (as mentioned in the subject) is that this is not limited to only the browser (i.e. it's not setting the http_proxy in the SQlite db) so even my MAPS, and everything that uses comms thru port 80 came to life.

Posting this if anyone's interested. I hear the CM6 now has proxy access, but this should work for any ROM that is rooted (i.e has su installed) and has iptables support.

Basic HTTP auth is supported, NTLM is NOT SUPPORTED CURRENTLY (and may never be as i don't have a server i can test with).

UPDATE 7th MAY 2011: PLEASE READ THIS POST FIRST

PLEASE post logcat outputs while starting transproxy or it makes it hard for me to diagnose errors. Just saying it doesn't work will not help me fix it.

Version 3.08 beta

- New GUI only. Thanks lots to user fonix232

Version 3.04-3.07

- Bugfixes

Version 3.03

- Major rewrite of redsocks to support transparent proxying (no need to support tproxy binary).

Version 3.02

- Limit the forks as some complex pages may result in large number of process forks which may lead to memory depletion, slowdown in phone, crash, etc.

- Add port 5228 redirection for market auth

Version 3.01

- Split traffic for b*stard proxies that don't support port 80 connections via CONNECT method

Version 3.00

- Full transparency (currently only 80/443 forwarded)

Version 2.04

- Fixed the loss of focus bug when going from on -> off in the GUI

- Fixed the hostname resoltion bug in the Host field.

Version 2.03

- SOCKS 4a/5 support

- Fix password quoting in proxy.sh script

- Removed iptables binary due to ROM incompatabilites. Your ROM must support and have iptables binary included.

Versions 2.01/2.02

- Private testing versions only to fix bugs.

Version 2.00

- Rewrite to support (basic) proxy auth

- Disabled https as it cannot work transparently

Version 1.03

- Fix to work nexus one not having multiport module

- Included 'iptables' binary

Version 1.02

- Internal only version

Version 1.01

- Fix for broken 'su' parsing by splitting the iptables script into 2 scripts to start/stop

Version 1.0

- Broken version not working with 'su' correctly

TODO:

- Abritrary forwarding (i.e. 80,443,++++) -but the upstream proxy needs to allow those ports which it seems many b*stard proxies don't. Use a VPN for that if you can.

- NTLM support
[Desire Android Development] magdap:
can you please translate this for unrooted people, (i have no clue where to type this abd stuff)? does this only work for rooted devices? how much time you think you need for an apk :-)

and does this work only in combination with a laptop or is this a standalone version ( i heard you can set up proxy when you surf next to your laptop, but without it its not possible)?
[Desire Android Development] wallla:
Great work! I'm so happy someone capable finally cares about the missing wifi proxy issue.

Do you think it will work on other (rooted) phones, too? I'm interested using it with my Milestone...

Looking forward to see it with a nice UI.
[Desire Android Development] iamgpc:
I get an error when do iptables:mad::mad:

# iptables -t nat -A OUTPUT -p tcp -m multiport --dports 80,443 -j REDIRECT --to

-ports 8123

iptables -t nat -A OUTPUT -p tcp -m multiport --dports 80,443 -j REDIRECT --to-p

orts 8123

getsockopt for multiport failed strangely: No such file or directory

getsockopt for multiport failed strangely: No such file or directory

FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378

iptables: No chain/target/match by that name

#
[Desire Android Development] blud7:
I'm a waitin on the apk! Will solve several people problems.
[Desire Android Development] daveba:
Unfortunately it won't work for unrooted phones since you need access to do kernel stuff like forwarding destination packets to ports 80,443 to another arbitrary port.

You don't need a laptop after you've pushed the 'tproxy' binary. You can run the commands directly from a root console on the phone.
[Desire Android Development] daveba:
Yes i don't see why it shouldn't work with other rooted phones as long as you have the iptables binary and modules (or in kernel).
[Desire Android Development] daveba:
Looks like your ROM/kernel doesn't have the multiport matching netfilter builtin or as a module. SO in your case you'd need to change the command to be run for each port you're redirecting like this

iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8123
iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 8123
[Desire Android Development] daveba:
I'm a good C programmer (IMHO) but never dabbled in android programming, so it may take a while. If some developer comes up with a gui before me, please feel free. I hope i've passed on the know-how to do the raw stuff though.
[Desire Android Development] jacketyjoe:
Yay, somebody did something about the lack of proxy support :)

I'm just going to wait for it to be released in a rom (or an app), i'm too lazy and don't need it urgently.
[Desire Android Development] iamgpc:
Thanks for your help, however i still get an error:mad:

The following is my adb shell log, is it any problem?:confused:

chmod 777 /system/bin/tproxy

# /system/bin/tproxy -s 8123 10.1.1.2 80

/system/bin/tproxy -s 8123 10.1.1.2 80

# iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8123

iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8123

getsockopt for multiport failed strangely: No such file or directory

getsockopt for multiport failed strangely: No such file or directory

FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378

# iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 8123

iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to-port 8123

getsockopt for multiport failed strangely: No such file or directory

getsockopt for multiport failed strangely: No such file or directory

FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:378

#
[Desire Android Development] sweetheater:
I have written a step by step guide for setting up proxy in Desire mobile...Do check it out.... its in my signature
[Desire Android Development] daveba:
Yes that would work as well alebit with privoxy as the proxying server. tproxy is much smaller and doesn't do all the anonymizing that Orbot does. Anyhow yes i guess that should work too.

Why didn't i find that when i was looking ;-(
[Desire Android Development] daveba:
Hi it looks like your rom is missing iptables multiport support in the kernel. What ROM are you using ?

Maybe it supports it as a module. Does

modprobe xt_multiport

give you errors also ?
[Desire Android Development] mmaacc:
Pretty cool. Thanks! But that's limited to TOR, which means if you have a company proxy in between it's still a no-go :). Correct me if I'm wrong.
[Desire Android Development] professordes:
Similar errors showing up in Modaco r8 rom (even with single redirects), xt_multiport isn't there.
[Desire Android Development] wallla:
So, i just tried it with my stone.

Turns out that there's no iptables on the Milestone.

However, I made it work simply by taking iptables from the wifi-tether-project and copying it to /system/bin/ .

After executing the command for iptables I get an error-message

"FIX ME! implement getprotobyname() bionic/libc/bionic/stubs.c:372".

But that's no problem as the rule is set, successfully.

Can't make a practical test yet, until in some weeks. But I'm optimistic. :)

Thanks so much, again.

@all other people who get the getprotobyname()-error:

try and execute iptables -t nat -L -n -v to show your config.

Maybe the rule is set anyway, like on my phone...
[Desire Android Development] professordes:
It's the same deal on HTC Desire with a Modaco custom ROM r8, I hadn't thought to check the rule was there after seeing the error. It is.

Can't test on the work network until next week.
[Desire Android Development] professordes:
How do I switch the rules off (short of rebooting)?

The obvious:

iptables -t nat -D OUTPUT -p tcp -m multiport --dport 80 -j REDIRECT --to-ports 8123

iptables -t nat -D OUTPUT -p tcp -m multiport --dport 443 -j REDIRECT --to-ports 8123

doesn't seem to work (unless iptables -t nat -L -n -v is misreporting the state)

/EDIT

Ignore that, the equally obvious

iptables -t nat --flush

does clear 'em out...
[Desire Android Development] emiconi:
Market Download Probem

Hi,

this procedure is very interesting, in my case internet browsing and market browsing is working but not for market download and gmail.

some suggestions?

Thanks
[Desire Android Development] hexid26:
You are doing a great job for Google...
[Desire Android Development] anto1208:
the same problem.
[Desire Android Development] daveba:
Ok, i'm back.

Small update (that i promised to do before i left but never got round to it) posted to 1st post with the fix that quotes the username/password for users with strange characters in their names/passwords. Also added socks proxy for people who have access to socks servers (infact this is of little use since you can still only proxy http and not https), but it has the updated UI elements for TransProxy3 (later today/tomorrow) which has true transparency and can tunnel arbitrary ports. I have to fix up some code to enable basic auth for this as my http proxy uses auth.

If anyone can test the socks side of it and report please do. Typically the socks servers listen on port 1080 in corp/uni environments. Socks4a with username is supported, or if no auth is selected in the gui it will use socks5 protocol.

TransProxy3 will work either thru socks or http-connect proxy servers. Basic auth will be supported for http proxy.
[Desire Android Development] magdap:
Xda seems to be striking... Cannot download... I think I'll wait til tomorrow for tproxy3
[Desire Android Development] magdap:
Okay I managed it now...

Still looking good.

Socket isn't working. I just had to switch my port to 1080 when selected, right?

Do you know how opera mini is working? I can use https there when socket is selected.

Is there a port listener or so for android?
[Desire Android Development] daveba:
It's not socket, it's SOCKS - it's a protocol. Opera uses either http or java socket connections, it's not the same.
[Desire Android Development] imemish:
Thanks for the update. However, browser now seems to post this message:

Host proxy.kfupm.edu.sa lookup failed: Gethostbyname failed: Temporary name server failure

On another note: there is some UI issue. If your transparent proxy is on, and then you turn it off, you can't access the text fields (host, port, ...) in the program unless you exit and enter the program again.
[Desire Android Development] daveba:
Put the IP address for the hostname. It seems to work for me with host or ip.

Yes i know about the loss of focus. You can use the optical ball to scroll to the inputs for now.
[Desire Android Development] magdap:
ah! Ok... I thought it would be... So there is no chance you can copy the method of opera four all apps?

For the problem above. Those issues are known. Just use the ip address of the host instead of the full name. For entering in the field again use your trackball!
[Desire Android Development] malabisabe:
Work fine in my college. Thanks
[Desire Android Development] daveba:
If only it was that easy... Though TransProxy3 should work much better (as long as you have a HTTP or SOCKS proxy that allows ports we're tunneling to). Patience....
[Desire Android Development] harunjo:
i always got data connectivity problem with native browser after reboot...
[Desire Android Development] daveba:
Which ROM ? I'm seeing the same thing even before i start Transproxy on CM6. I don't think these two are related since once the redirect-stop.sh script is run there should be no packets being forwarded to tproxy. There definetly seems to be some data connectivity issues with the recent CM6 (and it's variants) as being reported on the respective thread.
[Desire Android Development] harunjo:
i always got data connectivity problem with native browser after reboot...

was using cm 6 experimental version (NB)

and now i am using the new enomther's..same problem

log:

V/tproxy ( 1960): OnClickListner for ToggleButton - false

V/tproxy ( 1960): /data/data/com.hasbox.tproxy/proxy.sh stop

V/tproxy ( 1960): su -c /data/data/com.hasbox.tproxy/redirect-stop.sh

V/tproxy ( 1960): setchildrenstate - false

D/su ( 2206): 10009 com.hasbox.tproxy executing 0 /data/data/com.hasbox.tproxy/redirect-stop.sh using shell /system/bin/sh : sh

V/tproxy ( 1960): OnClickListner for ToggleButton - true

V/tproxy ( 1960): proxy.sh start envp(type=http,host=192.168.4.33,port=3128,auth=false,user=,pass=*****)

V/tproxy ( 1960): su -c /data/data/com.hasbox.tproxy/redirect-start.sh

D/su ( 2241): 10009 com.hasbox.tproxy executing 0 /data/data/com.hasbox.tproxy/redirect-start.sh using shell /system/bin/sh : sh

V/tproxy ( 1960): setchildrenstate - true

I/ActivityManager( 451): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }

W/InputManagerService( 451): Ignoring hideSoftInput of: com.android.internal.view.IInputMethodClient$Stub$Proxy@45908190

I/ActivityManager( 451): Starting activity: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.browser/.BrowserActivity }

E/Tab ( 2140): onReceivedError -7 http://www.google.com/m?site=images&source=mog&gl=id&client=ms-android-google The server failed to communicate. Try again later.
[Desire Android Development] harunjo:
Hey its working again...after review the logcat again..i think the problem is with the proxy auth feature..

tried to remove the v2.3 and replace it with v1..its working..

fyi..my proxy server is not using proxy auth..i am only need to set the ip proxy server and port without user/password.

you can see the logcat say:

pass=***** --> i think even i left it empty it still had a value on it.. and in my case it should be no password on it
[Desire Android Development] daveba:
Really ? TransProxy v1 works and TransProxy2.03 doesn't ? Wierd. I need to look into that as it's using the same tproxy binary. The user/pass is passed to the script empty even if it's not used - the auth=false makes the script ignore the user/pass setting, but you're saying it clearly is not. Can anyone else tell me if this is also failing for NOT auth proxies ? (i can't test since i have an auth proxy set)
[Desire Android Development] harunjo:
yes daveba..i can confirm , its working now..thanks for your great work anyway...

fyi...i am now using binary from : http://xdaforums.com/attachment.php?attachmentid=396280&d=1283803971
[Desire Android Development] daveba:
Now you've really got me confused. Have you extracted the tproxy binary from v1 and are using it with v2.03 ? Or are you just using the v1 apk ?
[Desire Android Development] shokwaav:
hmm ive got redirect-start.sh failed (255)

transproxy 1 worked really well
[Desire Android Development] daveba:
Does your rom have iptables binary ?
[Desire Android Development] shokwaav:
im not sure.. im using defrost
[Desire Android Development] harunjo:
Confirmed TransProxy v1 works and TransProxy2.03 doesn't work
[Desire Android Development] sharky34:
I have got same message with différent number.

I have iptables. I tried It through terminal.

I Will Perhaps try v1.
[Desire Android Development] daveba:
Ok, i've fixed (finally) the loss of focus bug now in version 2.04 and also the failure of name resolution so you should now be able to put hostnames in the Host box.

2.04 should work much better now (i think/hope). Quashing those bugs and having to move the fixes into TransProxy3 means a slight delay to the release.

See the first post. Keep the bug reports coming in.
[Desire Android Development] daveba:
I think i may flash to Defrost to see why it's going wrong.
[Desire Android Development] shokwaav:
thanks :) hope transproxy will be used implemented by google soon!!
[Desire Android Development] fajarep:
wow, i didn't know you have made this application, currently we are using u2nl. beside authorization support, is there any yourself comparision between this??
[Desire Android Development] daveba:
I didn't even know this existed. Though it seems not built for android yet. TransProxy3 will have the same functionality - i.e. able to tunnel everything over http-connect or socks. I don't think u2nl has socks capability, or basic auth with http even, but i may contribute to the author and switch to it if it's leaner. Transproxy3 is working well for me currently.
[Desire Android Development] fkef:
HTC Wildfire

I can't get to program to work on my HTC Wildfire and I just tried version 2.04.

My phone is rooted with unrevoked and I am running standard HTC 2.1 rom.

I am also using superuser to allow the program to get root access.

The program is indicating that the proxy is on, but when I try to turn on Wifi and load a web-page it says, page is not availible.

Anyone else with the same problem or a solution to the problem?
[Desire Android Development] daveba:
Most likely is that the proxy program is running but iptables failed perhaps. Can you connect via adb and run

ps |grep tproxy
iptables -L -n -t nat

Are you sure your proxy doesn't use authentication or your auth details are wrong ? The transparent proxy can't feed back to you this information as it's transparent to the end app.
[Desire Android Development] daveba:
I've just uploaded version 3.00. Currently i've only forwarded ports 80/443 but most things seem to be working for me. I will update the UI to include custom ports in the next version.

When you stop the proxy, you may get a failure if you try to restart it too quickly. This is because of the socket timeouts. I have to think of how to wait for all these to shutdown so we don't get this error, but if you wait for a while it will work. You can type

adb shell netstat

and ensure all connections on 8123 have expired.
[Desire Android Development] magdap:
version 3.00 isn't working at all!

There must be a bug in it...

I thought it would be the host ip error again, but I just can't surf anymore...

Just her the normal message that my data connectivity isn't there just like I'm good old times when I couldn't use this proxy app...

Had too switch back to 2.4
[Desire Android Development] daveba:
Then your server doesn't support HTTP CONNECT or SOCKS. TransProxy3 only makes direct connections to servers using SOCKS or HTTP CONNECT. It's not actually proxying in the normal sense of the word.
[Desire Android Development] magdap:
Ah, so it's on purpose....

Good to know but to bad that my server doesn't support this connect method...

or do I need to switch the port to use this feature?
[Desire Android Development] daveba:
No no need to switch ports. But i'm still not ruling out it as a bug. In your desktop/laptop browser if you set your proxy to the one you are using, can you browse to https sites fine ? If so, then your proxy supports the CONNECT method. Then the next question is are you using with authentication or no auth ? I've currently only tested with a basic auth proxy. Can you PM me and i'll send you my email address so we can solve this off line without making the forum a bug resolution site.
[Desire Android Development] magdap:
Hey... Its meeeee! :)

You have mine already...

No authentication, proxy on pc with https works.
[Desire Android Development] STetzel:
hello daveba,

nice work. V3 works smooth ;-). but one little problem:

i've a squid proxy server ( test ) and i must change

acl SSL_ports port 80 <---- new

acl SSL_ports port 443

http_access deny CONNECT !SSL_ports

because everything now connects over CONNECT

1285160236.446 72091 192.168.8.243 TCP_MISS/200 2535 CONNECT 74.125.39.138:443 - DIRECT/x.x.x.x -

1285160236.447 96305 192.168.8.243 TCP_MISS/200 30291 CONNECT 74.125.39.138:80 - DIRECT/x.x.x.x -

1285160236.447 97286 192.168.8.243 TCP_MISS/200 106705 CONNECT 74.125.39.138:80 - DIRECT/x.x.x.x -

but thats no real problem
[Desire Android Development] daveba:
I can't say i understand squid syntax, but that's the correct way. I.e. all connections now only use CONNECT (443) or SOCKS (1080). I don't understand why you need to open port 80 *unless* you are actually connecting to the proxy server itself for pages ? I think in that case you may need to

iptables -t nat -A OUTPUT -p tcp -d ! PROXYHOSTNAME --dports 80,43 -j REDIRECT --to 8123

So essentially don't use the redirector if going to the proxyhost itself.

Is this the issue ?

P.s. i've limited the port redirection to only 80,443 but in the next version will have all TCP ports forwarded. I just wanted people to test this version first.

insta
[Desire Android Development] STetzel:
hello again,

the syntax means:

#

acl SSL_ports port 80

acl SSL_ports port 443

#

Define the ports that can use the https-Connect method

http_access deny CONNECT !SSL_ports <-allow only the defined port to use https-connect

surfing with pc works without this change.

but never mind ;-)
[Desire Android Development] eclecticfrog:
Transproxy

Just tried the V3.0 on my rooted HTC desire with Froyo 2.2 and it doesn't seem to work. Once I turn on Proxy, my browser stops working. Once I switch the proxy off, the browser works again. I was looking forward to getting BBC TV on my phone through my Proxy service!
[Desire Android Development] iamgpc:
I have the same problem.

I tried v1.0 to v3.0. There is no any version working on my HTC HD2.

My HD2 is installed AuraxTSense7.6.1 based froyo ROM porting by myself.

I also try the Galaxy S i9000 16GB. It still is not working.

My network is 3G. It needs a proxy (10.1.1.2:80).

I can use Internet Sharing application on my Android HD2 for Windows 7 PC surfing the internet with Proxy which setting at Internet Explorer option.
[Desire Android Development] daveba:
Ok, i think i know what's going on. Some fascist proxies only allow https (443) with the CONNECT method, so trying to get to port 80 thru 443 is blocked. Apache proxy for example allows 443 and 563. My test proxy allows all ports so i wasn't seeing the problem. I bet for those who it doesn't appear to work, if you go to a HTTPS page it will work. Or even gmail will work for you when you swith the proxy on but your proxy is blocking any normal port 80 access. So it looks like i'll have to split the 80 and the other ports separately. I'm sure for this is working for some people (it is working for me). Also anyone who has a SOCKS proxy it should work fine for them.

User STetzel has confirmed it works so this is not a complete red herring. :)
[Desire Android Development] eref:
First of all thanks for this solution!!!

I have tried 2.04 browser, gmail, weather etc works except Market. It closes after a few seconds.

Tried the new v3 but it is not working for me. I think there is a squid/2.7.STABLE6 proxy in our corporate network.
[Desire Android Development] eref:
I tried again today, and Market browsing is working now but downloading not. Is it using other port for downloading?
[Desire Android Development] daveba:
I think someone mentioned in a previous post in this thread that it uses https for downloading.

I'm working on fixing TransProxy3 to split port 80 from tunneling thru 443 as this will fix b*stard proxies.

Anyone had a chance to try transproxy3 with a HTTPS page (e.g. https://mail.google.com) ?