Proxy Server

fabpalma

Member
Licensed User
Longtime User
Hi all,

I would like to create a proxy server that should run on an Android device with the enabled tethering.
The goal should be that every user that want to navigate through this device must see first a web page where he must type in an username and a password,
just like a opened free public access point where you must register to navigate.

Does somebody know if it's possible to do with B4A?

Many thanks in advance.
Fabrizio
 

yttrium

Active Member
Licensed User
Longtime User
I don't think that it is possible to do such thing in Android.

On the contrary, just look at what Adblock Plus did.

It would probably require hosting a small web server, having superuser privileges, and editing a host file to redirect everything through your web server, which, when logged in, would act as a proxy.
 
Upvote 0

fabpalma

Member
Licensed User
Longtime User
yttrium,

I think that isn't enough an host file editing because the goal is to give internet access through the tethering .
I think that is necessary to "insert" something into the TCP protocol that filter the traffic.... something like a firewall .... who redirect any internet request coming from the wifi (tethering) to the internal (localhost) webserver just until the user don't give a valid username/password.
Then the proxy can forward his traffic from wifi to cellular network.

uhmmmmm.....
not exactly an easy job !!

Fab
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
yttrium,

I think that isn't enough an host file editing because the goal is to give internet access through the tethering .
I think that is necessary to "insert" something into the TCP protocol that filter the traffic.... something like a firewall .... who redirect any internet request coming from the wifi (tethering) to the internal (localhost) webserver just until the user don't give a valid username/password.
Then the proxy can forward his traffic from wifi to cellular network.

uhmmmmm.....
not exactly an easy job !!

Fab


Maybe you don't understand. Let me draw a diagram of how every other service in the world does it:

Device >--Wifi--> Host device (Phone) >--Hosts file redirect--> Login server (app hosted on phone) >--When logged in--> Internet

Every time something requests data through the login server, the login server checks to see if the user is validated and logged in, based on IP. If not, it shows them a login page, if so, then it handles the request.
 
Upvote 0

fabpalma

Member
Licensed User
Longtime User
Maybe you don't understand. Let me draw a diagram of how every other service in the world does it:

Device >--Wifi--> Host device (Phone) >--Hosts file redirect--> Login server (app hosted on phone) >--When logged in--> Internet

ok, I agree but if we modify the hosts file, when the "login server" try to access the internet, its request are filtered again by the host file (that act at TCP level) .... that redirect the traffic to itself (to the login server) due to the rules inside the file... or not ??

There is a way to prevent this effect ?

Fab
 
Upvote 0
Top