黑客软件编写基础知识锦囊(1)

作者在 2007-03-02 08:02:00 发布以下内容
确定Windows和windows系统目录

有两个SDK函数可以完成该功能。GetWindowsDirectory和GetSystemDirectory,下例说明了如何使用这两个函数:

TCHAR szDir [MAX_PATH];

//Get the full path of the windows directory.

:: GetWindowsDirectory (szDir, MAX_PATH);

TRACE ("Windows directory %s\n", szDir);

//Get the full path of the windows system directory.

:: GetSystemDirectory (szDir, MAX_PATH);

TRACE ("Windows system directory %s\n", szDir);
**********************************************************************************

让程序从CTRL+ATL+DEL消失

使用Win32 API函数RegisterServiceProcess这里我们使用了汇编。

#i nclude <windows.h>

HINSTANCE hLibrary;
void *regproc;

void CADInit(void);
void HideApp(void);
void ShowApp(void);
void CADClean(void);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CADInit(); //加载 DLL 并创建一指向它指针
HideApp(); //隐藏程序
//ShowApp(); //显示程序

//其他处理或调用

CADClean(); //卸载 DLL
return 0; //retrun 0 因为没有进入消息循环
}

void CADInit(void)
{
//加载 kernel32.dll
hLibrary = LoadLibrary("kernel32.dll");
//获取函数RegisterServiceProcess的地址
regproc = GetProcAddress(hLibrary, "RegisterServiceProcess");
}

void HideApp(void)
{
//实现程序的隐藏
__asm
{
push 1
push 0
call regproc
}
return;
}

void ShowApp(void)
{
//恢复状态
__asm
{
push 0
push 0
call regproc
}
return;
}

void CADClean(void)
{
//卸载 DLL
FreeLibrary(hLibrary);
return;
}
本程序在W2K和Win9x测试通过。



*********************************************************************************************

程序自杀(进程自己结束自己)

HMODULE module = GetModuleHandle(0);
CHAR buf[MAX_PATH];
GetModuleFileName(module, buf, sizeof buf);
CloseHandle(HANDLE(4));

 __asm
{
lea eax, buf
push 0
push 0
push eax
push ExitProcess
push module
push DeleteFile
push UnmapViewOfFile
ret
}
return;
******************************************************************************************

操作系统信息

//结构OSVERSIONINFO包含操作系统的版本信息
OSVERSIONINFO osvi;
CString winver,os;

osvi.dwOSVersionInfoSize=sizof(OSVERSIONINFO);
GetVersionEx(&osvi);

switch(osvi.dwPlatformId)
{
case 0:
os="Win 3.X";
break;
case 1:
os="Win 9X";
break;
case 2:
os="Win NT/2000/XP";
break;
default:
os="Other OS";
break;
}

**************************************************************************************

隐藏你的鼠标


(注意:注销或重新启动就可以恢复)

一、建立一个单文档的应用程序框架
二、为隐藏主窗口,将OnCreate 删除。
并在App类里修改m_pMainWnd指向ShowWindow(SW_HIDE)
三、现在在mainframe的实现文件里添加如下内容:

POINT mp,cursorNew;
/////////////////////////////////////
// CMainFrame construction/destruction
UINT FMouse(LPVOID param)
{
int flag=0;

WINDOWPLACEMENT wp;///窗口位置
wp.length=sizeof(WINDOWPLACEMENT);
HWND hWnd;
char tmp[20];
RECT rt;
hWnd=GetDesktopWindow();////GetForegroundWindow();
GetWindowPlacement(hWnd,&wp);
GetWindowRect(hWnd,&rt);
GetWindowText(hWnd,tmp,20);

HDC dc=GetDC((HWND)param);

int iResult;
iResult=AfxMessageBox("确实要隐藏吗?",MB_OKCANCEL);
if(iResult==IDOK)
{
while(1)
{
hWnd=GetForegroundWindow();//GetDesktopWindow();
GetWindowRect(hWnd,&rt);
GetWindowText(hWnd,tmp,20);
GetWindowPlacement(hWnd,&wp);
GetCursorPos(&cursorNew);
while(1){
::mouse_event(MOUSEEVENTF_MOVE,cursorNew.x,cursorNew.y,0,0);
}
}
}
return 0;
}
━╅点滴╆━ | 阅读 1474 次
文章评论,共0条
游客请输入验证码