Automatische Proxy-Rotation: Liest die Serverliste aus einer proxy.txt im selben Ordner und schaltet zyklisch von einem Proxy zum nächsten durch.
Einstellbares Intervall: Du legst fest, wie viele Minuten ein Proxy aktiv bleibt, bevor der nächste an der Reihe ist.
Direkte Windows-Übernahme: Ändert die Proxy-Einstellung direkt im System und zwingt den Browser zur sofortigen Übernahme – ganz ohne Neustart.
Dezenter Hintergrundbetrieb: Minimiert sich sauber in die Windows-Taskleiste (System Tray) und meldet jeden Wechsel kurz per Pop-up-Benachrichtigung unten rechts.
Sauberes Beenden: Beim Schließen des Programms wird der Proxy automatisch deaktiviert, damit dein Internet danach normal weiterläuft.
Internet Explorer, Microsoft Edge oder Chrome
EN
Automatic proxy rotation: Reads the server list from a `proxy.txt` file in the same folder and cycles through the proxies one by one.
Adjustable interval: You define how many minutes a proxy remains active before the next one takes over.
Direct Windows integration: Changes proxy settings directly within the system and forces the browser to adopt them immediately—no restart required.
Discreet background operation: Minimizes neatly to the Windows system tray and briefly announces each switch via a pop-up notification in the bottom-right corner.
Clean shutdown: Automatically disables the proxy when the program is closed, ensuring your internet connection returns to normal.
@ off
setlocal EnableDelayedExpansion
title Proxy Rotator - Automatische Umschaltung
:: Zentrale Variablen-Definitionen
set "SCRIPT_DIR=%~dp0"
set "PROXYFILE=%SCRIPT_DIR%proxy.txt"
set "REGKEY=HKCU\Software\Microsoft\Windows\CurrentVer sion\Internet Settings"
set "last_idx=0"
:: Pruefen, ob proxy.txt im selben Ordner existiert
if not exist "%PROXYFILE%" (
cls
echo ================================================== ======
echo FEHLER: proxy.txt wurde nicht gefunden!
echo ================================================== ======
echo Bitte erstelle die Datei "proxy.txt" im selben Ordner:
echo %SCRIPT_DIR%
echo und trage dort Proxys ein ^(Format: IP:PORT, einer pro Zeile^).
echo ================================================== ======
echo.
pause
exit /b
)
if "%user_choice%"=="1" goto SET_ONCE
if "%user_choice%"=="2" goto ROTATE_LOOP
if "%user_choice%"=="3" goto SHOW_PROXY
if "%user_choice%"=="4" goto DISABLE_PROXY
if "%user_choice%"=="5" exit /b
goto MAIN_MENU
:LOAD_PROXIES
:: Vorhandene Array-Variablen bereinigen
if defined count (
for /l %%i in (1,1,!count!) do set "proxy[%%i]="
)
set count=0
for /f "usebackq eol=# tokens=1*" %%A in ("%PROXYFILE%") do (
if not "%%A"=="" (
set /a count+=1
set "proxy[!count!]=%%A"
)
)
exit /b
:PICK_PROXY
:: Falls mehr als 1 Proxy existiert, direkten Wiederholungs-Fetch vermeiden
:RE_PICK
set /a rand_idx=(%random% %% count) + 1
if %count% GTR 1 (
if !rand_idx!==%last_idx% goto RE_PICK
)
set "selected_proxy=!proxy[%rand_idx%]!"
set "last_idx=%rand_idx%"
exit /b
:SET_ONCE
call :LOAD_PROXIES
if %count% LEQ 0 (
cls
echo FEHLER: Die Datei proxy.txt ist leer oder enthaelt nur Leerzeilen!
echo.
pause
goto MAIN_MENU
)
call :PICK_PROXY
call :APPLY_PROXY
cls
echo ================================================== ======
echo Proxy erfolgreich gesetzt: %selected_proxy%
echo ================================================== ======
echo.
pause
goto MAIN_MENU
:ROTATE_LOOP
call :LOAD_PROXIES
if %count% LEQ 0 (
cls
echo FEHLER: Die Datei proxy.txt ist leer oder enthaelt nur Leerzeilen!
echo.
pause
goto MAIN_MENU
)
call :PICK_PROXY
call :APPLY_PROXY
cls
echo ================================================== ======
echo PROXY ROTATOR - AKTIV
echo ================================================== ======
echo.
echo Aktiver Proxy: %selected_proxy%
echo Gesamte Proxys: %count% Stueck geladen
echo Aktiviert am: %date% um %time% Uhr
echo.
echo ================================================== ======
echo Der Proxy wird alle 5 Minuten automatisch gewechselt.
echo [Beliebige Taste druecken = Sofort naechster Wechsel]
echo [Strg + C = Skript abbrechen]
echo ================================================== ======
echo.
timeout /t 300
goto ROTATE_LOOP
:SHOW_PROXY
cls
echo ================================================== ======
echo AKTUELLER PROXY-STATUS
echo ================================================== ======
echo.
set "cur_enable=0x0"
set "cur_proxy=Keine IP zugewiesen"
for /f "tokens=3" %%E in ('reg query "%REGKEY%" /v ProxyEnable 2^>nul ^| findstr /i "ProxyEnable"') do set "cur_enable=%%E"
for /f "tokens=2,*" %%P in ('reg query "%REGKEY%" /v ProxyServer 2^>nul ^| findstr /i "ProxyServer"') do set "cur_proxy=%%Q"
' Windows-API für sofortige Übernahme der Proxy-Änderungen im Browser
<DllImport("wininet.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal dwBufferLength As Integer) As Boolean
End Function
Private Const INTERNET_OPTION_SETTINGS_CHANGED As Integer = 39
Private Const INTERNET_OPTION_REFRESH As Integer = 37
' System-Tray Objekte
Private trayMenu As New ContextMenuStrip()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
' 1. Kontextmenü für Tray-Icon (Rechtsklick)
trayMenu.Items.Clear()
trayMenu.Items.Add("Öffnen", Nothing, AddressOf RestoreFromTray)
trayMenu.Items.Add("-")
trayMenu.Items.Add("Beenden", Nothing, AddressOf ExitApplication)
' 2. NotifyIcon einrichten
If Me.Icon IsNot Nothing Then
NotifyIcon1.Icon = Me.Icon
Else
NotifyIcon1.Icon = SystemIcons.Application
End If
' Event verknüpfen (sofern nicht im Designer geschehen)
RemoveHandler NotifyIcon1.MouseDoubleClick, AddressOf NotifyIcon_MouseDoubleClick
AddHandler NotifyIcon1.MouseDoubleClick, AddressOf NotifyIcon_MouseDoubleClick
' 3. Automatisches Laden der proxy.txt beim Start
LoadProxiesFromFile()
Catch ex As Exception
MessageBox.Show("Fehler beim Initialisieren des Programms: " & ex.Message, "Startfehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- AUTOMATISCHES LADEN DER PROXY.TXT (LÄDT ALLE ZEILEN EIN) ---
Private Sub LoadProxiesFromFile()
Dim filePath As String = Path.Combine(Application.StartupPath, "proxy.txt")
If Not File.Exists(filePath) Then
lblStatus.Text = "Status: proxy.txt nicht gefunden!"
Exit Sub
End If
Try
lstProxies.Items.Clear()
Dim lines() As String = File.ReadAllLines(filePath)
Dim loadedCount As Integer = 0
For Each line As String In lines
Dim trimmedLine As String = line.Trim()
' Jede nicht-leere Zeile wird direkt in die ListBox übernommen
If Not String.IsNullOrEmpty(trimmedLine) Then
lstProxies.Items.Add(trimmedLine)
loadedCount += 1
End If
Next
If lstProxies.Items.Count > 0 Then
lstProxies.SelectedIndex = 0 ' Ersten Proxy vorauswählen
lblStatus.Text = "Status: " & loadedCount & " Proxys geladen."
Else
lblStatus.Text = "Status: Die proxy.txt ist leer!"
MessageBox.Show("Die Datei proxy.txt wurde gefunden, enthält aber keine Zeilen.", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Catch ex As Exception
MessageBox.Show("Fehler beim Lesen der proxy.txt: " & ex.Message, "Datei-Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- BUTTON 1: STARTEN ---
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
Try
' Prüfen, ob Proxys in der Liste vorhanden sind
If lstProxies.Items.Count = 0 Then
MessageBox.Show("Keine Proxys in der Liste! Bitte erstelle eine 'proxy.txt' im Programmordner.", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
' Minuten aus NumericUpDown sichern & Überlauf bei Millisekunden abfangen
Dim minutes As Double = CDbl(numInterval.Value)
If minutes < 1 Then minutes = 1
' Umrechnung in ms (1 Min = 60.000 ms)
Dim msInterval As Double = minutes * 60.0 * 1000.0
' Schutz vor Integer-Überlauf (max. ca. 24.8 Tage)
If msInterval > Integer.MaxValue Then
msInterval = Integer.MaxValue
End If
' Timer-Intervall setzen und starten
tmrProxySwitch.Interval = CInt(msInterval)
tmrProxySwitch.Start()
' Sofort den ersten/aktuellen Proxy aktivieren
SwitchToCurrentProxy()
Catch ex As Exception
MessageBox.Show("Fehler beim Starten des Timers: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- BUTTON 2: STOPPEN & RÜCKGÄNGIG MACHEN ---
Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
Try
' Timer anhalten
tmrProxySwitch.Stop()
' Proxy im System sofort wieder deaktivieren
ApplyProxy("", False)
' Windows-Benachrichtigung beim Stoppen
NotifyIcon1.ShowBalloonTip(2000, "Proxy Change", "Proxy wurde deaktiviert.", ToolTipIcon.Info)
Catch ex As Exception
MessageBox.Show("Fehler beim Stoppen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- TIMER-EVENT: WECHSELT ZUM NÄCHSTEN PROXY ---
Private Sub tmrProxySwitch_Tick(sender As Object, e As EventArgs) Handles tmrProxySwitch.Tick
Try
If lstProxies.Items.Count = 0 Then
tmrProxySwitch.Stop()
Exit Sub
End If
' Nächsten Proxy in der ListBox wählen (springt am Ende wieder auf 0)
Dim nextIndex As Integer = lstProxies.SelectedIndex + 1
If nextIndex >= lstProxies.Items.Count Then
nextIndex = 0
End If
Catch ex As Exception
lblStatus.Text = "Fehler beim Wechseln: " & ex.Message
End Try
End Sub
' --- HILFSFUNKTION: PROXY AUS DER LISTBOX AKTIVIEREN ---
Private Sub SwitchToCurrentProxy()
If lstProxies.SelectedItem IsNot Nothing Then
Dim selectedProxy As String = lstProxies.SelectedItem.ToString().Trim()
ApplyProxy(selectedProxy, True)
' Windows-Benachrichtigung anzeigen (Titel, Nachricht, Icon-Typ)
NotifyIcon1.ShowBalloonTip(2000, "Proxy Change", "Neuer Proxy aktiv:" & vbCrLf & selectedProxy, ToolTipIcon.Info)
End If
End Sub
' --- REGISTRY-SCHALTER FÜR DEN PROXY ---
Private Sub ApplyProxy(ByVal proxyAddress As String, ByVal enable As Boolean)
Try
Using key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsof t\Windows\CurrentVersion\Internet Settings", True)
If key IsNot Nothing Then
If enable Then
key.SetValue("ProxyServer", proxyAddress, RegistryValueKind.String)
key.SetValue("ProxyEnable", 1, RegistryValueKind.DWord)
Else
key.SetValue("ProxyEnable", 0, RegistryValueKind.DWord)
End If
End If
End Using
Catch ex As UnauthorizedAccessException
MessageBox.Show("Keine ausreichenden Rechte zum Ändern der Registry!", "Rechte-Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show("Fehler beim Ändern des System-Proxys: " & ex.Message, "Registry-Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- HILFSFUNKTION: SICHERES SETZEN DES NOTIFY-ICON TEXTES (MAX 63 ZEICHEN) ---
Private Sub SetNotifyIconText(ByVal text As String)
Try
If text.Length > 63 Then
text = text.Substring(0, 60) & "..."
End If
NotifyIcon1.Text = text
Catch
' Ignorieren, falls das Icon bereits zerstört wurde
End Try
End Sub
' --- MINIMIEREN & SYSTEM-TRAY STEUERUNG ---
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
Try
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
NotifyIcon1.ShowBalloonTip(1000, "Proxy Switcher", "Das Programm läuft im Hintergrund weiter.", ToolTipIcon.Info)
End If
Catch ex As Exception
' Ignorieren beim Minimieren
End Try
End Sub
Private Sub NotifyIcon_MouseDoubleClick(sender As Object, e As MouseEventArgs)
If e.Button = MouseButtons.Left Then
RestoreFromTray(Nothing, Nothing)
End If
End Sub
Private Sub RestoreFromTray(sender As Object, e As EventArgs)
Try
Me.Show()
Me.WindowState = FormWindowState.Normal
Me.BringToFront()
Catch ex As Exception
' Falls Wiederherstellung fehlschlägt
End Try
End Sub
Private Sub ExitApplication(sender As Object, e As EventArgs)
CleanUpAndExit()
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
CleanUpAndExit()
End Sub
' --- ZENTRALES UND SICHERES BEENDEN ---
Private Sub CleanUpAndExit()
Static isExiting As Boolean = False
If isExiting Then Exit Sub
isExiting = True
Try
tmrProxySwitch.Stop()
ApplyProxy("", False) ' Proxy vor Beenden ausschalten
Catch
' Ignorieren beim Herunterfahren
Finally
Try
NotifyIcon1.Visible = False
NotifyIcon1.Dispose()
Catch
End Try
Application.Exit()
End Try
End Sub
' Windows-API für sofortige Übernahme der Proxy-Änderungen im Browser
<DllImport("wininet.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal dwBufferLength As Integer) As Boolean
End Function
Private Const INTERNET_OPTION_SETTINGS_CHANGED As Integer = 39
Private Const INTERNET_OPTION_REFRESH As Integer = 37
' Timeouts (konfigurierbar an einer Stelle)
Private Const DOWNLOAD_TIMEOUT_MS As Integer = 10000
Private Const PROXY_CHECK_TIMEOUT_MS As Integer = 6000
' System-Tray Objekte
Private trayMenu As New ContextMenuStrip()
' ==================== DATEN ====================
Private ReadOnly Sources As New List(Of String)
Private ReadOnly FoundProxies As New List(Of String)
Private ReadOnly ValidProxies As New List(Of String)
Private IsRunning As Boolean = False
Private ScannerThread As Thread
Private ReadOnly LockObj As New Object()
' Ein einziger, wiederverwendeter HttpClient (Best Practice statt pro Request neu erzeugen)
Private ReadOnly SourceHttpClient As New HttpClient() With {
.Timeout = TimeSpan.FromMilliseconds(DOWNLOAD_TIMEOUT_MS)
}
' ==================== FORM LOAD ====================
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
' 1. Kontextmenü für Tray-Icon (Rechtsklick)
trayMenu.Items.Clear()
trayMenu.Items.Add("Öffnen", Nothing, AddressOf RestoreFromTray)
trayMenu.Items.Add("-")
trayMenu.Items.Add("Beenden", Nothing, AddressOf ExitApplication)
' 2. NotifyIcon einrichten
If Me.Icon IsNot Nothing Then
NotifyIcon1.Icon = Me.Icon
Else
NotifyIcon1.Icon = SystemIcons.Application
End If
' Auto-Scan und Auto-Switch direkt starten
StartProxySwitcherTimer()
AUTOSCANStart()
Catch ex As Exception
MessageBox.Show("Fehler beim Initialisieren des Programms: " & ex.Message, "Startfehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- STEUERUNG FÜR DEN AUTOMATISCHEN WINDOWS-PROXY-WECHSEL ---
Private Sub StartProxySwitcherTimer()
Dim minutes As Double = 5
If numInterval IsNot Nothing AndAlso numInterval.Value >= 1 Then
minutes = CDbl(numInterval.Value)
End If
Dim msInterval As Double = minutes * 60.0 * 1000.0
If msInterval > Integer.MaxValue Then msInterval = Integer.MaxValue
tmrProxySwitch.Interval = CInt(msInterval)
tmrProxySwitch.Start()
End Sub
' --- BUTTON 1: STARTEN ---
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
Try
StartProxySwitcherTimer()
AUTOSCANStart()
' Falls bereits Proxys existieren, direkt den ersten aktivieren
If lstProxies.Items.Count > 0 Then
SwitchToCurrentProxy()
End If
lblStatus.Text = "Status: Aktiv (Scan & Switch)"
Catch ex As Exception
MessageBox.Show("Fehler beim Starten: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- BUTTON 2: STOPPEN & RÜCKGÄNGIG MACHEN ---
Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
Try
AUTOSCANStop()
tmrProxySwitch.Stop()
' Proxy im System sofort wieder deaktivieren
ApplyProxy("", False)
NotifyIcon1.ShowBalloonTip(2000, "Proxy Change", "Proxy wurde deaktiviert.", ToolTipIcon.Info)
Catch ex As Exception
MessageBox.Show("Fehler beim Stoppen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
' --- TIMER-EVENT: WECHSELT ZUM NÄCHSTEN PROXY ---
Private Sub tmrProxySwitch_Tick(sender As Object, e As EventArgs) Handles tmrProxySwitch.Tick
Try
If lstProxies.Items.Count = 0 Then Return
Dim nextIndex As Integer = lstProxies.SelectedIndex + 1
If nextIndex >= lstProxies.Items.Count OrElse nextIndex < 0 Then
nextIndex = 0
End If
Catch ex As Exception
lblStatus.Text = "Fehler beim Wechseln: " & ex.Message
End Try
End Sub
' --- HILFSFUNKTION: PROXY AUS DER LISTBOX AKTIVIEREN ---
Private Sub SwitchToCurrentProxy()
If lstProxies.InvokeRequired Then
lstProxies.Invoke(New Action(AddressOf SwitchToCurrentProxy))
Return
End If
If lstProxies.Items.Count = 0 Then Return
If lstProxies.SelectedIndex = -1 Then
lstProxies.SelectedIndex = 0
End If
If lstProxies.SelectedItem IsNot Nothing Then
Dim selectedProxy As String = lstProxies.SelectedItem.ToString().Trim()
ApplyProxy(selectedProxy, True)
NotifyIcon1.ShowBalloonTip(2000, "Proxy Change", "Neuer Proxy aktiv:" & vbCrLf & selectedProxy, ToolTipIcon.Info)
End If
End Sub
' --- REGISTRY-SCHALTER FÜR DEN PROXY ---
Private Sub ApplyProxy(ByVal proxyAddress As String, ByVal enable As Boolean)
Try
Using key As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsof t\Windows\CurrentVersion\Internet Settings", True)
If key IsNot Nothing Then
If enable Then
key.SetValue("ProxyServer", proxyAddress, RegistryValueKind.String)
key.SetValue("ProxyEnable", 1, RegistryValueKind.DWord)
Else
key.SetValue("ProxyEnable", 0, RegistryValueKind.DWord)
End If
End If
End Using
Catch ex As UnauthorizedAccessException
MessageBox.Show("Keine ausreichenden Rechte zum Ändern der Registry!", "Rechte-Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
Catch ex As Exception
MessageBox.Show("Fehler beim Ändern des System-Proxys: " & ex.Message, "Registry-Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub SetNotifyIconText(ByVal text As String)
Try
If text.Length > 63 Then
text = text.Substring(0, 60) & "..."
End If
NotifyIcon1.Text = text
Catch
End Try
End Sub
Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
Try
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
NotifyIcon1.ShowBalloonTip(1000, "Proxy Switcher", "Das Programm läuft im Hintergrund weiter.", ToolTipIcon.Info)
End If
Catch
End Try
End Sub
Private Sub NotifyIcon_MouseDoubleClick(sender As Object, e As MouseEventArgs)
If e.Button = MouseButtons.Left Then
RestoreFromTray(Nothing, Nothing)
End If
End Sub
Private Sub RestoreFromTray(sender As Object, e As EventArgs)
Try
Me.Show()
Me.WindowState = FormWindowState.Normal
Me.BringToFront()
Catch
End Try
End Sub
Private Sub ExitApplication(sender As Object, e As EventArgs)
CleanUpAndExit()
End Sub
Private Sub CleanUpAndExit()
Static isExiting As Boolean = False
If isExiting Then Exit Sub
isExiting = True
Try
tmrProxySwitch.Stop()
Autotimer.Stop()
ApplyProxy("", False) ' Proxy vor Beenden ausschalten
Catch
Finally
Try
NotifyIcon1.Visible = False
NotifyIcon1.Dispose()
Catch
End Try
Try
SourceHttpClient.Dispose()
Catch
End Try
Application.Exit()
End Try
End Sub
Private Sub InitSources()
Sources.Clear()
Sources.Add("https://www.proxy-list.download/api/v1/get?type=http")
Sources.Add("https://api.proxyscrape.com/v2/?request=get&protocol=http&timeout=10000&country=a ll&ssl=all&anonymity=all")
Sources.Add("https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt")
Sources.Add("https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt")
Sources.Add("https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt")
Sources.Add("https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list-raw.txt")
End Sub
Private Sub Log(msg As String, Optional color As Color = Nothing)
If PLLConsole.InvokeRequired Then
PLLConsole.Invoke(New Action(Sub() Log(msg, color)))
Return
End If
If color = Nothing Then color = Color.LimeGreen
PLLConsole.SelectionStart = PLLConsole.TextLength
PLLConsole.SelectionLength = 0
PLLConsole.SelectionColor = color
PLLConsole.AppendText($"[{DateTime.Now:HH:mm:ss}] {msg}{Environment.NewLine}")
PLLConsole.ScrollToCaret()
End Sub
Private Sub SetStatus(msg As String)
If lblStatus.InvokeRequired Then
lblStatus.Invoke(New Action(Sub() SetStatus(msg)))
Return
End If
lblStatus.Text = $"Status: {msg}"
End Sub
Private Sub AddProxiesToPLL(proxies As List(Of String))
If proxies Is Nothing OrElse proxies.Count = 0 Then Return
If PLL.InvokeRequired Then
PLL.Invoke(New Action(Sub() AddProxiesToPLL(proxies)))
Return
End If
PLL.BeginUpdate()
Try
For Each p In proxies
PLL.Items.Add(p)
Next
Finally
PLL.EndUpdate()
End Try
If PLL.Items.Count > 0 Then
PLL.TopIndex = PLL.Items.Count - 1
End If
PLL.Refresh()
End Sub
Private Sub AddOrUpdateListView(proxy As String, statusOrPing As String)
If PLLChecked.InvokeRequired Then
PLLChecked.Invoke(New Action(Sub() AddOrUpdateListView(proxy, statusOrPing)))
Return
End If
For Each item As ListViewItem In PLLChecked.Items
If item.Text = proxy Then
item.SubItems(1).Text = statusOrPing
Return
End If
Next
Dim newItem As New ListViewItem(proxy)
newItem.SubItems.Add(statusOrPing)
PLLChecked.Items.Add(newItem)
End Sub
Private Sub AddToFinalList(proxy As String)
If lstProxies.InvokeRequired Then
lstProxies.Invoke(New Action(Sub() AddToFinalList(proxy)))
Return
End If
If Not lstProxies.Items.Contains(proxy) Then
lstProxies.Items.Add(proxy)
' Falls es der allererste funktionierende Proxy ist, direkt in Windows aktivieren
If lstProxies.Items.Count = 1 Then
SwitchToCurrentProxy()
End If
End If
End Sub
Private Sub ClearAllUI()
If PLL.InvokeRequired Then
PLL.Invoke(New Action(AddressOf ClearAllUI))
Return
End If
PLL.Items.Clear()
PLLChecked.Items.Clear()
lstProxies.Items.Clear()
End Sub
Public Sub AUTOSCANStart()
IsRunning = True
btnStart.Enabled = False
btnStop.Enabled = True
Log("=== AUTO-SCAN GESTARTET ===", Color.Cyan)
RunScan()
Autotimer.Start()
End Sub
Public Sub AUTOSCANStop()
IsRunning = False
Autotimer.Stop()
btnStart.Enabled = True
btnStop.Enabled = False
SetStatus("Gestoppt")
Log("=== AUTO-SCAN GESTOPPT ===", Color.Orange)
End Sub
Private Sub Autotimer_Tick(sender As Object, e As EventArgs) Handles Autotimer.Tick
If IsRunning Then
Log("Timer: Nächster Durchlauf startet...", Color.Cyan)
RunScan()
End If
End Sub
Private Sub RunScan()
If ScannerThread IsNot Nothing AndAlso ScannerThread.IsAlive Then
Log("Scan läuft bereits...", Color.Yellow)
Return
End If
ScannerThread = New Thread(AddressOf ScanWorker) With {.IsBackground = True}
ScannerThread.Start()
End Sub
Private Sub ScanWorker()
SetStatus("Scraping...")
Log("Starte Quellen-Abruf...")
SyncLock LockObj
FoundProxies.Clear()
ValidProxies.Clear()
End SyncLock
ClearAllUI()
For Each url In Sources
If Not IsRunning Then Exit For
Try
Log($"Lade Quelle: {url}")
Dim content = DownloadString(url)
Dim extracted = ExtractProxies(content)
Dim newlyFound As New List(Of String)()
SyncLock LockObj
For Each p In extracted
If Not FoundProxies.Contains(p) Then
FoundProxies.Add(p)
newlyFound.Add(p)
End If
Next
End SyncLock
If newlyFound.Count > 0 Then
AddProxiesToPLL(newlyFound)
Log($"{newlyFound.Count} neue Proxys in PLL eingetragen.")
Else
Log("Keine neuen/eindeutigen Proxys in dieser Quelle.")
End If
Catch ex As Exception
Log($"FEHLER bei {url}: {ex.Message}", Color.Red)
End Try
Thread.Sleep(300)
Next
Dim proxyCount As Integer
SyncLock LockObj
proxyCount = FoundProxies.Count
End SyncLock
Log($"{proxyCount} eindeutige Proxies in 'PLL' geladen.", Color.White)
If IsRunning AndAlso proxyCount > 0 Then
ValidateProxies()
End If
SetStatus($"Bereit | {ValidProxies.Count} OK / {proxyCount} Gesamt")
Log("Durchlauf komplett. Nächster Scan in 10 Min.", Color.Cyan)
End Sub
' Extrahiert IP:Port-Muster und validiert sie anschließend (echte Range-Prüfung statt nur Ziffernanzahl)
Private Function ExtractProxies(text As String) As List(Of String)
Dim result As New List(Of String)
If String.IsNullOrWhiteSpace(text) Then Return result
Dim pattern As String = "\b(?:\d{1,3}\.){3}\d{1,3}:\d{1,5}\b"
For Each m As Match In Regex.Matches(text, pattern)
Dim candidate As String = m.Value
If IsValidProxyEntry(candidate) Then
result.Add(candidate)
End If
Next
Return result
End Function
' Prüft, ob IP-Teil eine gültige IPv4-Adresse und der Port im gültigen Bereich (1–65535) ist
Private Function IsValidProxyEntry(entry As String) As Boolean
Dim parts = entry.Split(":"c)
If parts.Length <> 2 Then Return False
Dim ipPart As IPAddress = Nothing
If Not IPAddress.TryParse(parts(0), ipPart) Then Return False
If ipPart.AddressFamily <> Sockets.AddressFamily.InterNetwork Then Return False
Dim port As Integer
If Not Integer.TryParse(parts(1), port) Then Return False
If port < 1 OrElse port > 65535 Then Return False
Return True
End Function
Private Sub ValidateProxies()
Dim proxiesToCheck As List(Of String)
SyncLock LockObj
proxiesToCheck = New List(Of String)(FoundProxies)
End SyncLock
Dim checkUrl As String = "http://httpbin.org/ip"
Dim okCount As Integer = 0
Parallel.ForEach(proxiesToCheck,
New ParallelOptions With {.MaxDegreeOfParallelism = 40},
Sub(proxy, loopState)
If Not IsRunning Then
loopState.Stop()
Return
End If
If Not IsValidProxyEntry(proxy) Then Return
Dim parts = proxy.Split(":"c)
Dim ip = parts(0)
Dim port As Integer = Integer.Parse(parts(1))
AddOrUpdateListView(proxy, "Prüfe...")
Dim sw As New Stopwatch()
sw.Start()
Try
Dim handler As New HttpClientHandler() With {
.Proxy = New WebProxy(ip, port),
.UseProxy = True
}
Using httpClient As New HttpClient(handler) With {
.Timeout = TimeSpan.FromMilliseconds(PROXY_CHECK_TIMEOUT_MS)
}
httpClient.DefaultRequestHeaders.UserAgent.ParseAd d("Mozilla/5.0")
' GET statt HEAD, da viele Server/Proxys HEAD nicht zuverlässig unterstützen
Dim response = httpClient.GetAsync(checkUrl).GetAwaiter().GetResu lt()
sw.Stop()
If response.IsSuccessStatusCode Then
Dim latencyMs As Long = sw.ElapsedMilliseconds
SyncLock LockObj
ValidProxies.Add(proxy)
End SyncLock
Interlocked.Increment(okCount)
AddOrUpdateListView(proxy, $"{latencyMs} ms")
AddToFinalList(proxy)
Else
AddOrUpdateListView(proxy, "Fehler")
End If
End Using
Catch
sw.Stop()
AddOrUpdateListView(proxy, "Dead")
End Try
End Sub)
Log($"Prüfung beendet: {okCount} von {proxiesToCheck.Count} funktionieren und wurden nach 'lstProxies' übernommen.", Color.Yellow)
Try
Dim snapshot As List(Of String)
SyncLock LockObj
snapshot = New List(Of String)(ValidProxies)
End SyncLock
Dim outputPath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory , "working_proxies.txt")
File.WriteAllLines(outputPath, snapshot)
Log($"Gültige Proxies wurden in '{outputPath}' gespeichert.", Color.White)
Catch ex As UnauthorizedAccessException
Log("Speicherfehler: Keine Schreibrechte im Programmverzeichnis. Bitte Anwendung an einen beschreibbaren Ort verschieben oder als Administrator ausführen.", Color.Red)
Catch ex As Exception
Log($"Speicherfehler: {ex.Message}", Color.Red)
End Try
End Sub
' Download über HttpClient mit festem Timeout (statt WebClient ohne Timeout)
Private Function DownloadString(url As String) As String
Try
Dim response = SourceHttpClient.GetAsync(url).GetAwaiter().GetRes ult()
response.EnsureSuccessStatusCode()
Return response.Content.ReadAsStringAsync().GetAwaiter(). GetResult()
Catch ex As TaskCanceledException
Throw New Exception($"Zeitüberschreitung nach {DOWNLOAD_TIMEOUT_MS} ms")
End Try
End Function
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
IsRunning = False
Autotimer.Stop()
tmrProxySwitch.Stop()
End Sub
Frage zum Cs Hat Chameleon Hat 10/07/2011 - Flyff Private Server - 1 Replies hi leute,
ich wollte mal fragen ob jemand den code oder die nummer von dem
Item Chameleon Hat hat'.
ich hab schon /ci "Chameleon Hat'' und sowas ausprobiert auch andere Schreibmöglichkeiten^^
Schreibt bitte, wenn ihr ihn wisst ;)
Mfg Amazing :rolleyes:
Chameleon-Online[Offi V15][Root 24/7] 09/15/2010 - Flyff PServer Advertising - 27 Replies http://img535.imageshack.us/img535/3307/chameleono nlinelogo2.png
Über Uns
================================================= = ========================
Lieber Besucher,
unser kleines pServer Projekt trägt nun endlich Früchte, die reif sind geerntet zu werden!
Hiermit startet das Chameleon-Online Team nun offiziell seinen pServer und beginnt die open-BETA.
Die Klassen / Account Übersicht sowie die Top 15 findet ihr auf unserer Homepage unter “Server-Stats”.
Windows 7 Chameleon Gadgets 11/03/2009 - General Art - 0 Replies Hey Leute,
biete euch hier ein paar nette Gadgets für die Sidebar an:
! Laufen bei mir ohne Probleme (Win7 Ultimate 64bit), sollten auch unter Vista laufen !
Preview:
http://img197.imageshack.us/img197/7043/gadgetsq. th.png