Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit On Imports Fiddler Imports System.Net Imports System.IO Public Class Form1 Dim url As String = Nothing Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler AddHandler Application.ApplicationExit, AddressOf ShutdownFiddlerApp Dim oFlags As FiddlerCoreStartupFlags = FiddlerCoreStartupFlags.Default FiddlerApplication.Startup(0, oFlags) MsgBox("Started proxy on port " & FiddlerApplication.oProxy.ListenPort) End Sub Private Sub ShutdownFiddlerApp() FiddlerApplication.Shutdown() MsgBox("Unloaded proxy") Threading.Thread.Sleep(1000) End Sub Private Sub FiddlerBeforeRequestHandler(ByVal tSession As Session) RichTextBox1.BeginInvoke(New AsyncMethodCaller(AddressOf AddText), tSession.fullUrl) End Sub Private Sub FiddlerBeforeResponseHandler(ByVal tSession As Session) End Sub Public Sub Verification() Try ListeMot.AddRange(IO.File.ReadAllLines("C:UsersClémentDocumentsListeDeMots.txt")) Dim found As Boolean = False For Each s As String In ListeMot If url.ToLower.Contains("-" & s.ToLower & "-") Or url.ToLower.Contains("." & s.ToLower & ".") Or url.ToLower.Contains("." & s.ToLower & "-") Or url.ToLower.Contains("-" & s.ToLower & ".") Then MsgBox("Un mot interdit dans l'URL a été détecté :" & s) End If Next Catch End Try Try Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString(url) Dim client As WebClient = New WebClient() Dim data As Stream = client.OpenRead(url) Dim reader As StreamReader = New StreamReader(data) Dim Page As String = reader.ReadToEnd ListeMot.AddRange(IO.File.ReadAllLines("C:UsersClémentDocumentsListeDeMots.txt")) Dim found As Boolean = False For Each s As String In ListeMot If Page.ToLower.Contains(" " & s.ToLower & " ") Then MsgBox("Un mot interdit a été détecté :" & s) End If Next Catch End Try End Sub Dim ListeMot As New List(Of String) Private Sub AddText(sText As String) Dim url2 As Uri url2 = New Uri(sText) If url2.AbsolutePath.EndsWith(".js") = False And url2.AbsolutePath.EndsWith(".jpg") = False And url2.AbsolutePath.EndsWith(".gif") = False And url2.AbsolutePath.EndsWith(".png") = False And url2.AbsolutePath.EndsWith(".css") = False And url2.AbsolutePath.EndsWith(".ico") = False And url2.AbsolutePath.EndsWith(":443") = False Then RichTextBox1.AppendText(sText & vbCrLf) url = sText Dim Thread As New Threading.Thread(AddressOf Verification) Thread.Start() End If End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub End Class Public Delegate Sub AsyncMethodCaller(sText As String)
Option Explicit On Imports Fiddler Imports System.Net Imports System.IO Imports Microsoft.Win32 Public Class Form1 Dim ListeMots As New List(Of String) Dim url As String = Nothing Public Delegate Sub AsyncMethodCaller(sText As String) Private Sub ShutdownFiddlerApp() FiddlerApplication.Shutdown() MsgBox("Unloaded proxy") Threading.Thread.Sleep(1000) End Sub Private Sub FiddlerBeforeRequestHandler(ByVal tSession As Session) RichTextBox1.BeginInvoke(New AsyncMethodCaller(AddressOf AddText), tSession.fullUrl) End Sub Private Sub FiddlerBeforeResponseHandler(ByVal tSession As Session) End Sub Public Sub VerificationPage() Try Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString(url) Dim client As WebClient = New WebClient() Dim data As Stream = client.OpenRead(url) Dim reader As StreamReader = New StreamReader(data) Dim Page As String = reader.ReadToEnd ListeMots.AddRange(IO.File.ReadAllLines("C:Users\" & System.Environment.UserName & "DocumentsListeDeMots.txt")) Dim found As Boolean = False For Each s As String In ListeMots If Page.ToLower.Contains(" " & s.ToLower & " ") = True Or Page.ToLower.Contains("<h1>" & s.ToLower & "</h1>") = True Then RichTextBox1.Clear() MsgBox("Un mot interdit a été détecté :" & s) End If Next Catch End Try End Sub Public Sub VerificationURL() Try Dim found As Boolean = False For Each s As String In ListeMots If url.ToLower.Contains("-" & s.ToLower & "-") = True Or url.ToLower.Contains("." & s.ToLower & ".") = True Or url.ToLower.Contains("." & s.ToLower & "-") = True Or url.ToLower.Contains("-" & s.ToLower & ".") = True Then RichTextBox1.Clear() MsgBox("Un mot interdit dans l'URL a été détecté :" & s) End If Next Catch End Try End Sub Private Sub AddText(sText As String) RichTextBox1.SelectAll() Dim nbrligne As Integer = RichTextBox1.GetLineFromCharIndex(RichTextBox1.SelectionLength()) If nbrligne > 40 Then RichTextBox1.Clear() End If Dim url2 As Uri url2 = New Uri(sText) If url2.AbsolutePath.EndsWith(".js") = False And url2.AbsolutePath.EndsWith(".jpg") = False And url2.AbsolutePath.EndsWith(".gif") = False And url2.AbsolutePath.EndsWith(".png") = False And url2.AbsolutePath.EndsWith(".css") = False And url2.AbsolutePath.EndsWith(".ico") = False And url2.AbsolutePath.EndsWith(".jpeg") = False And RichTextBox1.Text.Contains(sText) = False And url2.ToString.Length < 200 = True Then RichTextBox1.AppendText(sText & vbCrLf) url = sText Dim ThreadVerificationPage As New Threading.Thread(AddressOf VerificationPage) ThreadVerificationPage.Start() Dim ThreadVerificationURL As New Threading.Thread(AddressOf VerificationURL) ThreadVerificationURL.Start() End If End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler AddHandler Application.ApplicationExit, AddressOf ShutdownFiddlerApp Dim oFlags As FiddlerCoreStartupFlags = FiddlerCoreStartupFlags.Default FiddlerApplication.Startup(0, oFlags) MsgBox("Started proxy on port " & FiddlerApplication.oProxy.ListenPort) End Sub End Class
Option Explicit On Imports Fiddler Imports System.Net Imports System.IO Imports Microsoft.Win32 Public Class Form1 Dim ListeMots As New List(Of String) Dim url As String = Nothing Public Delegate Sub AsyncMethodCaller(sText As String) Private Sub ShutdownFiddlerApp() FiddlerApplication.Shutdown() MsgBox("Unloaded proxy") Threading.Thread.Sleep(1000) End Sub Private Sub FiddlerBeforeRequestHandler(ByVal tSession As Session) RichTextBox1.BeginInvoke(New AsyncMethodCaller(AddressOf AddText), tSession.fullUrl) End Sub Private Sub FiddlerBeforeResponseHandler(ByVal tSession As Session) End Sub Public Sub VerificationPage() Try Dim webClient As New System.Net.WebClient Dim result As String = webClient.DownloadString(url) Dim client As WebClient = New WebClient() Dim data As Stream = client.OpenRead(url) Dim reader As StreamReader = New StreamReader(data) Dim Page As String = reader.ReadToEnd ListeMots.AddRange(IO.File.ReadAllLines("C:Users\" & System.Environment.UserName & "DocumentsListeDeMots.txt")) Dim found As Boolean = False For Each s As String In ListeMots If Page.ToLower.Contains(" " & s.ToLower & " ") = True Or Page.ToLower.Contains("<h1>" & s.ToLower & "</h1>") = True Then RichTextBox1.Clear() MsgBox("Un mot interdit a été détecté :" & s) End If Next Catch End Try End Sub Public Sub VerificationURL() Try Dim found As Boolean = False For Each s As String In ListeMots If url.ToLower.Contains("-" & s.ToLower & "-") = True Or url.ToLower.Contains("." & s.ToLower & ".") = True Or url.ToLower.Contains("." & s.ToLower & "-") = True Or url.ToLower.Contains("-" & s.ToLower & ".") = True Then RichTextBox1.Clear() MsgBox("Un mot interdit dans l'URL a été détecté :" & s) End If Next Catch End Try End Sub Private Sub AddText(sText As String) RichTextBox1.SelectAll() Dim nbrligne As Integer = RichTextBox1.GetLineFromCharIndex(RichTextBox1.SelectionLength()) If nbrligne > 40 Then RichTextBox1.Clear() End If Dim url2 As Uri url2 = New Uri(sText) If url2.AbsolutePath.EndsWith(".js") = False And url2.AbsolutePath.EndsWith(".jpg") = False And url2.AbsolutePath.EndsWith(".gif") = False And url2.AbsolutePath.EndsWith(".png") = False And url2.AbsolutePath.EndsWith(".css") = False And url2.AbsolutePath.EndsWith(".ico") = False And url2.AbsolutePath.EndsWith(".jpeg") = False And RichTextBox1.Text.Contains(sText) = False And url2.ToString.Length < 200 = True Then RichTextBox1.AppendText(sText & vbCrLf) url = sText Dim ThreadVerificationPage As New Threading.Thread(AddressOf VerificationPage) ThreadVerificationPage.Start() Dim ThreadVerificationURL As New Threading.Thread(AddressOf VerificationURL) ThreadVerificationURL.Start() End If End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. AddHandler FiddlerApplication.BeforeResponse, AddressOf FiddlerBeforeResponseHandler AddHandler FiddlerApplication.BeforeRequest, AddressOf FiddlerBeforeRequestHandler AddHandler Application.ApplicationExit, AddressOf ShutdownFiddlerApp Dim oFlags As FiddlerCoreStartupFlags = FiddlerCoreStartupFlags.Default FiddlerApplication.Startup(0, oFlags) MsgBox("Started proxy on port " & FiddlerApplication.oProxy.ListenPort) End Sub End Class
25 août 2013 à 23:35
c'est également ce que m'avait conseillé un membre de Developpez lorsque j'avais du mal à bloquer les sites via le hosts (problème de fichier inaccessible maintenant résolu). J'ai cherché sur internet comment créer un proxy mais je n'ai rien trouvé de concluant (ou du moins compréhensible à mon niveau), de plus il y a une chose que je ne comprends pas, en plus de devoir configurer automatiquement le navigateur pour qu'il utilise mon proxy, il faudrait que je programme ce dernier afin qu'il bloque certains mots, sites ... Mais je n'ai aucune idée de comment faire, pourrais-tu m'indiquer une piste ? Une procédure ?
Merci d'avance !