HIEW下破解自己的if(psw==input_psw)//整型比较




原函数如下:



#include<iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int psw=10010;
int input_psw;
cout<<"please input the password\n";
cin>>input_psw;
if(psw==input_psw)
{
cout<<"gradutaions\n";
}
else
{
cout<<"sorry";
}
return 0;
}

现在只需要找到if(psw==input_psw)对应的指令即可

.text:00401027                 call    ds:__imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z ; std::basic_istream<char,std::char_traits<char>>::operator>>(int &)
.text:0040102D                 cmp     [esp+8+input_psw], 271Ah
.text:00401035                 jnz     short loc_401051
.text:00401037                 mov     edx, ds:__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A ; 
.text:0040103D                 push    offset aGradutaions ; "gradutaions\n"
.text:00401042                 push    edx             ; _Ostr
.text:00401043                 call    ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator<<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,char const *)
.text:00401048                 add     esp, 8
.text:0040104B                 xor     eax, eax
.text:0040104D                 mov     esp, ebp
.text:0040104F                 pop     ebp
.text:00401050                 retn

经过查找“.text:0040102D                 cmp     [esp+8+input_psw], 271Ah”即时比较指令,如果比较结果不匹配,则跳转到loc_401051,现在修改如下:

.text:00401035                 jnz     short loc_401037 即可

经测试跳转成功。。。。无论输入什么,都提示"graduations"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

世纪殇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值