密码是怎么被察看的
密码是怎么被察看的
首先声明,我写此篇文章时参考了前辈们编的源程序,在此我表示感谢。
打开搜索引擎,你能搜到诸如此类的软件,他们能察看你输入的密码。能将"*"所掩盖的真实的密码还原。
下面的一段程序就能做到这一点:
procedure Tform1.Timer1(Sender: TObject);
var
ClassName: PChar;
ptCursor: TPoint;
hWndOver: HWND;
Text: PChar;
begin
GetCursorPos(ptCursor);
hWndOver := WindowFromPoint(ptCursor);
GetMem(ClassName, 100);
GetMem(Text, 255);
try
GetClassName(hWndOver, ClassName, 100);
SendMessage(hWndOver, WM_GETTEXT, 255, LongInt(Text));
Canvas.FillRect(Rect(5, 20 , PreClassLength + 20, 40));
Canvas.FillRect(Rect(5, 40 , PreTextLength + 20, 60));
PreClassLength := Canvas.TextWidth(ClassName);
PreTextLength := Canvas.TextWidth(Text);
if PreClassLength > PreTextLength then
Width := Canvas.TextWidth(ClassName) + 20
else
Width := Canvas.TextWidth(Text) + 20;
Canvas.TextOut(5, 20, string(ClassName));
Canvas.TextOut(5, 35, string(Text));
finally
FreeMem(ClassName);
FreeMem(Text);
end;
end;
我给出这段程序,或许不用我说你就能明白,察看密码的原理:
在此,我还是班门弄斧一次,如有错误请指出.
1,函数的意义:
GetCursorPos(ptCursor):
英文解释:The GetCursorPos function retrieves the cursor's position, in screen coordinates.
中文解释:GetCursorPos函数能返回屏幕上光标的位置.
WindowFromPoint:
英文解释:The WindowFromPoint function retrieves the handle of the window that contains the specified point.
中文解释:WindowFromPoin函数能返回特定点的句柄.
GetClassName:好像不用我解释你就能明白她的含义.
sendmessage:
英文解释:The SendMessage function sends the specified message to a window or windows. The function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
中文解释:sendmessage函数能发送一个特定消息给窗口,这个函数能为特定的窗口调用那个过程,直到那个窗口处理了这个消息才返回.
这些中文的解释是我翻译的,本人的英文学的不怎么样,如有错误之出请指正。
2.主要的函数意义我解释了,到此,我就是不说,大家也应该知道程序工作的原理.
程序首先通过GetClassName函数获得classname,然后通过sendmessage函数获得它的text,一般输入密码的控件
都为edit因此程序运行之后,你能在form上获得控件的名称,还有它的text,而她的text正是你想要获得内容,密码,尽管它被"*"所掩盖.