Click here to Skip to main content
11,487,979 members (77,494 online)
Click here to Skip to main content
Add your own
alternative version

Password SPY++

, 26 Sep 2005 130.9K 8.8K 166
Peeking ***** off both the password edit boxes and the input field on a homepage residing inside an Internet Explorer window.
spwdspydemo_exe.zip
SuperPwdHook.dll
SuperPwdSpy.exe
spwdspydemo_src.zip
Doc
SPwdSpyArchitecture.gif
SPwdSpyIE-class.gif
SPwdSpyInterface1.jpg
SPwdSpyInterface2.jpg
SPwdSpyInterface3.jpg
SPwdSpyInterface4.jpg
SPwdSpyPortrait.jpg
Release
SuperPwdHook.dll
SuperPwdSpy.exe
res
blank.ico
blank_ic.ico
BMPBACK.BMP
ico00001.ico
look.cur
look.ico
look_cur.cur
look_ico.ico
main.ico
notstaytop.ico
portrait.jpg
staytop.ico
SuperPwdSpy.ico
SuperPwdHook.dsp
SuperPwdHook.dsw
SuperPwdSpy.clw
SuperPwdSpy.dsp
SuperPwdSpy.dsw
/************************************
  REVISION LOG ENTRY
  Revision By: Zhang, Zhefu
  Contact: codetiger@hotmail.com
  Revised on 12/7/2002 10:44:33 AM
  Comment: Following Source is Written To Contribute to WWW.CodeGuru.Com
  Also check http://codeguru.earthweb.com/ieprogram/SPwdSpy.html
       for latest patch
 ************************************/

// stdafx.cpp : source file that includes just the standard includes
//	SuperPwdSpy.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

BOOL IsBrowser(HWND hWnd)
{
	TCHAR szClassName[64];
	int nRet = GetClassName(hWnd, szClassName, 64);
    if(nRet == 0) return FALSE;
	szClassName[nRet] = 0;
	if(::lstrcmp(szClassName, 
		_T("Internet Explorer_Server")
		) != 0) return FALSE;

	return TRUE;
}

BOOL IsPasswordEdit(HWND hWnd)
{
	TCHAR szClassName[64];
	int nRet = GetClassName(hWnd, szClassName, 64);
    if(nRet == 0) return FALSE;
	szClassName[nRet] = 0;
	if(::lstrcmp(szClassName, _T("Edit")) != 0
		&& ::lstrcmp(szClassName, _T("TEdit")) != 0
        && ::lstrcmp(szClassName, _T("ThunderTextBox")) != 0) return FALSE;

	DWORD dw = ::GetWindowLong(hWnd,GWL_STYLE);
	dw &= ES_PASSWORD;
    if(dw == ES_PASSWORD)
		return TRUE;
	return FALSE;
}

//From MSDN Spy Sample
void HighlightWindow(HWND hwnd, BOOL fDraw)
{
#define DINV                3
	HDC hdc;
    RECT rc;
    BOOL bBorderOn;
    bBorderOn = fDraw;

    if (hwnd == NULL || !IsWindow(hwnd))
        return;

    hdc = ::GetWindowDC(hwnd);
    ::GetWindowRect(hwnd, &rc);
    ::OffsetRect(&rc, -rc.left, -rc.top);

    if (!IsRectEmpty(&rc))
    {
        PatBlt(hdc, rc.left, rc.top, rc.right - rc.left, DINV,  DSTINVERT);
        PatBlt(hdc, rc.left, rc.bottom - DINV, DINV,
            -(rc.bottom - rc.top - 2 * DINV), DSTINVERT);
        PatBlt(hdc, rc.right - DINV, rc.top + DINV, DINV,
            rc.bottom - rc.top - 2 * DINV, DSTINVERT);
        PatBlt(hdc, rc.right, rc.bottom - DINV, -(rc.right - rc.left),
            DINV, DSTINVERT);
    }

    ::ReleaseDC(hwnd, hdc);
}

HWND XYZWindowFromPoint(HWND hwndParent,   // handle to parent window
                     POINT point,          // structure with point coordinates
                     UINT uFlags        // skip options
)
{
	if(hwndParent != NULL)
		return ::ChildWindowFromPointEx(hwndParent, point, uFlags);

	// Find the smallest "window" still containing the point
	// Doing this prevents us from stopping at the first window containing the point
	RECT rect, rectSearch;
	HWND pWnd, hWnd, hSearchWnd;

	hWnd = ::WindowFromPoint(point);
	if(hWnd != NULL)
	{
		// Get the size and parent for compare later
		::GetWindowRect(hWnd, &rect);
		pWnd = ::GetParent(hWnd);

		// We only search further if the window has a parent
		if(pWnd != NULL)
		{
			// Search from the window down in the Z-Order
			hSearchWnd = hWnd;
			do{
				hSearchWnd = ::GetWindow(hSearchWnd, GW_HWNDNEXT);

				// Does the search window also contain the point, have the same parent, and is visible?
				::GetWindowRect(hSearchWnd, &rectSearch);
				if(::PtInRect(&rectSearch, point) && ::GetParent(hSearchWnd) == pWnd && ::IsWindowVisible(hSearchWnd))
				{
					// It does, but is it smaller?
					if(((rectSearch.right - rectSearch.left) * (rectSearch.bottom - rectSearch.top)) < ((rect.right - rect.left) * (rect.bottom - rect.top)))
					{
						// Found new smaller window, update compare window
						hWnd = hSearchWnd;
						::GetWindowRect(hWnd, &rect);
					}
				}
			}while(hSearchWnd != NULL);
		}
	}
	return hWnd;
}

void PopMsg(LPCTSTR pszFormat, ...) 
{
   va_list argList;
   va_start(argList, pszFormat);

   TCHAR sz[1024];
//#ifdef _UNICODE
//   vswprintf(sz, pszFormat, argList);
//#else
//   vsprintf(sz, pszFormat, argList);
//#endif
   wvsprintf(sz, pszFormat, argList);
   va_end(argList);
   ::MessageBox(NULL, sz, _T("Pop Msg"), MB_OK);
}

void ReportErr(LPCTSTR str)
{
	    LPVOID lpMsgBuf;
        FormatMessage( 
           FORMAT_MESSAGE_ALLOCATE_BUFFER | 
           FORMAT_MESSAGE_FROM_SYSTEM | 
           FORMAT_MESSAGE_IGNORE_INSERTS,
           NULL,
           ::GetLastError(),
           MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), // Default language
           (LPTSTR) &lpMsgBuf,
           0,
           NULL 
       );
		::MessageBox( NULL, (LPCTSTR)lpMsgBuf, 
		   str, MB_OK | MB_ICONINFORMATION );
       // Free the buffer.
       LocalFree( lpMsgBuf );
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Zhefu Zhang
Other
United States United States
fdefewtr534554yutki8op09;[pio';l.n,kbnmcvbxcvzxaqW876876UIYIUJUGHJGFHYFGHRDTR4564QWEDASASFDXCBVCBNGHNMJHMJN,NJKL;O[P-0=-]'[P';L/L,M.NM,BNMCGNGFXDGDFGTYU76TRYW34TR5AWERFASDVGfdsxbvfbvnvnm,jkl.k

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 26 Sep 2005
Article Copyright 2005 by Zhefu Zhang
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid