Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit 3724f66

Browse files
author
bindshell@live.com
committed
first commit
0 parents  commit 3724f66

40 files changed

+616
-0
lines changed

abo1.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* abo1.c *
2+
* specially crafted to feed your brain by gera */
3+
4+
/* Dumb example to let you get introduced... */
5+
6+
int main(int argv,char **argc) {
7+
char buf[256];
8+
9+
strcpy(buf,argc[1]);
10+
}

abo10.c

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* abo10.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* Deja-vu */
5+
6+
char buf[256];
7+
8+
int main(int argv,char **argc) {
9+
char *pbuf=(char*)malloc(256);
10+
11+
gets(buf);
12+
free(pbuf);
13+
}

abo2.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* abo2.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* This is a tricky example to make you think *
5+
* and give you some help on the next one */
6+
7+
int main(int argv,char **argc) {
8+
char buf[256];
9+
10+
strcpy(buf,argc[1]);
11+
exit(1);
12+
}

abo3.c

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* abo3.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* This'll prepare you for The Next Step */
5+
6+
int main(int argv,char **argc) {
7+
extern system,puts;
8+
void (*fn)(char*)=(void(*)(char*))&system;
9+
char buf[256];
10+
11+
fn=(void(*)(char*))&puts;
12+
strcpy(buf,argc[1]);
13+
fn(argc[2]);
14+
exit(1);
15+
}

abo4.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* abo4.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* After this one, the next is just an Eureka! away */
5+
6+
extern system,puts;
7+
void (*fn)(char*)=(void(*)(char*))&system;
8+
9+
int main(int argv,char **argc) {
10+
char *pbuf=malloc(strlen(argc[2])+1);
11+
char buf[256];
12+
13+
fn=(void(*)(char*))&puts;
14+
strcpy(buf,argc[1]);
15+
strcpy(pbuf,argc[2]);
16+
fn(argc[3]);
17+
while(1);
18+
}

abo5.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* abo5.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* You take the blue pill, you wake up in your bed, *
5+
* and you believe what you want to believe *
6+
* You take the red pill, *
7+
* and I'll show you how deep goes the rabbit hole */
8+
9+
int main(int argv,char **argc) {
10+
char *pbuf=malloc(strlen(argc[2])+1);
11+
char buf[256];
12+
13+
strcpy(buf,argc[1]);
14+
for (;*pbuf++=*(argc[2]++););
15+
exit(1);
16+
}

abo6.c

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* abo6.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* return to me my love */
5+
6+
int main(int argv,char **argc) {
7+
char *pbuf=malloc(strlen(argc[2])+1);
8+
char buf[256];
9+
10+
strcpy(buf,argc[1]);
11+
strcpy(pbuf,argc[2]);
12+
while(1);
13+
}

abo7.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* abo7.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* sometimes you can, *
5+
* sometimes you don't *
6+
* that's what life's about */
7+
8+
char buf[256]={1};
9+
10+
int main(int argv,char **argc) {
11+
strcpy(buf,argc[1]);
12+
}

abo8.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* abo8.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* spot the difference */
5+
6+
7+
8+
char buf[256];
9+
10+
int main(int argv,char **argc) {
11+
strcpy(buf,argc[1]);
12+
}

abo9.c

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* abo9.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* free(your mind) */
5+
/* I'm not sure in what operating systems it can be done */
6+
7+
int main(int argv,char **argc) {
8+
char *pbuf1=(char*)malloc(256);
9+
char *pbuf2=(char*)malloc(256);
10+
11+
gets(pbuf1);
12+
free(pbuf2);
13+
free(pbuf1);
14+
}

e1.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* specially crafted to feed your brain by gera@core-sdi.com */
2+
3+
/* jumpy vfprintf, Batman! */
4+
5+
int main(int argv,char **argc) {
6+
/* Can you do it changing the stack? */
7+
/* Can you do it without changing it? */
8+
printf(argc[1]);
9+
while(1);
10+
}

e2.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* specially crafted to feed your brain by gera@core-sdi.com */
2+
3+
/* Now, your misson is to make abo1 act like this other program:
4+
*
5+
char buf[100];
6+
7+
while (1) {
8+
scanf("%100s",buf);
9+
system(buf);
10+
}
11+
12+
* But, you cannot execute code in stack.
13+
*/
14+
15+
int main(int argv,char **argc) {
16+
char buf[256];
17+
18+
strcpy(buf,argc[1]);
19+
}

e3.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* e3.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* are you an enviromental threat */
5+
6+
char buf[256];
7+
8+
int main(int argv,char **argc) {
9+
strcpy(buf,argc[1]);
10+
setenv("ABO",argc[2],1);
11+
while(1);
12+
}

e4.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* <A HRef=e4.c>e4.c</a> *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* %what the hell? */
5+
6+
char buf[256];
7+
8+
int main(int argv,char **argc) {
9+
strcpy(buf,argc[1]);
10+
printf("live at 100%!");
11+
while(1);
12+
}

e5.c

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* e5.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* is this possible? */
5+
6+
char buf[256];
7+
8+
int main(int argv,char **argc) {
9+
strcpy(buf,argc[1]);
10+
perror(argc[2]);
11+
while(1);
12+
}

fs1.c

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* fs1.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* Don't forget, *
5+
* more is less, *
6+
* here's a proof */
7+
8+
int main(int argv,char **argc) {
9+
short int zero=0;
10+
int *plen=(int*)malloc(sizeof(int));
11+
char buf[256];
12+
13+
strcpy(buf,argc[1]);
14+
printf("%s%hn\n",buf,plen);
15+
while(zero);
16+
}

fs2.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* fs2.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* Can you tell me what's above the edge? */
5+
int main(int argv,char **argc) {
6+
char buf[256];
7+
8+
snprintf(buf,sizeof buf,"%s%c%c%hn",argc[1]);
9+
snprintf(buf,sizeof buf,"%s%c%c%hn",argc[2]);
10+
}

fs3.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* fs3.c *
2+
* specially crafted to feed your brain by riq@core-sdi.com */
3+
4+
/* Not enough resources? */
5+
6+
int main(int argv,char **argc) {
7+
char buf[256];
8+
9+
snprintf(buf,sizeof buf,"%s%c%c%hn",argc[1]);
10+
}

fs4.c

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* fs4.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* Have you ever heard about code reusability? */
5+
6+
int main(int argv,char **argc) {
7+
char buf[256];
8+
9+
snprintf(buf,sizeof buf,"%s%6$hn",argc[1]);
10+
printf(buf);
11+
}
12+
13+

fs5.c

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* fs5.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
/* go, go, go! */
5+
int main(int argv,char **argc) {
6+
char buf[256];
7+
snprintf(buf,sizeof buf,argc[1]);
8+
9+
/* this line'll make your life easier */
10+
// printf("%s\n",buf);
11+
}

n1.c

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* n1.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
#include <stdio.h>
5+
#include <stdlib.h>
6+
#include <ctype.h>
7+
8+
#define MAX_SIZE 80
9+
10+
unsigned int atoul(char *str) {
11+
unsigned int answer=0;
12+
for (;*str && isdigit(*str);
13+
answer *= 10, answer += *str++-'0');
14+
return answer;
15+
}
16+
17+
int main(int argv, char **argc) {
18+
char buf[MAX_SIZE],*pbuf=buf;
19+
int count = atoul(argc[1]);
20+
21+
if (count >= MAX_SIZE) count = MAX_SIZE-1;
22+
23+
while (count--) *pbuf++=getchar();
24+
*pbuf=0;
25+
}

n2.c

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* n2.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
#include <stdio.h>
5+
#include <stdlib.h>
6+
#include <ctype.h>
7+
8+
#define MAX_SIZE 80
9+
10+
unsigned int atoul(char *str) {
11+
unsigned int answer=0;
12+
for (;*str && isdigit(*str);
13+
answer *= 10, answer += *str++-'0');
14+
return answer;
15+
}
16+
17+
int main(int argv, char **argc) {
18+
char *pbuf,buf[MAX_SIZE];
19+
int count = atoul(argc[1]);
20+
21+
if (count >= MAX_SIZE) count = MAX_SIZE-1;
22+
23+
pbuf=buf;
24+
while (count--) *pbuf++=getchar();
25+
*pbuf=0;
26+
}

n3.c

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* n3.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
#include <stdio.h>
5+
#include <string.h>
6+
7+
unsigned int count;
8+
char **args;
9+
10+
int main(int argv, char **argc) {
11+
char buf[80];
12+
13+
fscanf(stdin, "%u", &count);
14+
15+
args = alloca(count*sizeof(char*));
16+
while (count--) {
17+
if (!fgets(buf,sizeof buf,stdin)) break;
18+
*args++=strdup(buf);
19+
}
20+
}
21+

n4.c

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* n4.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
#include <stdio.h>
5+
#include <string.h>
6+
7+
unsigned int count;
8+
9+
int main(int argv, char **argc) {
10+
char buf[80],**args;
11+
12+
fscanf(stdin, "%u", &count);
13+
14+
args = alloca(count*sizeof(char*));
15+
while (count--) {
16+
if (!fgets(buf,sizeof buf,stdin)) break;
17+
*args++=strdup(buf);
18+
}
19+
}
20+

n5.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* n5.c *
2+
* specially crafted to feed your brain by gera@core-sdi.com */
3+
4+
#include <stdio.h>
5+
6+
int main(int argv, char **argc) {
7+
char **args,buf[80];
8+
unsigned int index,count;
9+
10+
fscanf(stdin, "%u", &count);
11+
args = malloc(count*sizeof(char*));
12+
13+
while (1) {
14+
fscanf(stdin,"%u %80s", &index, buf);
15+
if (index<count) args[index] = strdup(buf);
16+
else break;
17+
}
18+
}
19+

0 commit comments

Comments
 (0)