0% found this document useful (0 votes)
108 views

Source Code Injector

This document describes code for a proxy server application that can inject custom data into HTTP requests. It defines socket objects and event handlers to listen for local connections, forward data to a remote proxy server, and return the response. A timer is also used to periodically restart another process every 15 seconds to keep it running.

Uploaded by

Outsidersz Eka
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

Source Code Injector

This document describes code for a proxy server application that can inject custom data into HTTP requests. It defines socket objects and event handlers to listen for local connections, forward data to a remote proxy server, and return the response. A timer is also used to periodically restart another process every 15 seconds to keep it running.

Uploaded by

Outsidersz Eka
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Option Explicit Dim dataLokal(255) As String Dim dataInject As String Dim i, cek, waktu As Integer Private Declare Function

ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (B yVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lp Parameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Lo ng Private Sub pilihHost() If host.Text = "Host-1" Then dataInject = "DELETE http://ISI ALAMAT HOST.MU COK.com/ HTTP/1.1" & vbCr & "Host : ISI ALAMAT HOST.MU COK.com" & vbCr & vbCr ElseIf host.Text = "Host-2" Then dataInject = "DELETE http://ISI ALAMAT HOST.MU COK.com/ HTTP/1.1" & vbCr & "Host : ISI ALAMAT HOST.MU COK.com" & vbCr & vbCr End If End Sub Private Sub Form_Load() host.AddItem "Host-1" host.AddItem "Host-2" End Sub Private Sub sockLokal_ConnectionRequest(Index As Integer, ByVal requestID As Lon g) i = i + 1 Load sockLokal(i) Load sockProxy(i) Load Timer1(i) sockLokal(i).Close sockLokal(i).Accept requestID End Sub Private Sub sockLokal_DataArrival(Index As Integer, ByVal bytesTotal As Long) sockLokal(Index).GetData dataLokal(Index) If sockProxy(Index).State = 0 Then sockProxy(Index).RemoteHost = "202.152.240.50" sockProxy(Index).RemotePort = (isi host.mu cok) sockProxy(Index).Connect End If If sockProxy(Index).State = 7 Then sockProxy(Index).SendData dataLokal(Index) End If End Sub Private Sub sockProxy_Connect(Index As Integer) sockProxy(Index).SendData dataInject cek = 0 Timer1(Index).Enabled = True End Sub Private Sub Timer1_Timer(Index As Integer) If cek = 0 Then If sockProxy(Index).State = 7 Then Dim ubah As String ubah = Replace(dataLokal(Index), vbCrLf, vbCr) sockProxy(Index).SendData ubah End If End If Timer1(Index).Enabled = False End Sub

Private Sub sockProxy_DataArrival(Index As Integer, ByVal bytesTotal As Long) Dim dataProxy As String sockProxy(Index).GetData dataProxy If cek = 1 Then If sockLokal(Index).State = 7 Then sockLokal(Index).SendData dataProxy End If Else cek = 1 End If End Sub Private Sub sockProxy_Close(Index As Integer) sockProxy(Index).Close sockLokal(Index).Close End Sub Private Sub Timer2_Timer() If waktu <> 15 Then ShellExecute 0, vbNullString, "c-generation", vbNullString, vbNullString, vbNorm alFocus Timer2.Enabled = False Else waktu = waktu + 1 End If End Sub Private Sub tombol_Click() Dim totalLokal As Integer If tombol.Caption = "Start" Then tombol.Caption = "Stop" sockLokal(0).LocalPort = listenPort.Text sockLokal(0).Listen pilihHost Else tombol.Caption = "Start" For totalLokal = 0 To sockLokal.Count - 1 sockLokal(totalLokal).Close Next totalLokal End If End Sub

You might also like