本帖最后由 starry、星空 于 2021-8-25 14:14 编辑
萌新的第一个CrackMe
https://www.52hb.com/thread-52041-1-1.html
(出处: 吾爱汇编论坛)
CrackMe下载地址:
下载地址:https://starrysp.lanzoui.com/i92mft585tg
下面是全部源码
[C] 纯文本查看 复制代码 #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<time.h>
#include "decl.h"
int size1 = 256;
struct my_data
{
char* buf;
char* buf1;
char* midstate;
char* flag;
int flagchange;
int CNum;
int flagTwo;
int my_compareNum;
int randNum;
}flag_All;
int my_mycompare() {
my_compare();
while (1)
{
if (flag_All.my_compareNum != -1) {
break;
}
my_compare();
}
}
int my_rand() {
srand((unsigned)time(NULL));
flag_All. randNum = rand() % 20;
return EXIT_SUCCESS;
}
int My_malloc() {
flag_All.buf = malloc(size1);
flag_All.buf1 = malloc(size1);
flag_All.midstate = malloc(size1);
return EXIT_SUCCESS;
}
int init_data() {
My_malloc();
strcpy(flag_All.buf, "verygood\n");
strcpy(flag_All.buf1, "nogodbad\n");
strcpy(flag_All.midstate, "youcannotfindme\n");
flag_All.flagchange = 0;
flag_All.CNum = 3;
return EXIT_SUCCESS;
}
int changeNum() {
if (flag_All.flagchange == 1) {
strcpy(flag_All.flag, flag_All.buf1);
}
else if(flag_All.flagchange==0)
{
strcpy(flag_All.flag, flag_All.buf);
}
else
{
}
flag_All.flagchange = 666666;
return EXIT_SUCCESS;
}
int init_rand() {
my_mycompare();
if ( flag_All.my_compareNum== 1) {
flag_All.flag = malloc(size1);
strcpy(flag_All.flag, flag_All.buf);
flag_All.flagchange = 1;
return EXIT_SUCCESS;
}
else if (flag_All.my_compareNum == 0)
{
flag_All.flag = malloc(size1);
strcpy(flag_All.flag, flag_All.buf1);
flag_All.flagchange = 0;
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}
int free_mem(struct my_data *mydata){
if (mydata->buf != NULL) {
free(mydata->buf);
}
if (mydata->buf1 != NULL) {
free(mydata->buf1);
}
if (mydata->flag != NULL) {
free(mydata->flag);
}
if (mydata->midstate != NULL) {
free(mydata->midstate);
}
return EXIT_SUCCESS;
}
int main() {
printf("%s\n", "本cm由白云点缀的蓝编写");
init_data();
init_rand();
char buf[256] = {0};
while (1)
{
memset(buf,0,256);
if (flag_All.CNum <= 0) {
break;
}
fgets(buf, size1,stdin);
if (strcmp(flag_All.flag, buf) ==0 ) {
my_mycompare();
if (flag_All.flagchange == 666666||flag_All.flagTwo==1) {
printf("恭喜你,成功了\n");
break;
}
else if (flag_All.my_compareNum) {
printf("恭喜你,成功了\n");
break;
}
else
{
flag_All.CNum--;
if(!(flag_All.flagTwo == 1))
changeNum();
printf("失败了,不要灰心\n你还有%d次机会\n", flag_All.CNum);
}
}
else
{
flag_All.flagTwo=1;
flag_All.CNum--;
printf("失败了,不要灰心\n你还有%d次机会\n", flag_All.CNum);
}
}
free_mem(&flag_All);
system("pause");
return EXIT_SUCCESS;
}
int my_compare() {
my_rand();
if (flag_All.randNum > 10) {
flag_All.my_compareNum= 0;
}
else if(flag_All.randNum <10)
{
flag_All.my_compareNum= 1;
}
else
{
flag_All.my_compareNum = -1;
}
return -1;
}
[C] 纯文本查看 复制代码 #pragma once
extern int my_rand();
extern int init_data();
extern int init_rand();
extern int my_compare();
extern int changeNum();
extern int free_mem(struct my_data* mydata);
extern int My_malloc();
extern int my_mycompare();
|