萌新带你开车上p站(三)
2022-11-12 来源:acgdir.com
2022/1111/200138_88950.jpg{}0x08
题目给的提示是和运算符优先级有关
登录后直接看源码
mistake@pwnable:~$ ls
flag mistake mistake.c password
mistake@pwnable:~$ cat mistake.c
#include <stdio.h>
#include <fcntl.h>
#define PW_LEN 10
#define XORKEY 1
void xor(char* s, int len){
int i;
for(i=0; i<len; i ){
s[i] ^= XORKEY;
}
}
int main(int argc, char* argv[]){
int fd;
if(fd=open("/home/mistake/password",O_RDONLY,0400) < 0){
printf("can"t open password %d ", fd);
return 0;
}
printf("do not bruteforce... ");
sleep(time(0) );
char pw_buf[PW_LEN 1];
int len;
if(!(len=read(fd,pw_buf,PW_LEN) > 0)){
printf("read error ");
close(fd);
return 0;
}
char pw_buf2[PW_LEN 1];
题目给的提示是和运算符优先级有关
登录后直接看源码
mistake@pwnable:~$ ls
flag mistake mistake.c password
mistake@pwnable:~$ cat mistake.c
#include <stdio.h>
#include <fcntl.h>
#define PW_LEN 10
#define XORKEY 1
void xor(char* s, int len){
int i;
for(i=0; i<len; i ){
s[i] ^= XORKEY;
}
}
int main(int argc, char* argv[]){
int fd;
if(fd=open("/home/mistake/password",O_RDONLY,0400) < 0){
printf("can"t open password %d ", fd);
return 0;
}
printf("do not bruteforce... ");
sleep(time(0) );
char pw_buf[PW_LEN 1];
int len;
if(!(len=read(fd,pw_buf,PW_LEN) > 0)){
printf("read error ");
close(fd);
return 0;
}
char pw_buf2[PW_LEN 1];