mirror of https://github.com/dirtbags/moth.git
frobbed executable puzzle
This commit is contained in:
parent
6b2ba1bcfa
commit
39d9e069e4
|
@ -0,0 +1,9 @@
|
|||
LDFLAGS = -static
|
||||
|
||||
all: frob main
|
||||
|
||||
main: CFLAGS = -Dfrobbed='"$(shell tr -d '\n' < key | ./frob)"'
|
||||
|
||||
clean:
|
||||
rm -rf main frob
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char c;
|
||||
|
||||
while (read(0, &c, 1)) {
|
||||
c ^= 3;
|
||||
write(1, &c, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
lawful forths Amanda
|
|
@ -0,0 +1,29 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char reply[256];
|
||||
|
||||
printf("What is the password? ");
|
||||
fflush(stdout);
|
||||
if (fgets(reply, sizeof(reply), stdin)) {
|
||||
char *p;
|
||||
|
||||
for (p = reply; *p; p += 1) {
|
||||
if ('\n' == *p) {
|
||||
*p = '\0';
|
||||
break;
|
||||
}
|
||||
*p = *p ^ 3;
|
||||
}
|
||||
if (strcmp(reply, frobbed)) {
|
||||
printf("No it isn't!\n");
|
||||
} else {
|
||||
printf("Congratulations.\n");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue