#include "stdafx.h"
#include <string.h>
#define PASSWORD "1234567"
int verify_password(char* password)
{
int authenticated;
char buffer[8];
authenticated =strcmp(password,PASSWORD);
strcpy_s(buffer,password);
return authenticated;
}
int main()
{
int valid_flag = 0;
char password[1024];
while (1)
{
printf("please input password: ");
scanf_s("%s",password);
valid_flag = verify_password(password);
if (valid_flag)
{
printf("incorrect password");
}
else
{
printf("successful!");
break;
}
}
return 0;
}
逆向知识的一些补充:
vs2015中寻找main函数步骤:
mainCRTStartup()->(入口点)
__scrt_common_main()->
__scrt_common_main_seh->
invoke_main()->
main(参数个数,参数数组,环境数组);

本文介绍了一个简单的密码验证程序,该程序使用C/C++语言编写,实现了基本的密码输入与验证功能,并通过比较输入的密码与预设密码来判断是否正确。文章还提供了在VS2015中查找main函数的方法。
906

被折叠的 条评论
为什么被折叠?



