Guest User

VB.NET Tor alternative

a guest
Jan 14th, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.35 KB | None | 0 0
  1. Imports Fiddler
  2. Imports System.Text
  3.  
  4. Public Class Form1
  5.  
  6.     ReadOnly sSecureEndpointHostname As String = "localhost"
  7.     ReadOnly iSecureEndpointPort As Integer = 7777
  8.     ReadOnly oSecureEndpoint As Proxy
  9.  
  10.     Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
  11.         ShutDown()
  12.     End Sub
  13.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  14.         AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerApplication_BeforeResponse
  15.         AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerApplication_BeforeRequest
  16.     End Sub
  17.     Private Sub FiddlerApplication_BeforeRequest(ByVal oSession As Session)
  18.         If oSession.fullUrl.StartsWith("http://lol.js") = True Then
  19.             '  oSession.bBufferResponse = true;
  20.             oSession.bBufferResponse = True
  21.             oSession.fullUrl = "http://lol.com"
  22.         Else
  23.             MessageBox.Show(oSession.fullUrl)
  24.             oSession.bBufferResponse = True
  25.         End If
  26.  
  27.  
  28.     End Sub
  29.     Private Sub FiddlerApplication_BeforeResponse(ByVal oSession As Session)
  30.         If oSession.fullUrl.StartsWith("http://lol.js") = True Then
  31.             '
  32.             '  oSession.utilDecodeResponse();
  33.             Dim responseBytes As Byte() = UTF8Encoding.UTF8.GetBytes("<html>Testing Fiddler</html>")
  34.             '
  35.             oSession.ResponseBody = responseBytes
  36.         End If
  37.  
  38.  
  39.     End Sub
  40.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  41.         Button1.Enabled = False
  42.         Button2.Enabled = True
  43.  
  44.         Dim oFCSF As FiddlerCoreStartupFlags = FiddlerCoreStartupFlags.Default
  45.         Fiddler.FiddlerApplication.Startup(Convert.ToInt32(TextBox1.Text), oFCSF)
  46.  
  47.     End Sub
  48.     Private Sub ShutDown()
  49.         RemoveHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerApplication_BeforeResponse
  50.         RemoveHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerApplication_BeforeRequest
  51.         Fiddler.FiddlerApplication.Shutdown()
  52.         If oSecureEndpoint IsNot Nothing Then
  53.             oSecureEndpoint.Dispose()
  54.         End If
  55.     End Sub
  56.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  57.         Button1.Enabled = True
  58.         Button2.Enabled = False
  59.  
  60.         ShutDown()
  61.     End Sub
  62. End Class
Advertisement
Add Comment
Please, Sign In to add comment