Writing a local proxy server WM6 - Windows Mobile Development and Hacking General

Hi all,
I've written a proxy server in C# for my HTC Wizard running WM6 with the .NET Compact Framework. Its configured to route My Work Network through a proxy address 127.0.0.1 on port 8888. My proxy program runs a TcpListener on this port and IEMobile browser requests are sent to my proxy which goes to the web, gets each required file and returns them to the browser.
It works fine for files of the type htm, html, gif, png, jpg - but whenever a page uses css or js, it will not load the pages. Any clues as to why??
The program is simply an intermediate agent that reads and writes bytes from the browser and the remote point. Does anybody know why these different types of files never load correctly??
Please, any help or debug ideas is appreciated.
Thanks,
Nick

etnaelk said:
Hi all,
I've written a proxy server in C# for my HTC Wizard running WM6 with the .NET Compact Framework. Its configured to route My Work Network through a proxy address 127.0.0.1 on port 8888. My proxy program runs a TcpListener on this port and IEMobile browser requests are sent to my proxy which goes to the web, gets each required file and returns them to the browser.
It works fine for files of the type htm, html, gif, png, jpg - but whenever a page uses css or js, it will not load the pages. Any clues as to why??
The program is simply an intermediate agent that reads and writes bytes from the browser and the remote point. Does anybody know why these different types of files never load correctly??
Please, any help or debug ideas is appreciated.
Thanks,
Nick
Click to expand...
Click to collapse
wow, nice.
i could really really use your source code for something im working on.
care to share?
don't worry, it's not anything im planning to publish soon, just a personal project.
and if i ever will, it will be with your full concent and you will be credited.
[email protected]
thank you!

Everybody who want to share their internet connection on the phone via wifi to their local network via a proxy on the phone raise their hands.

woohoo! me me me! xD
actually, it is the proxy itself that i need for other functionality. thats why i need the source code...

me too, the proxy not the source code

etnaelk said:
Hi all,
I've written a proxy server in C# for my HTC Wizard running WM6 with the .NET Compact Framework. Its configured to route My Work Network through a proxy address 127.0.0.1 on port 8888. My proxy program runs a TcpListener on this port and IEMobile browser requests are sent to my proxy which goes to the web, gets each required file and returns them to the browser.
It works fine for files of the type htm, html, gif, png, jpg - but whenever a page uses css or js, it will not load the pages. Any clues as to why??
The program is simply an intermediate agent that reads and writes bytes from the browser and the remote point. Does anybody know why these different types of files never load correctly??
Please, any help or debug ideas is appreciated.
Thanks,
Nick
Click to expand...
Click to collapse
You alos need to do some header parsing. If you don't want to do much work, your best bet is just converting my Java language HTTP proxy to C# - it has no problems with any special files (and also supports HTTP Post). See http://www.pocketpcmag.com/blogs/index.php?blog=3&p=453&more=1&c=1&tb=1&pb=1 for the source & more info.

Thanks, Menneisyys.
I'll give it a look and hope it solves my problems. I definitely haven't done any header parsing so lets hope...
On an aside, I was wondering if anybody has any resources on the Connection Manager API for mobile device networking? I am looking for some sample code in C++ which it is native or better yet if anybody has ever ported it to C#. Or if anybody knows how to port a .h file to C#.
Any help is appreciated.
Thanks,
Nick

Related

J2ME web server, access localhost using IE

I am trying to make a program in j2me (using Esmertec JBed) that acts as a web server (that only serves the localhost) and calls a browser to connect to itself.
Sounds simple enough, but I can't get it to work.
I am using the web server code here:
http://javaswamy.blogspot.com/2003/09/j2me-turning-your-phone-into-web.html
and added
"platformRequest("http://localhost/");"
to the end of startApp()
There are 2 problems, though. The JVM cannot open the URL because apparently it cannot run opera while my code is running (it can't run 2 java programs at the same time?)
If I open IE and go to "localhost", I get "Action Canceled".
Anyone has experience with this?
If you are interested, I am trying to make an offline wikipedia reader. I don't want to lose all the formatting, and using the browser to render HTML sounds like the easy way to me (I can even implement links since it runs as the server). I will just write a program to convert all the wikitext to HTML on a PC, and somehow produce a database based on a wikipedia XML dump. There is no HTML renderer for j2me.
Many thanks!

WM6.5 internet explorer can not access "localhost" or "127.0.0.1"

Hi,
I'am doing a development on WM5 and WM6.5 which have to access the localhost from internet explorer. The connection is refused on WM6.5 but not on WM5. Is anyone have the same problem? and knows how resolve it?
Thanks!
macrosjiu said:
Hi,
I'am doing a development on WM5 and WM6.5 which have to access the localhost from internet explorer. The connection is refused on WM6.5 but not on WM5. Is anyone have the same problem? and knows how resolve it?
Thanks!
Click to expand...
Click to collapse
Explorer tries to connect to the device on port 80. If there is no service running you can't connect I wonder what page is viewed connecting to localhost when running wm5
I'am developing a mobile application based on OpenMobileIS open source framwork, this techno use the internet explorer web browser for application interface : webserver includes in the framework. So for that I have to access my application throught the localhost on internet explorer or another mobile web browser.
im having a similar problem on a wm6.5 device.
I want to dynamically forward ports back to my device from a remote ssh server, and im having problems...
I think its to do with wm6.5 not having a concept of a localhost...
localhost 127.0.0.1 connect
hi,
im trying to get a webserver running on my WindowsPhone!!!
i wanna exchange data with my home server later if WLAN access exist.
i used WindowsPocketPC 2003 and all worked well... now i have 6.5 and nothing works...
ok i have find out:
You need to change the registry because there is no hosts File like WindowsXP has. Or you can use a tool for this "Pockethosts"!
(or try 127.0.0.1:80/index.php - 80 is port of your server and give full name of file)
and you need to have Internet access. (I tested it with WLAN internet over my Router)
---------
but im still dont get it to work without internet access
can some one help with this?
(Internet access to connect localhost LoL)
Jan Karel said:
hi,
im trying to get a webserver running on my WindowsPhone!!!
i wanna exchange data with my home server later if WLAN access exist.
i used WindowsPocketPC 2003 and all worked well... now i have 6.5 and nothing works...
ok i have find out:
You need to change the registry because there is no hosts File like WindowsXP has. Or you can use a tool for this "Pockethosts"!
(or try 127.0.0.1:80/index.php - 80 is port of your server and give full name of file)
and you need to have Internet access. (I tested it with WLAN internet over my Router)
---------
but im still dont get it to work without internet access
can some one help with this?
(Internet access to connect localhost LoL)
Click to expand...
Click to collapse
I know it's been a year but I had previously tested on a device with Windows Mobile 6.1 and worked locally without connection, but now I have a just got a Handheld Device with 6.5 and if there is not a connection. The local web server is not accesible and says: Cannot Connect: Cannot connect with current connection settings. To change your connection settings, tap Settings.
I am using PocketHPH (Web server and simplified PHP engine with SQLite)
There is no place like 127.0.0.1 (home sweet home) !!
What happens if you install the Network Folder plug-in and NbstatCE ?
Nbtstat for the Pocket PC. Written in Embedded Visual C++. All versions of Windows CE have a file explorer which can not view windows shares easily. Nbtstat allows the user to view netbios shares on all IP addresses in a subnet.
http://sourceforge.net/projects/nbtstatce/
Though I'm not running WM 6.5.x I'm curious if these both links help you out...
and
Did you forward a port on your router? Thus trying http://127.0.0.1 : portNumber (no spaces here, I typed it this way otherwise appears)
..
There are 65,536 ports which can be used, though every port below the 56,000 is for the industry; thus use a port above 56,000
The web server was on default port 9000, then changed it to port 80. Like I mentioned before, works fine if there IS a WiFi Connection, but once it is lost I can't connect to the local web server.
Don't worry try one of this browser skyfire or uzardwebp and let me know
nawalage
nawalage said:
Don't worry try one of this browser skyfire or uzardwebp and let me know
nawalage
Click to expand...
Click to collapse
Can't download Skyfire, cause it's not available in my area. Tried uzardwebp, but just won't connect to anything. Installed Opera 10 Mini and similar results with IE. If there is a Wifi Connection present the internal web server works great. Once there is no WiFi connection I get Network Problem message in opera.

Proxy Settings

Hello
I hope I'm posting this in correct area!
I have several WM devices (6.1 and 6.5, Professional and Standard - e.g. Touch 2, Snap, Tytn2), connecting to an exchange server for mail, calendar etc, and they also go through a proxy server for web access .
I want to find an easy way to change proxy server settings on them all without having to go in and manually change proxy server IP address and Port. I've done some searching on here and web in general, and subsequently messed around with creating a CAB file, and an XML provisioning file but neither worked (I found some provider specific proxy settings in registry but maybe these are red herring?)
Then I realised my creations would probably never work anyway because they're unsigned apps which aren't allowed on devices connecting to my exchange server!
Am I missing an obvious and much easier method? Any ideas on best way to approach this?
Thanks in advance
Mantog
Very nice idea, but I don't know a solution.
Where are the IP-adresses stored?
If it works with registry settings, a cab file should be sufficent.
I'm trying to find a way to do this, but hopefully someone already has a solution.
playdo

.pac proxy

anyway to use a .pac proxy URL on android?
don't think you can do this,think the phone os not able to understand, why do you need to use pac files?
Sent from my GT-I9000 using XDA App
Global Pandora
I know this is old, but this is an ongoing problem and I figured out how to use a .pac proxy file! After reading about proxy's and what .pac files are, I stumbled upon a little hint and after a little tinkering I was able to use my work's wifi that uses an auto-config .pac file and my phone and tablet has full internet access with browser, apps etc including Netflix for example.
Here are the steps you need:
1) Your phone has to be rooted to take advantage of the proxy apps on the market, I personally use ProxyDroid, which is free and has a feature to bind certain proxy profiles to automatically turn on when a certain wifi network is connected.
2) Usually there is an option that gives you an http proxy pac file to manually input to your browsers or what not, so whatever the link is, put it an active internet browser to download the pac file (an example of the url with the pac file would be something like http://internet.xxxxx.com/proxy.pac)
3) Where ever you download the pac file, open it with notepad or wordpad and this will reveal all the proxy info you need in order to access the proxy enable wifi. What the ProxyDroid app needs from the PAC file is the Host url and Port number. When you open a PAC file in notepad, you'll see something like this near the top along with a bunch of other things under it:
"Cisco Remote Envelope Service
if (dstHost=="internet.e-mail") {
return "PROXY internet-x-x.xxxxxx.com:9090""
- So in "Host" under Proxy Settings in the ProxyDroid app you would input: internet-x-x.xxxx.com
- For the "Port" you would put input: 9090
4) After inputting those 2 pieces of info into the ProxyDroid app, turn the wifi on for your Android Device then enable to ProxyDroid app, you should able to connect to the proxy enabled wifi!
*Some notes for the ProxyDroid app.
- It allows for Authentication, but since my work wifi does not use that, I'm not sure how it would work
- For Proxy type, I set it as an HTTP
- I binded the specific proxy profile to my work wifi so it would ProxyDroid would automatically enable when work wifi was detected
Hope this bit of info helps other that have Android devices and were unable to use a proxy enable wifi to finally access them. Hopefully in the future, Android will make using proxy and pac files a lot easier like how it's done on the ipad where they allow you to manually set up proxy settings by having the device download the PAC file.
I've tested and this works on both a rooted AT&T HTC Inspire and a HP Touchpad running CM7 Alpha
shaunm1989 said:
anyway to use a .pac proxy URL on android?
Click to expand...
Click to collapse
Check out autoproxy on the market. It's my app and it's new. It's the only app that supports proxy.pac proxies directly. Just put the address to the file there, and click connect. It will also auto-connect when you're on the same network again (and disconnect when you're off it) so it's set and forget. It will allow you to use any apps, as long as the port is not blocked by the proxy.
Dtothesquare, that technique will work for simple proxy implementations but some organizations have a cluster of proxy servers that may serve different clients (closer to client without using anycast) or destinations. For example, a proxy server may be set up to just handle *.com while another could handle just internal hosts. It can also be used for sending clients to an alternate proxy server should the primary one be down for some reason.
Our proxy server has ACLs that only let it proxy certain URLs and returns an error if it receives something that's not allowed on that server.

Expert opinion on HTTP header

Hi guys,
I'm working on an app at the moment but I can't get it to work.
I am trying to load a webpage by its IP address, usually this will not work because the server doesn't know what site you want to access in the case of a shared hosting etc. So I am injecting the "host domain.com" header into the request. However the page will still not load.
Anyone got an idea of how I can do this. I know I can use the host file but I'm trying to achieve it without admin privileges. on the pc.
Using wireshark the only difference I found in the packet were GET string in the HTTP header so not sure if I'm missing something..
There is no way to help you if you don't provide any sort of source code or dump of the packages you're sending.

Categories

Resources