Loading

[BUUCTF] pwnable_blukat

pwnable_blukat

总结

直接把远程的源码和password下载下来然后修改一下逻辑即可获得flag

EXP

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
char flag[100];
char password[100];
char* key = "3\rG[S/%\x1c\x1d#0?\rIS\x0f\x1c\x1d\x18;,4\x1b\x00\x1bp;5\x0b\x1b\x08\x45+";
void calc_flag(char* s){
        int i;
        for(i=0; i<strlen(s); i++){
                flag[i] = s[i] ^ key[i];
        }
        printf("%s\n", flag);
}
int main(){
        FILE* fp = fopen("./password", "r");
        fgets(password, 100, fp);
        char buf[100];
        printf("guess the password!\n");
        fgets(buf, 128, stdin);
        if(strcmp(password, buf)){ // 这里改一下即可
                printf("congrats! here is your flag: ");
                calc_flag(password);
        }
        else{
                printf("wrong guess!\n");
                exit(0);
        }
        return 0;
}

image-20220405154534330

引用与参考

1、My Blog

2、Ctf Wiki

3、pwncli

posted @ 2022-04-05 21:46  LynneHuan  阅读(54)  评论(0编辑  收藏  举报