Skip to content

Instantly share code, notes, and snippets.

@polarnik
Last active June 1, 2022 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polarnik/0408cf8a4e9916c4308b8c31b10d9aaf to your computer and use it in GitHub Desktop.
Save polarnik/0408cf8a4e9916c4308b8c31b10d9aaf to your computer and use it in GitHub Desktop.
Fiddler 4 Classic. WebSocket test Generator
// https://www.telerik.com/blogs/what-s-new-in-fiddler-2-4-4-5
public static void Main() {
// ...
FiddlerApplication.UI   
.RegisterCustomHotkey(
HotkeyModifiers.Alt,    
Keys.G,
"Generate"
);
// ...
}
public static bool OnExecAction(string[] sParams) {
// ...  
case "Generate":   
doGenerateCode();   
return true;
// ...
}
public static void doGenerateCode() {  
var arrS = FiddlerApplication.UI.GetSelectedSessions();  
for (int x = 0; x < arrS.Length; x++) {   
var session = arrS[x];   
if (session.isFlagSet(SessionFlags.IsWebSocketTunnel)) {    
var headers = session.oRequest.headers;    
if( headers.Get("wsFrom")=="Client"
&& headers.Get("wsFrameType")=="Text"
//&& ...
) {
// ... generation
// file.append("ws.send(\"" + headers.Get("wsPayload") + "\");" );
// ... generation
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment