0% found this document useful (0 votes)
39 views2 pages

Code Injector for Host Management

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)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views2 pages

Code Injector for Host Management

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)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

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

ShellExecute Lib "[Link]" 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 [Link] = "Host-1" Then dataInject = "DELETE [Link] ALAMAT [Link] [Link]/ HTTP/1.1" & vbCr & "Host : ISI ALAMAT [Link] [Link]" & vbCr & vbCr ElseIf [Link] = "Host-2" Then dataInject = "DELETE [Link] ALAMAT [Link] [Link]/ HTTP/1.1" & vbCr & "Host : ISI ALAMAT [Link] [Link]" & vbCr & vbCr End If End Sub Private Sub Form_Load() [Link] "Host-1" [Link] "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 = "[Link]" sockProxy(Index).RemotePort = (isi [Link] 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 [Link] = False Else waktu = waktu + 1 End If End Sub Private Sub tombol_Click() Dim totalLokal As Integer If [Link] = "Start" Then [Link] = "Stop" sockLokal(0).LocalPort = [Link] sockLokal(0).Listen pilihHost Else [Link] = "Start" For totalLokal = 0 To [Link] - 1 sockLokal(totalLokal).Close Next totalLokal End If End Sub

You might also like