10 Answers, 1 is accepted
0

Zsolt
Top achievements
Rank 1
answered on 17 Nov 2015, 06:50 PM
I managed to do a workaround with the ,start,stop,dump functions. there is any function where can dump/save to .txt file the selected (@host) sessions to any location? thanks
0
Hello, Zsolt--
I assume you've figured out that a command runner can use the ExecAction.exe program to invoke QuickExec commands inside Fiddler?
Those QuickExec commands simply invoke the OnExecAction handler inside your Fiddler Rules Script (Rules > Customize Rules...). If you examine the source of that function, you can see how you can add new commands that do anything you like, implemented in JScript.NET.
I'm not entirely clear on what you want your function to do, but you'll probably use the File.WriteAllText method (after adding import System.IO and System.Text to the list atop your script) to write a text file. You would get the list of Sessions in the Session list using FiddlerApplication.UI.GetAllSessions();
So, maybe something like:
case "dumphosts":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllHosts: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
sbAllHosts.AppendLine(arrSess[i].host);
}
File.WriteAllText("C:\\temp\\allHosts.txt", sbAllHosts.ToString());
return true;
Regards,
Eric Lawrence
Telerik
I assume you've figured out that a command runner can use the ExecAction.exe program to invoke QuickExec commands inside Fiddler?
Those QuickExec commands simply invoke the OnExecAction handler inside your Fiddler Rules Script (Rules > Customize Rules...). If you examine the source of that function, you can see how you can add new commands that do anything you like, implemented in JScript.NET.
I'm not entirely clear on what you want your function to do, but you'll probably use the File.WriteAllText method (after adding import System.IO and System.Text to the list atop your script) to write a text file. You would get the list of Sessions in the Session list using FiddlerApplication.UI.GetAllSessions();
So, maybe something like:
case "dumphosts":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllHosts: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
sbAllHosts.AppendLine(arrSess[i].host);
}
File.WriteAllText("C:\\temp\\allHosts.txt", sbAllHosts.ToString());
return true;
Regards,
Eric Lawrence
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

Zsolt
Top achievements
Rank 1
answered on 18 Nov 2015, 03:28 PM
Hi, Eric
Thanks for your reply it helps a lot! I'm trying to create my function however I'm struggling with it. What I'm trying to achieve is:
select the specified host's (param[1]) header and save it to a file(param[2]) and/or the command line would return it. Specifically I want to get the Cookies from it at the same format how it's showing at the Raw View.
0

Zsolt
Top achievements
Rank 1
answered on 18 Nov 2015, 03:38 PM
I read the have doesn't work for me.How can I switch that on? Can't find it
0

Zsolt
Top achievements
Rank 1
answered on 18 Nov 2015, 03:46 PM
This forum really needs an edit button :D so actually intelliSense works but only if I specify the full length as FiddlerApplication.UI.andthefunctions come up here. I did import FiddlerApplication.UI; what am I missing?
0
Hello, Zsolt--
It's hard to keep track of what your questions are.
Intellisense in the FiddlerScript Editor is based on the capabilities of the underlying component; various "shorthand" objects (e.g. "UI") don't have Intellisense behaviors.
select the specified host's (param[1]) header and save it to a file(param[2]) and/or the command line would return it. Specifically I want to get the Cookies from it at the same format how it's showing at the Raw View.
I think you're saying you want to be able to do
ExecAction.exe "dumpcookies example.com C:\temp\CookiesFromExample.txt"
...is that right?
You haven't mentioned whether you're looking for the REQUEST Cookie header or the RESPONSE Set-Cookie header?
case "dumpcookies":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllCookies: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
if (arrSess[i].HostnameIs(sParams[0]))
{
// Get Cookie
var sCookie = arrSess[i].RequestHeaders["Cookie"];
if (!String.IsNullOrEmpty(sCookie)){
sbAllCookies.AppendLine(sCookie);
}
}
File.WriteAllText(sParams[1], sbAllCookies.ToString());
return true;
Regards,
Eric Lawrence
Telerik
It's hard to keep track of what your questions are.
Intellisense in the FiddlerScript Editor is based on the capabilities of the underlying component; various "shorthand" objects (e.g. "UI") don't have Intellisense behaviors.
select the specified host's (param[1]) header and save it to a file(param[2]) and/or the command line would return it. Specifically I want to get the Cookies from it at the same format how it's showing at the Raw View.
I think you're saying you want to be able to do
ExecAction.exe "dumpcookies example.com C:\temp\CookiesFromExample.txt"
...is that right?
You haven't mentioned whether you're looking for the REQUEST Cookie header or the RESPONSE Set-Cookie header?
case "dumpcookies":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllCookies: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
if (arrSess[i].HostnameIs(sParams[0]))
{
// Get Cookie
var sCookie = arrSess[i].RequestHeaders["Cookie"];
if (!String.IsNullOrEmpty(sCookie)){
sbAllCookies.AppendLine(sCookie);
}
}
File.WriteAllText(sParams[1], sbAllCookies.ToString());
return true;
Regards,
Eric Lawrence
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

Zsolt
Top achievements
Rank 1
answered on 18 Nov 2015, 06:20 PM
Nice examples Eric! However, I realized I asked the question wrongly. I want to get the cookies of a specific not host. Sorry for it but your examples gave me enough knowledge to craft this:
for selecting I wanted to use the ? command which works if I do it in the but it isn't If I do through cmd?! How can I select the URL so after I can proceed with the script?
for selecting I wanted to use the ? command which works if I do it in the but it isn't If I do through cmd?! How can I select the URL so after I can proceed with the script?
case "savecookie":
var Session = FiddlerApplication.UI.GetFirstSelectedSession();
File.WriteAllText(sParams[1], Session.RequestHeaders["Cookie"].ToString());
return true;
0
Accepted
You can just do this (remove the break if you want to allow multiple instances of the target URL):
case "dumpcookies":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllCookies: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
if (arrSess[i].fullUrl == sParams[0])
{
// Get Cookie
var sCookie = arrSess[i].RequestHeaders["Cookie"];
if (!String.IsNullOrEmpty(sCookie)){
sbAllCookies.AppendLine(sCookie);
break;
}
}
File.WriteAllText(sParams[1], sbAllCookies.ToString());
return true;
Regards,
Eric Lawrence
Telerik
case "dumpcookies":
var arrSess: Fiddler.Session[] = FiddlerApplication.UI.GetAllSessions();
var sbAllCookies: StringBuilder = new StringBuilder();
for (var i = 0; i < arrSess.Length; i++)
{
if (arrSess[i].fullUrl == sParams[0])
{
// Get Cookie
var sCookie = arrSess[i].RequestHeaders["Cookie"];
if (!String.IsNullOrEmpty(sCookie)){
sbAllCookies.AppendLine(sCookie);
break;
}
}
File.WriteAllText(sParams[1], sbAllCookies.ToString());
return true;
Regards,
Eric Lawrence
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

Zsolt
Top achievements
Rank 1
answered on 18 Nov 2015, 07:51 PM
Eric you saved my day! I appreciate it! It works like !
Just add an extra closing curly bracket after the change sParams[0] to sParams[1] and sParams[1] to sParams[2] if somebody else wants to use it.
I wasn't beware of the fullURL property
Just add an extra closing curly bracket after the change sParams[0] to sParams[1] and sParams[1] to sParams[2] if somebody else wants to use it.
I wasn't beware of the fullURL property
0
Sorry about the typos, glad you got it working.
In the Fiddler Script Editor, the View > Class Explorer command is a great way to learn about the object model available to you. The Fiddler Book is another good reference.
Regards,
Eric Lawrence
Telerik
In the Fiddler Script Editor, the View > Class Explorer command is a great way to learn about the object model available to you. The Fiddler Book is another good reference.
Regards,
Eric Lawrence
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