According to my research whilst trying to solve this problem, it turns out that the .Net WebProxy class does not support Socks proxies - a tad annoying. I also can't seem to find any code or information which explains how to implement Socks 4/5 support via a class which can easily be used with HttpWebRequest (the Proxy property, to be exact).
I've found limited information via google on how I could do this. One suggestion involves changing internet explorer proxy settings - something I'd rather not do.
Does anyone know of anything which could do the job or have any suggestions? Any help would be much appreciated.
I tried numerous .Net libraries which claimed to support Socks4/5 but found many of them just did not work or would error trying to connect to proxies I knew were functioning.
I've ended up using Chilkat Software's Sock/SSL component which seems to work well for me even if I do have to manually construct the HTTP requests instead of using HttpWebRequest as I would have liked.
Update note: Chilkat.Http (similar to the HttpWebRequest class) does inherently have support for SOCKS proxies. So don't spend time trying to code your own HTTP requests as I did; just use the Chilkat.Http.SocksHostname, Chilkat.Http.SocksPort and Chilkat.Http.SocksVersion properties.
Changing IE's proxy settings won't help you at all-- the other poster was just observing that it works for IE. Because the .NET Framework doesn't support SOCKS, you'd have to write your own CERN-Proxy to SOCKS-Proxy converter, such that .NET talks to the CERN proxy (the type it supports) and your code converts that to a SOCKS proxy call.
FWIW, this is something I'm presently looking to add to FiddlerCore (www.fiddler2.com/core) because I already have almost all of the code. The only thing I really need is a SOCKSv4a proxy to test against.
Since .NET 6, socks proxies can be used natively with HttpClient. See this issue on GitHub.
Use Privoxy or same to create http proxy gateway to your socks.
Add this to main config to chain Privoxy and socks:
forward-socks5 / proxy_host:port .
And something like that to enable direct access to your local network:
forward 192.168.*.*/ .
forward 10.*.*.*/ .
forward 127.*.*.*/ .
Related
I am using C# with Visual Studio. I have imported a WSDL file into my project, so that VS automatically created a class for me to use the appropriate services.
Now I got an error from the server and for debugging purposes I would like to see the RAW response of the server. It looks that this is quite complicated to obtain.
Please take a look at the screenshot below:
I've got only the "base.channel" object. But also after a long time of digging into all the attributes and sub-objects, I'm still not able to find the actual servers response.
The code on line 6776 is the first and only one where I can stop. So there is no possibility to look into some objects earlier.
I'm quite new to Server Client based applications with C# and WSDL. I really hope, that the mechanism, how the requests work, are always the same, so that someone could give me a hint how I can retrieve the servers raw response.
Since it is HTTPS, wireshark is no option.
Thanks
Found the solution:
I used Fiddler which is able to decrypt also SSL traffic!
Does anyone know a Http proxy source code written in C#? I want a proxy to write a proxy that will filter the response and forward it to the client! I have been referring to the Mentalis project and it seems like their proxy doesn't work in multi-threaded environment!
Anyone knows a multi-threaded http proxy server open source project ?
FiddlerCore is what I use.
You can probably make what you need by forking this
https://github.com/mcintyre321/WebAPI-Proxy
http/https reverse proxy with full source - assembly code that can be linked to any exe. comes with sample forms and service projects
https://github.com/CalypsoSys/Babalu_rProxy
https://github.com/justcoding121/Titanium-Web-Proxy
This one is complete source code with SSL proxy.
To all the .NET experts, I have a question for you.
I need to do SOAP/HTTP over named pipes on Windows, in C#. (This is for a client talking to a Python library/server using SOAP for RPC. Using socket/port was deemed both insecure, and port configuration becomes a hassle.) There are two problems.
There is an HttpWebRequest class, but it only supports http URI’s. I can’t find any easy way to change it to support named pipes. Any ideas?
In theory, I could subclass WebRequest, but I don't want to have to rewrite all of the HTTP protocol in C# just to get named pipe support.
There is a PipeStream class, but it is only supported on .NET 3.5 and above. My stuff has to work with .NET 2.0….
I tried searching on google and on this site. There are very few hits (actually, no relevant ones) for HttpWebRequest in combination with named pipes (though each topic by itself has lots of hits).
Any advice is appreciated, thanks.
Have you looked at Windows Communication Foundation (WCF)? That has support for NamedPipes as a transport for SOAP requests
I have a server client application.
The clients sends the server http posts with info every second or so.
The server is implemented using C#, there server doesn't need to respond in any way to the client.
Whats the easiest and most practical way to get this done? Is there some kind of library that is easy to use that I can import into my project.
Why not just use a regular old web service? It sounds like you have simple functionality that doesn't need to maintain a connection state. With a web service, you can simply expose the methods to your client, accessible via HTTP/S. If you're already using .NET for your client, you can simply add a web reference to your project and have .NET do the heavy lifting for you. There wouldn't be any need to reinvent the wheel.
You can use http.sys to create your own http listener without IIS or additional overhead. Aaron Skonnard has a good article here.
Because of certain limitations of uhttpsharp (specifically no support for POST forms and file uploads and it using threads to process requests), I've made NHttp available at github which supports full request parsing like ASP.net and processes requests using the asynchronous TCP model.
I have written a simple HTTP Proxy server in C# that I would like to integration/functional test. Is there a product already created that I could use to do this? If not, what is the best way to write my own tests for this (I already have unit tests)?
To test the integration by delivering a webpage you could try one of the following:
Selenium
WaTiN
Watir
You can run Watin tests directly from xUnit in C# too - we do this for our applications. I also believe it is possible to dynamically set the proxy settings in the browser for Watin (and probably the others too).
Alternatively to make HTTP requests to a given address try JMeter.
Slightly offtopic: Having seen a share of custom HTTP proxies, the usual feature their authors forget (and later discover that they need) is the support for the CONNECT method. Without CONNECT your proxy can't be used for TLS/SSL connections. Also, software that tunnels their non-HTTP traffic via the proxy won't work either.
There are two more products to use:
Web Polygraph
Funkload
Both are easy to find via Google. Both perform functional and load testing of web servers/proxies.
When you're using the above, I'd also suggest running one of the latency/packet loss injection tools discussed in Best way to simulate a WAN network. It's regrettably easy to decide that your proxy is stable when you test it in a non-messy environment.