justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.92k stars 598 forks source link

How to trace the URL's which are used only from the browsers? #940

Closed Elanchezhiyan-AIT closed 1 year ago

Elanchezhiyan-AIT commented 1 year ago

Hi Team, We are trying to get the URL's only from the browser and redirect it to other sites. But, we are getting the the URL's from the windows applications like skype etc. How do we trace URL's only from the browsers?

honfika commented 1 year ago

Hi,

You can get the processId of the client with the SessionEventArgs.HttpClient.ProcessId.Value property. You can get the process with the reqular .net method: Process.GetProcessById, and ocmpare it with chrome.exe, firefox, etc... Of course it works only when the browser is on the same machine where the TWP proxy is running.

Elanchezhiyan-AIT commented 1 year ago

Hi @honfika, There are more number of browsers available in the market as of now. For example: Chrome, Firefox, Edge, Opera, Brave etc. (Attached image for your reference). We'll not be able to list out all the browsers. In this scenario, how do we handle this? can you give some more details on this issue?

image

honfika commented 1 year ago

You cannot handle this.. I thought you know which browser you use... For example is it a browser if you create a "application1.exe" which has a web broswer control in it? So it is impossible to handle all browsers... for the proxy the "browser" and "non-browser" is the same... just an application which sends the request...

honfika commented 1 year ago

I forgot to mention that the ProcessId is supported only in Windows... so if you detect Chrome, Firefox, IE and Edge, you will support 98+% of all browsers....

Elanchezhiyan-AIT commented 1 year ago

Thanks for the instant help @honfika. I have used UA parser package to get the User Agent name and segregated the URL's.