Custom rules loaded from a external program.

1 Answer 51 Views
Fiddler Classic
herson
Top achievements
Rank 2
Veteran
herson asked on 01 Jan 2024, 01:01 PM
I will try to be very precise in the question. I have a C# program that uses fiddler, but I want to be able to modify the fiddler script using the program for example. When opening the program it would load the script I need into fiddler or edit it within fiddler automatically. I would like to know if there is a way to do this? Automatically load or edit the rules script in real time using an external program. I prefer to edit because unpacking the custom rules in the folder generally has difficulties as Windows blocks file modifications, etc. Thanks.

1 Answer, 1 is accepted

Sort by
1
Accepted
Nick Iliev
Telerik team
answered on 01 Jan 2024, 01:10 PM

Hello Herson,

 

There is no out-of-the-box option to dynamically change the FiddlerScript code on the fly. It seems that you would need your own Fiddler implementation, which you can achieve while using the FiddlerCore .NET library.

https://www.telerik.com/fiddlercore 

https://docs.telerik.com/fiddlercore/introduction 

 

Regards,
Nick Iliev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

herson
Top achievements
Rank 2
Veteran
commented on 01 Jan 2024, 02:29 PM

Yes, I tried but fiddleCore cannot make it a single .exe and there is a problem that every time it runs it is necessary to reinstall the certificate. This complicates things a lot. Thank you. Happy New Year.
Rosen Vladimirov
Telerik team
commented on 03 Jan 2024, 02:23 PM

By default the certmakers generate the certificate authority only in-memory and that's why you need to trust it every time when you start the application with FiddlerCore. However, you can use BCCertMaker and store the file on a well-known place (ensure it is secured and password protected):
// Use BCCertMaker provider which allows storing the root cert as .p12
BCCertMaker.BCCertMaker certProvider = new BCCertMaker.BCCertMaker();
CertMaker.oCertProvider = certProvider;
 
string rootCertificatePath = @"C:\Users\username\RootCertificateAuthority.p12";
string rootCertificatePassword = "strongPasswordHere";
if (File.Exists(rootCertificatePath))
{
    certProvider.ReadRootCertificateAndPrivateKeyFromPkcs12File(rootCertificatePath, rootCertificatePassword);
} 
else
{
    if (!CertMaker.createRootCert())
    {
        Console.WriteLine("Unable to generate FiddlerCore's root certificate");
        return;
    }

    if (!CertMaker.trustRootCert())
    {
        Console.WriteLine("Unable to trust FiddlerCore's root certificate.");
        return;
    }

    // Store the file for next time
    certProvider.WriteRootCertificateAndPrivateKeyToPkcs12File(rootCertificatePath, rootCertificatePassword);
}


if (CertMaker.rootCertIsTrusted() || CertMaker.rootCertIsMachineTrusted())
{
    Console.WriteLine("CERTIFICATE IS TRUSTED!!!");
}
herson
Top achievements
Rank 2
Veteran
commented on 03 Jan 2024, 10:36 PM

thankyou very much I will try it.
Tags
Fiddler Classic
Asked by
herson
Top achievements
Rank 2
Veteran
Answers by
Nick Iliev
Telerik team
Share this question
or