#1
|
|||
|
|||
Intercept requests and modification of the server response
I want to intercept all browser requests and then add some js into server responses before it will appears in browser.
For example "Ad muncher" is doing it. It add js that removes all ad from pages. Please give me some advise, how I can do it? I'm using C#. I found 2 solutions that may be can help me: 1) www.fiddler2.com But as I understand I could only write my own plugin for it, but I can't make standalone application. And also it is a proxy-type solution.. 2) www.tcpdump.org and www.winpcap.org I can't find how to modify server responses, I found some info only about sniffering the requests. P.S: I don't want to use proxy server for this purpose. Thanks for any help. |
#2
|
|||
|
|||
>I want to intercept all browser requests
do you work by IP or by domain name with your service? |
#3
|
|||
|
|||
I use GreaseMonkey to do this quite a lot - extremely powerful as you're using JS to mod HTML/JS
|
The Following User Gave Reputation+1 to Loki For This Useful Post: | ||
Smoke (07-31-2013) |
#4
|
|||
|
|||
Intercept requests form all application(chrome, firefox,yahoo,...) and modification of the server response
|
#5
|
|||
|
|||
I'd think proxy server would be easier than trying to make some other drivers to intercept and modify the packets.
Seems like windivert may let you do what you want. However I've never used that myself. Also it is in c not c#. Not sure if anyone have ported that. You may be able to pinvoke windivert dlls. The closest thing I've used in c# is winpcap but that only intercept but not modify packets. HTH, athapa |
The Following User Gave Reputation+1 to athapa For This Useful Post: | ||
Smoke (08-02-2013) |
#6
|
|||
|
|||
Hook all user internet APIs and change them inplace in memory.
|
#7
|
|||
|
|||
It may be possible to hook to HttpOpenRequest and other calls in wininet.dll as mentioned by memcpy. However if you want to support more than 1 browser types then you'll need to look at what api calls are made by other browsers. API Monitor mentioned here may help - http://www.rohitab.com/api-monitor-tutorial-sniffing-internet-explorer-ssl-data with that quest
|
#8
|
|||
|
|||
Smoke, you would like to inject js's only in one project or you want to build a tool for this?
If 2nd, there is no need in hooking APIs... Build LSP library and add all required data to the packet. |
#9
|
|||
|
|||
Try also to take a look on how work ZeuS (source code for version 2.0.8.9) are available, you can check how WebInjection is managed.
|
#10
|
|||
|
|||
Zeus sounds interesting but it is cpp not c#.
LSP might work but you'd need to build that in cpp and pinvoke that in your .net code. I don't think you are targeting XP or older, then see if windows packet filtering api works: http://www.codeproject.com/Articles/5144/An-Easy-Firewall-Application Most likely you'd want to support Windows 7 and greater so in that case you could use Windows Filtering Platform (WFP). I've not seen a complete project yet in .net but this may help. http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/e2308de1-e892-4a07-9bc8-7278d1f5b104/wfp-with-c BTW why c#? |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Intercepting web requests from an application and modifying response | Sailor_EDA | General Discussion | 8 | 05-06-2017 03:51 |
Site issue: no https response | RedBlkJck | General Discussion | 6 | 03-20-2014 19:44 |