Option Explicit
Private Sub Form_Load()
With Winsock1
.Close
.Connect "192.168.1.1", 80
End With
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "GET /index.html HTTP/1.1" & vbCrLf & _
"user-agent: My MegaBrowser" & vbCrLf & _
"cache-control: no-store no-cache" & vbCrLf & _
"host: localhost" & vbCrLf & vbCrLf
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim dt As String, frf As Integer
Winsock1.GetData dt
Text1.Text = Text1.Text + dt
End Sub
Private Sub Form_Load()
With Winsock1
.Close
.Connect "192.168.0.1", 80
End With
End Sub
Private Sub Winsock1_Connect()
Winsock1.SendData "GET /config.bin?rc=@system&ZT=1165317156861 HTTP/1.1" & vbCrLf & _
"Authorization: admin:admin" & vbCrLf & _ '!!!!!!!!!!!!!!!!!!
"user-agent: Internet Explorer" & vbCrLf & _
"cache-control: no-store no-cache" & vbCrLf & _
"host: localhost" & vbCrLf & vbCrLf
End Sub
Private Function Base64_Encode(strSource) As String
'
Const BASE64_TABLE As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
'
Dim strTempLine As String
Dim j As Integer
'
For j = 1 To (Len(strSource) - Len(strSource) Mod 3) Step 3
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j, 1)) \ 4) + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
((Asc(Mid(strSource, j, 1)) Mod 4) * 16 _
+ Asc(Mid(strSource, j + 1, 1)) \ 16) + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
((Asc(Mid(strSource, j + 1, 1)) Mod 16) * 4 _
+ Asc(Mid(strSource, j + 2, 1)) \ 64) + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j + 2, 1)) Mod 64) + 1, 1)
'
Next j
'
If Not (Len(strSource) Mod 3) = 0 Then
'
If (Len(strSource) Mod 3) = 2 Then
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j, 1)) \ 4) + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j, 1)) Mod 4) * 16 _
+ Asc(Mid(strSource, j + 1, 1)) \ 16 + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j + 1, 1)) Mod 16) * 4 + 1, 1)
'
strTempLine = strTempLine & "="
'
ElseIf (Len(strSource) Mod 3) = 1 Then
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
Asc(Mid(strSource, j, 1)) \ 4 + 1, 1)
'
strTempLine = strTempLine + Mid(BASE64_TABLE, _
(Asc(Mid(strSource, j, 1)) Mod 4) * 16 + 1, 1)
'
strTempLine = strTempLine & "=="
'
End If
'
End If
'
Base64_Encode = strTempLine
'
End Function
Сейчас этот форум просматривают: Google-бот и гости: 53