能够查看***密码框内容的程序(200分)

我用winsign32,<br>好象在有的地方好使,<br>有的地方不好使,例如nt的用户管理器.<br>不知是什么原因!<br>
 
不知何时做的。源码加详解。<br><br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Label1: TLabel;<br>&nbsp; &nbsp; Edit1: TEdit;<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; Name:pChar;//名字<br>&nbsp; L:integer; //名字的长度<br>begin<br>&nbsp; L:=GetWindowTextLength(Edit1.handle)+1;<br>&nbsp; //得到名字长度,并将长度加1<br>&nbsp; GetMem(Name,L);//为将要得到的名字分配内存<br>&nbsp; GetWindowText(Edit1.handle,Name,L);//得到名字<br>&nbsp; Label1.Caption :=String(Name);//将得到的名字显示于Label1<br>&nbsp; FreeMem(Name,0);//释放分配的内存<br>end;<br><br>end.
 
以上办法行不通!尤其是Internet属性中连接中的密码框无法查看!
 
对于 edit 不能用 GetWindowText, 只能用 WM_GETTEXT, <br>msdn 上说的。
 
<br>对于 Delphi 下的,下面几句即可:<br><br>Edit2.Text := Edit1.Text; &nbsp; &nbsp; &nbsp; &nbsp; // Edit2 可见<br>Label1.Text := Edit1.Text; &nbsp; &nbsp; &nbsp; &nbsp;// Label1 可见<br>Edit1.PasswordChar := #0; &nbsp; &nbsp; &nbsp; &nbsp; // Edit1 可见<br><br>对于其他窗口的Edit,要略微复杂一些,大概步骤如下:<br><br>1.找到响应窗口的 Handle, 可用 FindWindow 或 枚举 EnumWindows;<br>2.找到该窗口下所有子窗口的 Handle, 可用 枚举 EnumChildWindows;<br>3.对于每一个子Handle, 判断是否为Edit编辑框, 可用 GetWindowClass;<br>4.如果是Edit编辑框,发送如下消息:<br><br>&nbsp; SendMessage(EditHandle, EM_SETPASSWORDCHAR, 0, 0);<br><br>OK; <br><br>
 
简易型,反正能看****<br>当然不能用getwindowtext(),而只能用WM_GETTEXT。<br>建一个定时器和一个memo框,在定时器内输入如下内容,即实现属标指到哪儿,<br>memo中就显示该窗口的标题信息(不管是不是密码框内的信息,全显示)。<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br>&nbsp; cursorpoint:TagPOINT;<br>&nbsp; windowhandle:hwnd;<br>&nbsp; textmaxlength:integer;<br>&nbsp; textcontent:array[0..100] of char;<br>&nbsp; returnlength:word;<br>begin<br>&nbsp; textmaxlength:=100;<br>&nbsp; Memo1.lines.clear;<br>&nbsp; if GetCursorPos(cursorpoint) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Memo1.Lines.Add(format('光标位置x=%d,y=%d',[cursorpoint.x,cursorpoint.y]));<br>&nbsp; &nbsp; &nbsp; windowhandle:=windowfrompoint(cursorpoint);<br>&nbsp; &nbsp; &nbsp; if windowhandle&lt;&gt;null then<br>&nbsp; &nbsp; &nbsp; &nbsp; Memo1.Lines.Add(format('光标处窗口名柄号为%d',[windowhandle]));<br>&nbsp; &nbsp; &nbsp; if iswindow(windowhandle) then<br>&nbsp; &nbsp; &nbsp; &nbsp; returnlength:=SendMessage(windowhandle,WM_GETTEXT,textmaxlength,lparam(@textcontent));<br>&nbsp; &nbsp; &nbsp; if returnlength&gt;0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Memo1.Lines.Add('读到窗口标题为:');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Memo1.Lines.Add(textcontent);<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; end;<br>end;<br><br>哈哈,过了这么久,我来写个源代码!<br>初来此地,刚在网易发过此文,就被告知有这么个好地方
 
Hi cbb<br>&nbsp;你的程序有问题的说<br>&nbsp;例如共享密码就没法看 <br>&nbsp;我想原因是由于它是某窗口的子窗口HANDLE不能直接得到 <br>&nbsp;于是我用了CHILDWINDOWFROMPOINT却发现仍有点问题<br>&nbsp;当同级的EDIT在BUTTON的上方时只能找出BUTTON的HANDLE<br>&nbsp;我也想不出办法 <br>&nbsp;希望 高手指教<br>&nbsp;<br>&nbsp;
 
我的网上有原程序<br>http://Lovejingtao.126.com
 
rogram password;<br>{$APPTYPE console}<br><br>uses<br>&nbsp; windows,<br>&nbsp; messages;<br><br>{$R *.RES}<br>const s: boolean = true; //置循环标志<br><br>var<br><br>&nbsp; pass_edit_hwnd: hwnd; //密码窗口句柄<br>&nbsp; p: tpoint;<br>&nbsp;//鼠标坐标<br><br>begin<br><br>&nbsp; writeln;<br>&nbsp; writeln('**************************************************************************');<br>&nbsp; writeln;<br>&nbsp; writeln(' &nbsp; &nbsp; 星号*密码破解器');<br>&nbsp; writeln(' &nbsp; &nbsp; 使用方法:将鼠标移动到密码框,密码就会自动现型!');<br>&nbsp; writeln(' &nbsp; &nbsp; 按 Ctrl+C 退出程序。');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;///|/// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // &nbsp;- - &nbsp;// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;( &nbsp;@ @ &nbsp;) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; +----------------------oOOo-(_)-oOOo---------------------+ &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp;若在使用过程中发现任何问题或有新的想法请及时与我联系: | &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp;430074湖北省武汉市武昌民院路湖北经济管理大学计算机系 &nbsp;| &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp;(本)9803班 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp;主页:http://lovejingtao.126.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp;E-MAIL: lovejingtao@21cn.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Oooo &nbsp; 陈经韬 &nbsp;2000.07 &nbsp; | &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; +---------------------- oooO---( &nbsp; )---------------------+ &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( &nbsp; ) &nbsp; ) / &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ ( &nbsp; (_/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ');<br>&nbsp; writeln(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /_) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;');<br>&nbsp; writeln;<br>&nbsp; writeln('**************************************************************************');<br>&nbsp; writeln;<br>&nbsp; while s &lt;&gt; false do begin<br>&nbsp; &nbsp; getcursorpos(p);<br>&nbsp; &nbsp; pass_edit_hwnd := WindowFromPoint(p);<br>&nbsp; &nbsp; SendMessage(pass_edit_hwnd, EM_SETPASSWORDCHAR, 0, 0);<br>&nbsp; &nbsp; SendMessage(pass_edit_hwnd, WM_PAINT, 0, 0);<br>&nbsp; &nbsp; SendMessage(pass_edit_hwnd, WM_KILLFOCUS, 0, 0);<br>&nbsp; &nbsp; SendMessage(pass_edit_hwnd, WM_SETFOCUS, 0, 0);<br>&nbsp; &nbsp; sleep(1000);<br>&nbsp; end;<br>end.<br><br>
 
怎么没人尝试监控键盘操作呢???
 
OH,my god!<br>They are all carzy !
 
char szBuffer[256];<br>HWND EditHandle;<br>用WindowFromPoint得到密码窗体的句柄后,用:<br>SendMessage(EditHandle,EM_GETPASSWORDCHAR,szBuffer,255);<br>搞定!!!<br>
 
接受答案了.
 
顶部