-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
760 additions
and
1,242 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is an x86-64 bomb for self-study students. |
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/*************************************************************************** | ||
* Dr. Evil's Insidious Bomb, Version 1.1 | ||
* Copyright 2011, Dr. Evil Incorporated. All rights reserved. | ||
* | ||
* LICENSE: | ||
* | ||
* Dr. Evil Incorporated (the PERPETRATOR) hereby grants you (the | ||
* VICTIM) explicit permission to use this bomb (the BOMB). This is a | ||
* time limited license, which expires on the death of the VICTIM. | ||
* The PERPETRATOR takes no responsibility for damage, frustration, | ||
* insanity, bug-eyes, carpal-tunnel syndrome, loss of sleep, or other | ||
* harm to the VICTIM. Unless the PERPETRATOR wants to take credit, | ||
* that is. The VICTIM may not distribute this bomb source code to | ||
* any enemies of the PERPETRATOR. No VICTIM may debug, | ||
* reverse-engineer, run "strings" on, decompile, decrypt, or use any | ||
* other technique to gain knowledge of and defuse the BOMB. BOMB | ||
* proof clothing may not be worn when handling this program. The | ||
* PERPETRATOR will not apologize for the PERPETRATOR's poor sense of | ||
* humor. This license is null and void where the BOMB is prohibited | ||
* by law. | ||
***************************************************************************/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "support.h" | ||
#include "phases.h" | ||
|
||
/* | ||
* Note to self: Remember to erase this file so my victims will have no | ||
* idea what is going on, and so they will all blow up in a | ||
* spectaculary fiendish explosion. -- Dr. Evil | ||
*/ | ||
|
||
FILE *infile; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
char *input; | ||
|
||
/* Note to self: remember to port this bomb to Windows and put a | ||
* fantastic GUI on it. */ | ||
|
||
/* When run with no arguments, the bomb reads its input lines | ||
* from standard input. */ | ||
if (argc == 1) { | ||
infile = stdin; | ||
} | ||
|
||
/* When run with one argument <file>, the bomb reads from <file> | ||
* until EOF, and then switches to standard input. Thus, as you | ||
* defuse each phase, you can add its defusing string to <file> and | ||
* avoid having to retype it. */ | ||
else if (argc == 2) { | ||
if (!(infile = fopen(argv[1], "r"))) { | ||
printf("%s: Error: Couldn't open %s\n", argv[0], argv[1]); | ||
exit(8); | ||
} | ||
} | ||
|
||
/* You can't call the bomb with more than 1 command line argument. */ | ||
else { | ||
printf("Usage: %s [<input_file>]\n", argv[0]); | ||
exit(8); | ||
} | ||
|
||
/* Do all sorts of secret stuff that makes the bomb harder to defuse. */ | ||
initialize_bomb(); | ||
|
||
printf("Welcome to my fiendish little bomb. You have 6 phases with\n"); | ||
printf("which to blow yourself up. Have a nice day!\n"); | ||
|
||
/* Hmm... Six phases must be more secure than one phase! */ | ||
input = read_line(); /* Get input */ | ||
phase_1(input); /* Run the phase */ | ||
phase_defused(); /* Drat! They figured it out! | ||
* Let me know how they did it. */ | ||
printf("Phase 1 defused. How about the next one?\n"); | ||
|
||
/* The second phase is harder. No one will ever figure out | ||
* how to defuse this... */ | ||
input = read_line(); | ||
phase_2(input); | ||
phase_defused(); | ||
printf("That's number 2. Keep going!\n"); | ||
|
||
/* I guess this is too easy so far. Some more complex code will | ||
* confuse people. */ | ||
input = read_line(); | ||
phase_3(input); | ||
phase_defused(); | ||
printf("Halfway there!\n"); | ||
|
||
/* Oh yeah? Well, how good is your math? Try on this saucy problem! */ | ||
input = read_line(); | ||
phase_4(input); | ||
phase_defused(); | ||
printf("So you got that one. Try this one.\n"); | ||
|
||
/* Round and 'round in memory we go, where we stop, the bomb blows! */ | ||
input = read_line(); | ||
phase_5(input); | ||
phase_defused(); | ||
printf("Good work! On to the next...\n"); | ||
|
||
/* This phase will never be used, since no one will get past the | ||
* earlier ones. But just in case, make this one extra hard. */ | ||
input = read_line(); | ||
phase_6(input); | ||
phase_defused(); | ||
|
||
/* Wow, they got it! But isn't something... missing? Perhaps | ||
* something they overlooked? Mua ha ha ha ha! */ | ||
|
||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int func1(unsigned word) { | ||
return (int) ((word << 24) >> 24); | ||
} | ||
|
||
int func2(unsigned word) { | ||
return ((int) word << 24) >> 24; | ||
} | ||
|
||
int main(void) { | ||
unsigned w = 0x00000076; | ||
printf("func1: %x, func2: %x\n", func1(w), func2(w)); | ||
w = 0x87654321; | ||
printf("func1: %x, func2: %x\n", func1(w), func2(w)); | ||
w = 0x000000C9; | ||
printf("func1: %x, func2: %x\n", func1(w), func2(w)); | ||
w = 0xEDCBA987; | ||
printf("func1: %x, func2: %x\n", func1(w), func2(w)); | ||
|
||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
float sum_element(float a[], unsigned length) { | ||
int i; | ||
float result = 0; | ||
for(i = 0; i <= (int)(length - 1); i++) { | ||
result += a[i]; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
int main(void) { | ||
float a[] = {1.0, 2.0}; | ||
int alen = 2; | ||
printf("%f\n", sum_element(a, alen)); | ||
|
||
float b[] = {}; | ||
int blen = 0; | ||
printf("%f\n", sum_element(b, blen)); | ||
|
||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int uadd_ok(unsigned x, unsigned y) { | ||
unsigned s = x + y; | ||
return s < x || s < y; | ||
} | ||
|
||
int main(void) { | ||
unsigned x = 0xFFFFFFFF; | ||
unsigned y = 0xEEEEEEEE; | ||
|
||
printf("add ok: %d\n", uadd_ok(x, y)); | ||
printf("x + y = %x\n", x + y); | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int tadd_ok(int x, int y) { | ||
int s; | ||
if(x > 0 && y > 0) { | ||
s = x + y; | ||
return s <= 0; | ||
} | ||
if(x < 0 && y < 0) { | ||
return s >= 0; | ||
} | ||
return 0; | ||
} | ||
|
||
int main(void) { | ||
int x = 0x7FFFFFFF; | ||
int y = 0x00000001; | ||
|
||
printf("tadd ok: %d\n", tadd_ok(x, y)); | ||
printf("x + y = %x\n", x + y); | ||
|
||
return 0; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# This file contains configuration variables for drivers. | ||
# It was generated by genhdrs.pl. Do not modify it. | ||
# | ||
package Driverhdrs; | ||
|
||
$LAB = "datalab"; | ||
$SERVER_NAME = "changeme.ics.cs.cmu.edu"; | ||
$SERVER_PORT = 8081; | ||
$COURSE_NAME = "csapp"; | ||
$AUTOGRADE_TIMEOUT = 0; | ||
1; |
This file contains 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
This file contains 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
Oops, something went wrong.