发新话题
打印

拾取密码框中的密码

拾取密码框中的密码

拾取密码框中的密码


--------------------------------------------------------------------------------

概述:

    其实早有所闻 Windows 的马虎,Windows打星号的密码框中的密码实际上是很容易得到的,我以前看到过的资料说是检索屏幕上的窗口,找到有 ES_PASSWORD 风格的就向它发送取消 ES_PASSWORD 的消息,然后刷新它,密码就在原来的地方显示出来了,这儿还有另一个办法,就是找到密码框,直接取得中间的文本,这里是本文中的所有的源程序
    程序的结构如下: 初始化的时候设置一个定时器,定时时间为0.1秒,然后在定时器消息中利用 GetCursorPos 取得当前鼠标的位置,再利用 WindowFromPoint 取得该位置的窗口句柄,如果成功的话,利用 GetWindowLong 取得窗口的风格,如果窗口有 ES_PASSWORD 风格的话,那么这肯定是个密码框,然后我们向它发送 WM_GETTEXT 消息取得中间的文本就万事大吉了,简单吗?下面是源程序,结合上面的介绍是很好懂的。
    最后,如果你的163密码泄密了可不是我的错喔! :-)

源程序:

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        版本信息
;        密码查看器 - 可以查看 ES_PASSWORD 风格的编辑框中的密码
;           V1.0 ------        2000年6月18日
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                .386
                .model flat, stdcall
                option casemap :none   ; case sensitive

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        Include 数据
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

include                windows.inc
include                user32.inc
include                kernel32.inc
include                comctl32.inc
include                comdlg32.inc

includelib        user32.lib
includelib        kernel32.lib
includelib        comctl32.lib
includelib        comdlg32.lib

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        Equ 数据
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

DLG_MAIN        equ                1000
ID_PWD                equ                1001

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                .data?

hInstance        dd        ?
szBuffer        db        256 dup        (?)

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        子程序声明
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcDlgMain        PROTO        :DWORD,:DWORD,:DWORD,:DWORD

                .data

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;        代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                .code

include                Win.asm

;********************************************************************
_ProcDlgMain        proc        uses ebx edi esi, \
                hWnd:DWORD,wMsg:DWORD,wParam:DWORD,lParam:DWORD
                local        @stPoint:POINT
                local        @hWindow

                mov        eax,wMsg
                .if        eax == WM_CLOSE
                        invoke        EndDialog,hWnd,NULL
                        invoke        KillTimer,hWnd,1
                .elseif        eax == WM_INITDIALOG
                        invoke        _CenterWindow,hWnd
                        invoke        SendDlgItemMessage,hWnd,ID_PWD,EM_SETREADONLY,TRUE,NULL
                        invoke        SetWindowPos,hWnd,HWND_TOPMOST,0,0,0,0,\
                                SWP_NOMOVE or SWP_NOSIZE
                        invoke        SetTimer,hWnd,1,100,NULL
                .elseif        eax == WM_TIMER
                        invoke        GetCursorPos,addr @stPoint
                        invoke        WindowFromPoint,@stPoint.x,@stPoint.y
                        mov        @hWindow,eax
                        .if        eax !=        NULL
                                invoke GetWindowLong,@hWindow,GWL_STYLE
                                .if (eax & ES_PASSWORD)
                                        invoke        SendMessage,@hWindow,WM_GETTEXT,255,offset szBuffer
                                        invoke        SetDlgItemText,hWnd,ID_PWD,offset szBuffer
                                .endif
                        .endif
                .else
;********************************************************************
;        注意:对话框的消息处理后,要返回 TRUE,对没有处理的消息
;        要返回 FALSE
;********************************************************************
                        mov        eax,FALSE
                        ret
                .endif                  
                mov        eax,TRUE
                ret
               
_ProcDlgMain        endp
;********************************************************************
start:
                invoke        GetModuleHandle,NULL
                mov        hInstance,eax
                invoke        DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,0
                invoke        ExitProcess,NULL

                end        start

本文由GOD_Father 发布于Linuxsky 论坛,网址:http://bbs.linuxsky.org/thread-441-1-1.html

====================
夜,给了我黑色的眼睛;
我却用它来寻找光明,
寻找光明……

zyl508@163.com
====================

TOP

发新话题