Let your text box "smart"

zhaozj2021-02-16  43

Recently, I learned to use the two API functions that use SetWindowlong and CallWindowProc in designing a hotkey setup program. We can handle any news received by your window or control. I saw a one after another time. Introducing the QQ password to monitor the articles of theft method, so that I think that I can use these two functions to protect the password protection. After some attempt finally succeeded, now I will share it with you.

Almost all monitoring programs are sent to get a wm_gettext message by sending a text box for you, any text box will receive this message that it will tell the message to send a message to the content of the yourself (it is not Knowing that it saves our important password), "*" can not protect our password, is it a "smart" text box, in fact, we only need to intercept this message and not let the text box accept When any monitoring program cannot get the password. That is to define the two API functions of SETWINDOWLONG and CALLWINDOWPROC, then determine the message type, if it is the WM_GetText message, it is excluded, and does not process it (of course, you can also replace the subject to accept the message to deceive it) If this text box does not receive this message, it is of course not leaked. The following is a simple introduction to only a simple introduction:

The setWindowlong function declaration is as follows:

Declare function setwindowlong lib "user32" alias "setwindowlonga" (Byval Nindex as long, Byval Dwnewlong As long) AS Long

Role: Setting information for the specified window in the window structure

Parameters: HWND To set the window handle of the message function (can be a control)

NINDEX we use: GWL_WndProc Set the address of the message processing function for the window or control

The address of the DWNewlong message function (that is, addressof, such as Addressof WinProc)

Return Value: If successfully returns the address of the original message processing function, return 0

The CallWindowProc function declaration is as follows:

Public Declare Function CallWindowProc LIB "User32" Alias ​​"CallWindowProca" (Byval Hwndfunc As Long, Byval Hwnd As Long, Byval Msg As Long, Byval WParam As Long) As long

Parameters: LPPREVWNDFUNC: Pointer to the front window or control process.

HWnd: Points the handle of the window or control process of the received message.

MSG: Specifies the message type.

WPARAM: Specify the rest, message-specific information. The content of this parameter is related to the MSG parameter value.

IParam: Specifies the rest, message-specific information. The content of this parameter is related to the MSG parameter value.

Return Value: Specifies the message processing result, which is related to the message sent.

Understand these two functions, we can make a "smart" text box:

1. First open VB to establish a project, add a form, a module

2. Add the two functions of the above to the module, plus the declaration of the two variables is

Public const wm_gettext = & hd 'Messages for text box content

Public const gwl_wndproc (-4) 'Establishing a message processing function required by PUBLIC

Public OldProc as long 'Saves the address of the old message processing function 3. Create a text box on the form, a command button, two checkbox modify its properties as follows:

Control Name: Property: Property Value:

Text box PasswordChar *

Name text1

Command button Name Command1

CAPTION true password

Check box 1 name check1

CAPTION uses password protection

Check box 1 name check2

CAPTION uses password deception

4. Write code (simple program is simple)

Add the following code to FORM1:

Private sub check1_click ()

If Check1.Value = 1 THEN

OldProc = setWindowlong (TEXT1.HWND, GWL_WNDPROC, AddressOf Wnd) Sets the message processing function of Text1, OldProc is the address of the original function.

Else

SetWindowlong Text1.hWnd, GWL_WndProc, OldProc 'Restores the original message function address

Check2.Value = 0 'If you do not use password protection, you cannot use password spoof.

END IF

End Sub

Private sub check2_click ()

If Check2.Value = 1 THEN

If Check1.Value = 0 TEN 'If you use password spoof, you must use password protection.

OldProc = setWindowlong (Text1.hWnd, GWL_WNDPROC, Addressof WND)

Check1.value = 1

END IF

END IF

End Sub

Private submmand1_click ()

Msgbox text1.text 'The content in the real text box

End Sub

Private Sub Form_Unload (Cancel AS Integer)

Setwindowlong text1.hwnd, gwl_wndproc, oldproc 'Restores the original message processing function address

End Sub

Add message processing functions in the module:

Public Function WND (Byval Hwnd As Long, Byval MSG As Long, Byval WP as long, Byval LP As long) As long

'hwnd receives the control of the message, here is the TEXT1, MSG message type, WP and LP are additional parameter parameters

IF msg = wm_gettext the 'judgment is the message we want

If FORM1.CHECK2.VALUE = 1 THEN 'Whether deception

HWnd = form1.check2.hwnd

'Change the object of the received message Here we change to Check2, then get the CAPTION value of Check2, given a little lesson of the pirate password, let them go back to the test code :)

Else

EXIT FUNCTION 'does not do anything, return directly

END IF

END IF

WND = CallWindowProc (OldProc, HWND, MSG, WP, LP) 'If not the news we want, passes

END FUNCTION

When the program is over, the operation results are shown in Figure 1, which is called a program to check "*". When you don't choose "Use Password Protection", the content of the text box will be obtained. After selecting, try again, how is it, is it not there, and then you will try to get the "password deception". The password will eventually be cracked. Remember is "final" (if your password is long enough, who knows how many years)

This program is debugged under: VB6.0 Windows Me

If you don't know where or discuss the problem, you can send me an email: ppgg2002@sina.com

QQ: 55051552

转载请注明原文地址:https://www.9cbs.com/read-23230.html

New Post(0)