Fiddler Classic - Scripts - Get Public IP Address

1 Answer 332 Views
Fiddler Classic
E
Top achievements
Rank 1
Iron
E asked on 06 Jan 2023, 06:57 PM | edited on 06 Jan 2023, 07:04 PM
Is there any way possible to get your Public IP address within Fiddler Scripts (ScriptEditor in Customize Rules)? I attempted to use certain methods that you could do using C# (translated to Script language). I also thought that maybe It was possible to execute another script file (like powershell file) that could return a value within Fiddler Scripts... but so far could not find any way of retrieving public IP

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 11 Jan 2023, 09:19 AM

Hello E R,

 

Your ISP assigns the public IP, and your connection usually is not using it directly but through the ISP network. Some ISPs assign dynamic IPs (a public IP that changes on some period/event) or a static IP. You can use a third-party service or endpoint (like http://icanhazip.com or https://www.whatsmyip.org/) to obtain your public IP through a request and some additional parsing.

A basic example that demonstrates the above with http://icanhazip.com through FiddlerScript

static function OnBeforeResponse(oSession: Session) {
  
        if (oSession.fullUrl.Contains("icanhazip.com")) {
            oSession.utilDecodeResponse();
            var sBody = oSession.GetResponseBodyAsString();
          
            MessageBox.Show(sBody);
        }
}

 

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.

Tags
Fiddler Classic
Asked by
E
Top achievements
Rank 1
Iron
Answers by
Nick Iliev
Telerik team
Share this question
or