yashsingh1/xdaforums huggingface dataset:
[Desire Android Development] daveba:
Just a small update:

I've been working on and off for this for a few days and have cleaned the code up considerably making it easier to extend.

Currently i have proxy authentication working and i can connect to my apache server fine using authentication. I don't want to release it before i have SOCKS working, so if anyone can offer me a socks server to test, please PM me. If anyone wants to try just the proxy auth (NON SOCKS) TransProxy2 desperately, i'm happy to release it early.

I've realised (after much googling) that transparent HTTPS cannot be done (yes i've changed the subject of this thread to reflect this). This is because the browser makes a direct connection to the target host that we cannot intercept (i.e it is not just a plain HTTP CONNECT). There are many threads on this and it is obvious when you think about it since then you are suceptible to MITM attack.
[Desire Android Development] woti23:
you could verify if its not in ther kernel (ipt_REDIRECT)

look at

zcat /proc/config.gz

it shows the running kernel configuration
[Desire Android Development] shokwaav:
this proxy works for me more than the one in defrost (cm6) however like others have said the app market downloading doesn't work. Also apps like trillian, appbrain doesn't work.
[Desire Android Development] andmark:
Thanks woti23, I checked, as I supposed it has no support:

# CONFIG_IP_NF_TARGET_REDIRECT is not set

daveba, unfortunately spica has no support for CyanogenMod
[Desire Android Development] imemish:
Transparent proxy is not working on my Galaxy S (Tried it on 2.1 and 2.2). I think the problem is that my university proxy policy requires authentication (username/pass). Any hints on how to do this?

Author says that is in the todo list, any updates?

Thanks.
[Desire Android Development] daveba:
Updated version 2.0 to first post. Supports user/pass auth. Let me have feedback if it works.

For people who have socks servers available the next version will have socks support which should let you transparently use SSL (http).
[Desire Android Development] imemish:
Thanks a lot for the new version. However, it still doesn't work.

My phone specs are: Samasung Galaxy S, with a freshly installed 2.1 and nothing but root installed.

I noticed the following: that without running the transparent proxy program and supplying the proxy in the 'Advanced' tab, my browser works for both local and external sites, but ofcourse all other programs (market, gmail, ...) can't access internet.

But when i run the transparent proxy program, even the browser stops working (for both external sites and even local sites that don't need proxy). Browser also shows the following message:

Data connectivity problem

The server failed to communicate. Try again later.

Thanks for your help
[Desire Android Development] daveba:
I'm assuming you have switched off the proxy in the browser when you run the transparent proxy correct ?

Are you able to run adb commands ? If so, when you start the transparent proxy can you run the following commands

/data/data/com.hasbox.tproxy/iptables -L -n -t nat
ps |grep polipo
ps |grep tproxy

Does your browser proxy support authentication ?
[Desire Android Development] mistahd33:
For those who want market access using tproxy... I found that "And App Store" works and is able to download apps... which is better than a poke in the eye with a sharp stick.

Sent from my Atari 2600 using a big scary looking, extremely modified double dragon cartridge.
[Desire Android Development] suksanto:
with Transproxy2 I've got the error " redirect-start.sh failed(139)" Any suggestion ?

Android 2.1. Foxconn (OEM phone)Blaze.
[Desire Android Development] daveba:
Are you saying it worked with the previous version 1 and now broken in version 2 ? Is your phone rooted and does it have iptables support built in or compiled as a module ? Can you run

/data/data/com.hasbox.tproxy/iptables -L -n -t nat

within adb and see what that outputs.
[Desire Android Development] anto1208:
Proven TransProxy2.apk Galaxy's not working on my I-network

hsdpa proxy that requires authentication with the information required

Apn my setup on my Galaxy are

Settings-> Wireless-> mobile-> profiles-> new Apn

APN = xxxxxxxx.it

PROXY = xxxxxxxx.local

PORT = 8080

USERNAME = XXXXXX

PASSWORD = XXXXXX

Authentication Type = PAP

HELP ME PLEASE!!!
[Desire Android Development] Matthew Kane:
Got the same problem on Motorola Dext 2.1 rooted
[Desire Android Development] daveba:
Did you try running the commands i gave ?
[Desire Android Development] daveba:
I don't understand. You have a APN proxy setting from your provider that i guess must be working, yet you want to use Transproxy ? Why ? Typically this is for use on Wifi - though i am using it also to connect to my HTTP auth proxy server with 3g, but my Telco doesn't use an intervening proxy setting in the APN like you.

What are you expecting to achive ?
[Desire Android Development] anto1208:
My connection to the corporate network with proxy server that provides a

authentication.
[Desire Android Development] daveba:
With Wifi or 3d/HSDPA ? If latter, then do you mean your corporate network has a basic auth proxy on the internet ? Really ? Does it work with a standard browser on your desktop/laptop from the outside network with basic auth ? You're a special case then as you need to chain proxies since your 3g/HSDPA provider is providing a proxy also.

Can you try with wifi (since that doesn't use the APN) with transproxy2 basic auth. Does it work in that configuration ?
[Desire Android Development] anto1208:
With Wifi or 3d/HSDPA ?

response 3D/HSDPA

If latter, then do you mean your corporate network has a basic auth proxy on the internet ?

response YES

Does it work with a standard browser on your desktop/laptop from the outside network with basic auth ?

Response YES

Can you try with wifi (since that doesn't use the APN) with transproxy2 basic auth. Does it work in that configuration ?

Response tried WIFI not working.
[Desire Android Development] daveba:
So with 3G/HSDPA this won't work since you'd have to chain proxies. However you are saying it also doesn't work with wifi which means you should appear on the net directly and thus only using your corporate proxy. What error do you get ? Proxy authentication incorrect or cannot connect to your proxy or what ?
[Desire Android Development] imemish:
I tried the following command with adb:

/data/data/com.hasbox.tproxy/iptables -L -n -t nat (without running the transparent proxy):

Chain PREROUTING (policy ACCEPT)

target prot opt source destination

Chain POSTROUTING (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

Then after running the transparent proxy:

Chain PREROUTING (policy ACCEPT)

target prot opt source destination

Chain POSTROUTING (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8123

However, when trying the ramaining commands with grep, the adb shell gives me :

grep: not found

I'm still googling on how to put 'grep' in my phone, any hints?

Thanks
[Desire Android Development] anto1208:
Proxy authentication incorrect

thanks
[Desire Android Development] imemish:
Alright, after some googling i installed busybox and now i have grep command.

So, again here are the results BEFORE running the transparent proxy:

# /data/data/com.hasbox.tproxy/iptables -L -n -t nat

/data/data/com.hasbox.tproxy/iptables -L -n -t nat

Chain PREROUTING (policy ACCEPT)

target prot opt source destination

Chain POSTROUTING (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

# ps |grep polipo

ps |grep polipo

ps |grep tproxy

app_83 5352 2184 204056 20648 ffffffff afe0d9c4 S com.hasbox.tproxy

And here they are AFTER running the transparent proxy:

# /data/data/com.hasbox.tproxy/iptables -L -n -t nat

/data/data/com.hasbox.tproxy/iptables -L -n -t nat

Chain PREROUTING (policy ACCEPT)

target prot opt source destination

Chain POSTROUTING (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8123

# ps |grep polipo

ps |grep polipo

# ps |grep tproxy

ps |grep tproxy

app_83 5352 2184 199956 20592 ffffffff afe0d9c4 S com.hasbox.tproxy

app_83 5895 1 616 240 c064a78c afe0d3cc S tproxy

I'm using the default android browser. If i want to set proxy in browser i would go to :

settings-> Wireless and network --> Wi-fi settings --> Advanced and i fill the proxy and port.

And when i open the default browser, it pops up a window asking me for authentication.

And yes, I tried disabling these parameters and enabling them with the transparent proxy with the same result (not working).

Thanks
[Desire Android Development] shoguevara:
Data cleanin issues

Hi! Thanks for the great job! At last I can access my work network!

But now I'm expriencing some problems with cleaning data from your app.

I've installed the 1st version, them removed it(proxy was disabled) and installed the 2nd version. But then, for some reason, I decided to revert to the 1st version(cause I have an ntlm authorisation at my office network I hadn't any chances to make it working - I just installed a transparent proxy server in my office PC).

I found, that programm data is stored in /data/data/com.hasbox.tproxy/, but when I ununstall application it wipes out(as it should).

Now, when I install any version of app the proxy appears to be turned on, even if I disable it on start it is "on"! Is there any another place, where the app keeps data?

Also I can't enter anything in text fields after changing proxy state - the virtual keyboard doesn't appear. If I try to enter text when the proxy is disabled and I do not have to disable it - the keybord appears(to tell the truth - appeared, I can't turn it off now).

Oh! I forgot! HTC desire - stock rooted android 2.1.
[Desire Android Development] daveba:
Yup, when you set the proxy in your browser, the remote server automatically sends a auth request to you. For transparency to work you need to provide this info automatically which is done via the second process 'polipo'.

So it looks like most things are working, but 'polipo' is failing to start. I'm assuming you've got Transproxy2 installed ?

Have you got /data/data/com.hasbox.tproxy/polipo binary ? And if you run it manually like

/data/data/com.hasbox.tproxy/polipo -v

does it provide output ?
[Desire Android Development] daveba:
I think the problem is that you probably uninstalled the app without disabling the proxy so the proxy processes are still running. Try doing this in adb as root

ps |grep tproxy
ps |grep polipo

the second column will be the process ID so then just run

kill PID

where PID is the process id number.

Then everything should be ok.
[Desire Android Development] daveba:
Actually it does run without root (su) as you don't need privileged port allocation, but anyhow it seems as it is running fine. So i wonder what is happening.

Next try

logcat|grep tproxy

and then stop/start the transproxy. You should see some relevant info especially when starting proxy.sh script. It should be passing your auth details.

You can look at the script /data/data/com.hasbox.tproxy/proxy.sh and run the polipo command manually and see what happens (you can run it as root if necessary, but remember to clean out the pid file for it in the directory or else subsequent invocations will not be able to kill it).

The more i think about this the more this should be rewritten in java completely without having to fork processes. It's just a matter of convienence over coding time and whether or not the next version of android will have this builtin.
[Desire Android Development] imemish:
Ok, After killing the processes and rerunning the transparent prosy, i noticed the following:

1- If i don't have authentication checkbox in transparent proxy checked, i get the following outputs:

# ps |grep tproxy

ps |grep tproxy

app_83 9178 2184 199948 19212 ffffffff afe0d9c4 S com.hasbox.tproxy

app_83 9461 1 616 240 c064a78c afe0d3cc S tproxy

app_83 9498 9461 616 296 c043b6dc afe0cb34 S tproxy

app_83 9543 9461 616 296 c043b6dc afe0cb34 S tproxy

# ps |grep polipo

ps |grep polipo

app_83 9463 1 1072 572 c043b6dc afe0d83c S polipo

And my browser gives me the following message:

504 host proxy.kfupm.edu.sa lookup failed:

gethosbyname failed: temporary name server failed

(.... Generated ... by polipo on polipo:8124)

And now if i have the authentication box checked, i get:

# ps |grep tproxy

ps |grep tproxy

app_83 9178 2184 203040 19212 ffffffff afe0d9c4 S com.hasbox.tproxy

app_83 9652 1 616 240 c064a78c afe0d3cc S tproxy

# ps |grep polipo

ps |grep polipo

And the browser returns to the previous error (Data connectivity problem).
[Desire Android Development] imemish:
Here is the output of logcat when running and stopping the service (I have put question marks instead of my username):

Starting the service:

D/su (11363): 10083 com.hasbox.tproxy executing 0 /data/data/com.hasbox.tproxy/redirect-stop.sh

V/WindowManager( 2244): Dsptch 0 x435.0 y509.00003 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/WindowManager( 2244): Dsptch 1 x435.0 y509.00003 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/tproxy (10918): OnCheckedListner for ToggleButton - true

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

V/tproxy (10918): proxy.sh start envp(host=proxy.kfupm.edu.sa,port=80,auth=true,user=???\????,pass=*****)

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

W/ActivityManager( 2244): Activity pause timeout for HistoryRecord{47a871b0 com.hasbox.tproxy/.Main}

D/su (11391): 10083 com.hasbox.tproxy executing 0 /data/data/com.hasbox.tproxy/redirect-start.sh

Stopping the service:

V/WindowManager( 2244): Dsptch 0 x422.0 y698.0 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/WindowManager( 2244): Dsptch 1 x422.0 y698.0 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/WindowManager( 2244): Dsptch 0 x457.0 y534.0 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/WindowManager( 2244): Dsptch 1 x457.0 y534.0 > Window{47b072c8 com.hasbox.tproxy/com.hasbox.tproxy.Main paused=false}

V/tproxy (10918): OnCheckedListner for ToggleButton - false

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

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

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

D/su (11457): 10083 com.hasbox.tproxy executing 0 /data/data/com.hasbox.tproxy/redirect-stop.sh

I have noticed that the password asteriks (pass=*****) are much less than my actual password (my password is longer and contains special characters like @#*) can this be the reason?

Also i tried manually running the commands, here is the output (i hope the squence is correct):

$ su

su

# ./tproxy -p -P $DIR/tproxy.pid -s 8123 127.0.0.1 8124

./tproxy -p -P $DIR/tproxy.pid -s 8123 127.0.0.1 8124

# ps |grep tproxy

ps |grep tproxy

app_83 10918 2184 217384 19292 ffffffff afe0d9c4 S com.hasbox.tproxy

root 12834 1 640 216 c064a78c afe0d3cc S ./tproxy

# AUTH="parentAuthCredentials=???\?????:????????"

AUTH="parentAuthCredentials=???\?????:????????"

# host=proxy.kfupm.edu.sa

host=proxy.kfupm.edu.sa

# port=80

port=80

# ./polipo daemonise=true logFile=/dev/null pidFile=$DIR/polipo.pid proxyPort=8124 parentProxy=$host:$port $AUTH

./polipo daemonise=true logFile=/dev/null pidFile=$DIR/polipo.pid proxyPort=8124 parentProxy=$host:$port $AUTH

DNS: couldn't open /etc/resolv.conf: No such file or directory

command line:0: parse error.

#

So can this file "/etc/resolv.conf" be the problem ? i looked for it but couldn't find it.
[Desire Android Development] shoguevara:
Sorry! Forgot to reboot=) SOLVED.

Are there any possybilities to add NT authorization using ntlmapps.

Sry for my english and around-noob questions)
[Desire Android Development] magdap:
Please try to input an ip address not a full host name.

http://www.google.com/m/url?ei=6DqO...AQFjAA&usg=AFQjCNGhJjCtDwwamah6reDc0IIoT8G5Vw try this site... Helped for me...
[Desire Android Development] daveba:
I'm not sure about NTLM. I will look into it on my return. I'm away for a week from Wednesday...
[Desire Android Development] daveba:
Yeah, i think this is correct. Transproxy2 had an issue with hostname resolution. Use the IP address of your proxy server. Also since i think you (imemish) are in Saudi (.sa) then your user/pass is probably in Arabic which i'm not sure if android handles correctly. I'm assuming the ?????? is actually some characters in arabic or you have correctly removed them from the output you posted ?
[Desire Android Development] imemish:
Thanks for your help.

no, the username and password are both in latin characters with some special characters (*/@) but all latin. It's as you guessed, i just replaced them with question marks in the output.

I created an empty "/etc/resolv.conf" so this removed the error. ( i don't know if having an empty file is the solution)

Thanks for the proxy ip hint. I put it now as ip:10.140.1.204.

This leaves me with this error:

./polipo daemonise=true logFile=/dev/null pidFile=$DIR/polipo.pid proxyPort=8124 parentProxy=$host:$port $AUTH

command line:0: parse error.

So now i'm left with this final error.
[Desire Android Development] daveba:
Try expanding it fully and don't use any $ variables and run it again

cd /data/data/com.hasbox.tproxy
./polipo daemonise=true logFile=/dev/null pidFile=polipo.pid proxyPort=8124 parentProxy=IP_ADDRESS:PORT parentAuthCredentials=USER:PASS

substitute the obvious above. See what error you get then..
[Desire Android Development] Armo11:
for me in version 1 it's not have any error when i turn it on but in version 2 it error

my phone is galaxy spica rooted and i can run your command and get output like this

/data/data/com.hasbox.tproxy/iptables -L -n -t nat

[1] + Stopped (signal) /data/data/com.hasbox.tproxy/iptables -L -n -t nat

any help please?
[Desire Android Development] imemish:
Alright, i think i found the problem. It is with the special characters in the password, as i suspected before. I have the special character '@' in my password. Which is giving the 'command line:0: parse error.'.

So, without loss of generalizability if you try:

./polipo daemonise=true logFile=/dev/null pidFile=polipo.pid proxyPort=8124 parentProxy=IP_ADDRESS:PORT parentAuthCredentials=USER:PASS

it will work, but if you try:

./polipo daemonise=true logFile=/dev/null pidFile=polipo.pid proxyPort=8124 parentProxy=IP_ADDRESS:PORT parentAuthCredentials=USER:PA@SS

it will fail. I tried quoting the password with double and single quotes, and throwing a back slash '\' before but with the same error. Can you confirm the same error on your device? Any solutions?

Sorry this took so long to figure out.
[Desire Android Development] daveba:
Both versions have the exact same version of iptables, so maybe just the transproxy2 is better at catching the error. I believe iptables is not supported on your kernel so this will never work unless you install a custom ROM which supports iptables. What version of android are you running ? I compiled iptables for froyo that's installed in the package so maybe also it doesn't have the correct libraries, runtime linker etc. Can you check on your spica forum if iptables is supported in your kernel, and if you can find the correct iptables binary.
[Desire Android Development] daveba:
Yes i can confirm this bug in polipo. I can probably work around it. I will send you a PM with a new polipo binary in a while.

EDIT: no need for a new binary. I looked at the source for polipo and you can just use double quotes arount the auth string, so you should have

./polipo daemonise=true logFile=/dev/null pidFile=polipo.pid proxyPort=8124 parentProxy=IP_ADDRESS:PORT parentAuthCredentials=\"USER:PA@SS\"

and you will not get a parse error. Let me know if it succeeds and you can authenticate and i will add the quoting in by default.
[Desire Android Development] imemish:
thanks also i noticed that when the username has special characters (for example: abc\defgh-o) program fails through gui but works through command line (./polipo ....). Can you also confirm this?

Thanks a lot.
[Desire Android Development] daveba:
Yes i will double quote this in the script also. Thanks
[Desire Android Development] imemish:
Thanks a lot . this works now (at least using the command prompt) with the double quotes.

Now what's remaining is the https :) Yeah, i know you mentioned it will not work and the only solution can be a security breach ( i would suspect you would need to tunnel all https through http), but you don't think there can be any other solution?

For example, i use take local university network and share it through connectify using my laptop? is there a way that we can make the laptop like a nat network that takes all connections ?

Anyhow, i think i bothered you more than enough for today. Thanks again.
[Desire Android Development] daveba:
Ok, thanks for testing.

I have something in the wings for https, but i'm afraid i'm out till next week so can't do more thorough testing. It should work if your uni has a socks server or allows HTTPS CONNECT out.

I assuming you're asking all the above since your uni doesn't allow VPN access and blocks everything but 80/443 ? Or else the correct method is just to use openvpn tunneled thru 443.
[Desire Android Development] imemish:
Actually i need this to connect my galaxy s to the remaining apps (market and gmail mainly). I understand they need https (market uses http to browse but seems to use https when downloading apps). This doesn't seem to work using the transparent proxy.

I'm afraid i don't know how to use openvpn tunneled thru 443. should i do this on the laptop or on the phone? i'm afraid i'm completey ignorant in how to set up tunneling.

my uni does seem to allow socks (http://www1.kfupm.edu.sa/itc/?c=services/winsockxp).
[Desire Android Development] Armo11:
i run eclair 2.1

baseband i570EDXJC2

kernel 2.6.29 leshak@i5700-dev7 #65

build LeshaK's Kernel v. LK2.01.1

and i think iptable binary that run in your kernel is 1.3.7

do i update it to 1.4.7 to fix this prob?
[Desire Android Development] daveba:
Not it's not the iptables binary, it's your kernel which doesn't support the advanced packet filtering. Anyhow iptables 1.4.7 is installed in the package. Maybe try your 1.3.7 instead with the commands i showed earlier in the thread.
[Desire Android Development] Armo11:
sorry i type wrong, my iptables in my kernel is 1.3.7

i run the command

which iptables

the output is /system/bin/iptables
[Desire Android Development] Dr_Death:
same issue with me TransProxy1 work fine but i need proxy authentication, TransProxy2 give me error "redirect-start.sh failed(139)"

i do have iptables under /system/bin/

my device is HTC WildFire 2.1
[Desire Android Development] SamMackrill:
NTLM

Another vote for NTML (v2), thanks for all your efforts and have a good break!
[Desire Android Development] melben:
Just wanted to say thankyou for this app. Working fine for me on a stock HTC 2.1 (Telstra, Australia), rooted + busybox. Working with authentication (once I changed my password to get rid of the @ symbol).

Ben