Skip to content

Instantly share code, notes, and snippets.

@donkey-hotei
Last active January 3, 2016 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donkey-hotei/98cc35ef7c186c0da143 to your computer and use it in GitHub Desktop.
Save donkey-hotei/98cc35ef7c186c0da143 to your computer and use it in GitHub Desktop.
my reversal of the CMU binary bomb
// NOTE: this code will _not_ compile
void phase_1(char ** input) {
if (input != "Public speaking is very easy.")
explode_bomb();
else
return;
}
void phase_2(char ** input) {
int ar[6];
ar = read_six_numbers(input);
if (ar[0] != 1)
explode_bomb();
for (int i = 1; i <= 5; i++)
if(a[i] != ((i+1) * a[i-1]))
explode_bomb();
return;
}
void phase_3(char ** input){
char ** buffer;
int c;
if (sscanf(input, "%d %c %d", buffer) <= 2)
explode_bomb();
if (buffer[0] > 7)
explode_bomb();
// jmp DWORD PTR [eax*4+0x80497e8]
switch (buffer[0]) {
case 1:
c = 0x62;
if (buffer[2] != 214)
explode_bomb();
break;
case 2:
c = 0x62;
if (buffer[2] != 755)
explode_bomb();
break;
case 3:
c = 0x6b
if (buffer[2] != 251)
explode_bomb();
break;
case 4:
c = 0x6f;
if (buffer[2] != 160)
explode_bomb();
break;
case 5:
c = 0x74;
if (buffer[2] != 458)
explode_bomb();
break;
case 6:
c = 0x76;
if (buffer[2] != 780)
explode_bomb();
case 7:
c = 0x78;
if (buffer[2] != 524)
explode_bomb();
break;
}
if (buffer[1] != digit)
explode_bomb();
return;
}
int func4(int n) {
if (n <= 1)
return n;
else {
return func4(n-1) + func4(n-2);
}
}
void phase_4(char ** input){
int d;
if (sscanf(input, "%d", d) != 1)
explode_bomb();
if (d <= 0)
explode_bomb();
if (func4(d) != 0x37)
explode_bomb();
return;
}
void phase_5(char ** input){
if (string_length(input) != 6)
explode_bomb();
while ( ebx <= 6 ){
// ?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment