Created
December 19, 2014 09:07
-
-
Save hhc0null/ebc804b94e2d243bb2cf to your computer and use it in GitHub Desktop.
waiwai
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int table[255] = {0}; | |
int mark = 0xdeadbeef; | |
int index = 0; | |
void generate_table() | |
{ | |
for(index; index < 0xff; index++) { | |
if(table[index] == 0) { | |
table[index] = mark; | |
} else if((index+1)&2) { | |
table[index] += table[index-2]; | |
} | |
table[index+1] = table[index]/(index+1)+2*index*table[index]; | |
} | |
} | |
int get_from_table() | |
{ | |
tmp = table[index++]; | |
return tmp; | |
} | |
bool len_check(double pos) | |
{ | |
const double fx = 65536.0; | |
const double fy = 0.00018310546875; | |
pos = fx / pos; | |
return (not_parity(pos, fy) || pos != fy)? true : false; | |
} | |
int main(void) | |
{ | |
char ch, *end; | |
int i, j, nullpos = -1, val = 0; | |
if(argc != 2) { | |
return 1; | |
} | |
for(i = 0; nullpos--, (argv[1])[i] != '\0'; i++); | |
end = &buf[i]; | |
nullpos = -2 - (nullpos); | |
if(len_check((double)nullpos)) { | |
return 1; | |
} | |
generate_table(); | |
for(i = 0; i < nullpos; i++) { | |
ch = (argv[1])[i]; | |
index = (int)ch+i; | |
if(('0' <= ch && ch <= '9') || | |
('A' <= ch && ch <= 'Z') || | |
('a' <= ch && ch <= 'z')) { | |
for(j = 0; j < nullpos; j++) { | |
val += get_from_table(); | |
} | |
if(check_table[i] != val) { | |
return 1; | |
} | |
} else { | |
return 1; | |
} | |
} | |
printf("you got flag: ADCTF_%s\n", argv[1]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment