Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports Fiddler
- Imports System.Text
- Public Class Form1
- ReadOnly sSecureEndpointHostname As String = "localhost"
- ReadOnly iSecureEndpointPort As Integer = 7777
- ReadOnly oSecureEndpoint As Proxy
- Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
- ShutDown()
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerApplication_BeforeResponse
- AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerApplication_BeforeRequest
- End Sub
- Private Sub FiddlerApplication_BeforeRequest(ByVal oSession As Session)
- If oSession.fullUrl.StartsWith("http://lol.js") = True Then
- ' oSession.bBufferResponse = true;
- oSession.bBufferResponse = True
- oSession.fullUrl = "http://lol.com"
- Else
- MessageBox.Show(oSession.fullUrl)
- oSession.bBufferResponse = True
- End If
- End Sub
- Private Sub FiddlerApplication_BeforeResponse(ByVal oSession As Session)
- If oSession.fullUrl.StartsWith("http://lol.js") = True Then
- '
- ' oSession.utilDecodeResponse();
- Dim responseBytes As Byte() = UTF8Encoding.UTF8.GetBytes("<html>Testing Fiddler</html>")
- '
- oSession.ResponseBody = responseBytes
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Button1.Enabled = False
- Button2.Enabled = True
- Dim oFCSF As FiddlerCoreStartupFlags = FiddlerCoreStartupFlags.Default
- Fiddler.FiddlerApplication.Startup(Convert.ToInt32(TextBox1.Text), oFCSF)
- End Sub
- Private Sub ShutDown()
- RemoveHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerApplication_BeforeResponse
- RemoveHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerApplication_BeforeRequest
- Fiddler.FiddlerApplication.Shutdown()
- If oSecureEndpoint IsNot Nothing Then
- oSecureEndpoint.Dispose()
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- Button1.Enabled = True
- Button2.Enabled = False
- ShutDown()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment