This is a migrated thread and some comments may be shown as answers.

HookUsingPACFile only

14 Answers 363 Views
FiddlerCore
This is a migrated thread and some comments may be shown as answers.
Calvin
Top achievements
Rank 1
Calvin asked on 26 Mar 2017, 09:52 AM

I want to use PAC file. http://127.0.0.1:8888/proxy.pac, this way, if my proxy accidently quits without remove the proxy setting, the browser will be able to continue to work since it can't find the pac file, thus consider it "No proxy".

 

But When I set the flags, if I don't include: "RegisterAsSystemProxy", the PAC file will not registered.

If I DO include "RegisterAsSystemProxy", the PAC file is registered, but also the proxy servers, 127.0.0.1 8888 for http and https. What's the point to have both registered, and it negate my purpose.

Anyway to hook up PAC file only?

 

Also, how to  modify the PAC file content, for GOD's sake?

14 Answers, 1 is accepted

Sort by
0
the East Wind
Top achievements
Rank 1
answered on 03 Sep 2019, 07:42 AM

Hi,Calvin

I have encountered the same problem as you. I have been looking for it everywhere, but no solution has been found. May I ask if this solution has been solved?

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 04 Sep 2019, 02:02 PM

Hello,

At this time, Fiddler does not support manually setting the PAC file as the Gateway. However, there is the following workaround. 

Step 1 - Configure the Windows Proxy Settings to use the PAC file. 

Step 2 - Start Fiddler with Use System Proxy settings.

I hope this helps. Please let me know if you need any additional information. Thank you for using the Fiddler Forums.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
the East Wind
Top achievements
Rank 1
answered on 12 Sep 2019, 02:35 AM

Hi,Eric

Thank you for your reply and time.

I am sorry that I may not have stated my problem.

I want to use only PAC file through fiddlercore, and I don't want to include "RegisterAsSystemProxy" (as Calvin said at the beginning of the post).

In fact, what I want to do is to use fiddlercore to implement only a specific application, without affecting the operation of other applications, just as fiddler can do. What I know is that when I use the "Any Process(drag this icon to a window to show traffic from only that process)" function of fiddler, he can only proxy the application I want. I don't know how fiddler implements this function. Maybe he just uses oS.Ignore() like fiddlercore?

I have seen your discussion with Hendrik in this post, which has benefited me a lot. I adopted "idea 1", but I encountered a problem later, I don't want to affect other applications, I just want to proxy what I want, but if I don't include "RegisterAsSystemProxy" in FiddlerCoreStartupFlags, PAC file will not take effect. What have I missed?

This is the problem I encountered,please could you advise me.

Thanks


0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 16 Sep 2019, 02:34 PM

Hello,

Thank you for the updated information. I see now that I misunderstood the initial inquiry. Please accept my apologies for misunderstanding.

With that said, I am going to reach out to my colleagues and see if there is a better resolution for this. Once I have more information I will provide an update here. 

In the meantime, please let me know if you need any additional information and thank you for your patience and understanding.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 16 Sep 2019, 10:19 PM

Hello,

After speaking with my colleagues, the current HookUsingPacFile Startup Method implementation generates the PAC file upon attaching to the System Proxy. This has been by design in Fiddler for some time and the PAC file information cannot be modified because it is based on the information at attach. However, in a future release we plan to alter the logic which would enable bypassing this. 

Additionally, we previously introduced the Telerik.NetworkConnections API which may be used to achieve the desired results in a FiddlerCore application. Although, the documentation for this won't be ready until the next release which is tentatively set for Mid-October. For a general explanation on how to use the API see the How do I use Telerik.NetworkConnections forum post. 

At this time, I recommend trying to use the Telerik.NetworkConnections API or waiting until the next release which should enable the functionality described. 

Please let me know if you need any additional information. As always, thank you for using Fiddler.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
the East Wind
Top achievements
Rank 1
answered on 27 Sep 2019, 08:58 AM

Hi,Eric

Thanks for your reply and time again.

Fiddler is awesome,it's amazing.Thank you for providing such a great tool.

I read Simeon's reply in the post, and I understand his logic.But in practice, I found that NetworkConnectionManager seemed unavailable, and I didn't find a way to implement this logic in FIddlerCore.

Did I miss something, or did I use fidlercore incorrectly?Are there any other demos or documents available?This may seem lazy, but I really didn't find any other way.

Thanks

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 01 Oct 2019, 05:27 PM

Hello,

At this time, we are still working on delivering the Fiddler Core API documentation. We hope to have this ready very soon.

As for the Telerik.NetworkConnectionManager, this is included in the Fiddler Core download. This requires a reference to the assembly titled, Telerik.NetworkConnections.dll

Please let me know if you need any addition. Thank you for being a valued Fiddler Core developer.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
the East Wind
Top achievements
Rank 1
answered on 08 Oct 2019, 02:16 AM

Hi,Eric

Thanks for your replay and time again.

I used the method provided in this post.I have also added the Telerik.Net workConnections. DLL as a reference

using (DirectoryCatalog catalog = new DirectoryCatalog(directoryName, "Telerik.NetworkConnections.NetworkConnectionsManager*"))
            {
                container = new CompositionContainer(catalog);
                connectionsManager = container.GetExportedValue<NetworkConnectionsManager>();               
            }

But in the use of connectionsManager. GetCurrentProxySettingsForConnection (), it is not feasible, visual studio told me:The

definition of "object" not contained "GetCurrentProxySettingsForConnection", and couldn't find an acceptable first "object" type

parameters can access extension method "GetCurrentProxySettingsForConnection" (whether or not the lack of a using directive or

assembly reference?).This also occurs when using other methods of connectionsManager.

I think I may have done something wrong.As a beginner of c#, it's a bit difficult for me to solve this problem.Is there any more

information or demo?

Thanks

 

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 09 Oct 2019, 01:33 PM

Hello,

We are still working on the documentation. Stay tuned for an announcement when these are ready. In the meantime, after reviewing the provided code, I can see the GetCurrentProxySettingsForConnection is expecting a Telerik.NetworkConnections.NetworkConnectionFullName object.

Try using the GetAllConnectionFullNames method on the NetworkConnectionsManager object and iterate over what that returns. See below a small console application I put together that shows how to do this. Note that this will require a reference to the Telerik.NetworkConnections assembly.

 

namespace ListCurrentProxySettings
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.Composition.Hosting;
    using System.IO;
    using System.Linq;
    using System.Reflection;
    using Telerik.NetworkConnections;

    class Program
    {
        static void Main(string[] args)
        {
            List<ProxySettings> ps = ListCurrentProxySettingsInfo();

            if (ps.Count > 0)
            {
                foreach (ProxySettings settings in ps)
                {
                    Console.WriteLine($"ByPass Hosts: {settings.BypassHosts}; HTTP Host: {settings.HttpProxyHost}; HTTPS Host: {settings.HttpsProxyHost}; Socks Host: {settings.SocksProxyHost}");
                }
            }
            else
            {
                Console.WriteLine("No Proxy Settings - Press enter to continue..");
                Console.ReadLine();
            }
        }

        public static List<ProxySettings> ListCurrentProxySettingsInfo()
        {
            string location = Assembly.GetExecutingAssembly().Location;
            string directoryName = Path.GetDirectoryName(location);
            List<ProxySettings> proxySettings = new List<ProxySettings>();

            using (DirectoryCatalog catalog = new DirectoryCatalog(directoryName, "Telerik.NetworkConnections.*"))
            {
                using (CompositionContainer container = new CompositionContainer(catalog))
                {
                    NetworkConnectionsManager connectionsManager = container.GetExportedValue<NetworkConnectionsManager>();

                    List<NetworkConnectionFullName> connections = connectionsManager.GetAllConnectionFullNames().ToList();
                    foreach (NetworkConnectionFullName networkConnectionFullName in connections)
                    {
                        proxySettings.Add(connectionsManager.GetCurrentProxySettingsForConnection(networkConnectionFullName));
                    }
                }
            }

            return proxySettings;
        }
    }
}

 

Please give this a try and let me know the results. Thank you and I look forward to your reply.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
the East Wind
Top achievements
Rank 1
answered on 11 Oct 2019, 09:35 AM

Hi,Eric

This is exciting because your code works.Thank you very much.

I am still working on the ideas provided by Simeon to solve my problem. With your help, I believe I can succeed soon.Later, if I

encounter problems, I will timely feedback.Now, I have a problem and I need your help.

After studying HTTPS and how fiddlercore works, I have a question: after a successful handshake, does the client, fiddlercore, and

server use the same symmetric secret key?Is the client data received by fiddlercore encrypted after fiddlercore proxies the client?

Based on the knowledge acquired, I think that the client, fiddlercore and server use the same symmetric secret key, and fiddler's

data is not encrypted. Fiddler caches the request data, then encrypts it and sends it to the server.Am I wrong?

As far as I know, fiddler does not support any mechanism for sending HTTP requests "streaming" to the server because the

requests are read from the client -- requests are always cached before they are sent (except websocket).Will the request take

longer?In practice, I had a request to send multiple images, and the whole process slowed down significantly after using fiddler. I

think that's probably the reason.Is there a way to solve this problem?Because I want to use fiddler without affecting the session (I

just want to copy the content of HTTPS requests and responses, not change it).

Thanks

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 15 Oct 2019, 07:55 PM

Hello,

Fiddler uses a Man-in-the-Middle mechanism to decrypt SSL traffic. Using the Decrypt SSL Traffic configuration installs the Fiddler Root Certificate on the system. 

As far as sessions taking longer, Fiddler will buffer traffic but will stream audio and video by default. It is possible to enable streaming for all traffic using the Stream button in the Fiddler toolbar. I recommend enabling streaming to solve the problem.

Additionally, streaming traffic is beneficial to transmit uploads greater than 2 gigabytes because .NET is unable to buffer arrays of that size.

Please give this a try and let me know the results. Thank you and I look forward to your reply.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
the East Wind
Top achievements
Rank 1
answered on 16 Oct 2019, 09:20 AM

Hi,Eric

Thank you for helping me all the time.

I'm sorry my poor English because it's so confusing.I want to redescribe my problem to make it clear.

I've been using fiddlercore to do what I want, and now the problem is:

1. I used the application developed by fiddlercore to proxy HTTPS request and response.I don't want to change the contents of the

request and response but rather decrypt them and save them to a file, and I don't want to impact the time taken for the request and

response,too.Sometimes, however, the content requested is so large (though large, not larger than 2G) that the request is slow.As I

learned in this post, HTTPS requests can also be streamed. Can I stream requests and responses without affecting the session,

decrypt and save both requests and responses at the same time?If this is available, how can I implement it in my code?Is the

following code feasible

Fiddler.FiddlerApplication.BeforeRequest += delegate (Fiddler.Session oS){
oS["log-drop-request-body"] = "streamingThisRequest";
oS.oRequest.BufferRequest = false;
Console.WriteLine(oS.GetRequestBodyAsString());
}
 
Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) {
oS["log-drop-response-body"] = "streamingThisResponse";
oS.bBufferResponse = false;
Console.WriteLine(oS.GetResponseBodyAsString());
}

 

2. I would like to know whether the traffic sent by the client to fiddler is encrypted during the fiddler proxy process.If it is encrypted, is

the secret key used generated by the client and server in the previous handshake?Fiddler just grabs the secret key and uses it to

decrypt traffic?

Thanks

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 16 Oct 2019, 06:54 PM

Hello,

I would like to provide an update to the original post. The Feedback Request for Hook using Only PAC Script has been created and is slated to be included in the next Fiddler Core release. 

Lastly, in an effort to keep this thread on topic, this thread will be closed and any new posts unrelated to the original post should be created in a new Thread. As always, thank you for using the Fiddler Forums.

Regards,


Eric R | Technical Support Engineer
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
raghu
Top achievements
Rank 1
answered on 17 Jul 2020, 03:53 PM

Hi

I am using PAC script to use proxy for configured URLS. but still i could see the traffic going through fiddler. 

function FindProxyForURL(url, host){
  var local_proxy = "PROXY 127.0.0.1:8888";
var proxy_list= Array(
"*.youtube.com/*",
"*.yahoo.com/*"
);
for (var iter = 0; iter < proxy_list.length; ++iter)
{
     if (shExpMatch(url, proxy_list[iter]))
     {
       return local_proxy;
     }
}

return "DIRECT";  
}

When we try to connect to VPN(FortiClient) connection is established and closed.

Do we have any option not to use check SSL validation for certain domains.

Tags
FiddlerCore
Asked by
Calvin
Top achievements
Rank 1
Answers by
the East Wind
Top achievements
Rank 1
Eric R | Senior Technical Support Engineer
Telerik team
raghu
Top achievements
Rank 1
Share this question
or