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

Commit 11b874e

Browse files
committed
Adaugă fișierele specifice laboratorului II
1 parent 7239d6a commit 11b874e

File tree

18 files changed

+457
-0
lines changed

18 files changed

+457
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
all: clean build
2+
3+
build: build-line-appender build-ping-google-dns build-santa-letters
4+
5+
build-line-appender:
6+
gcc -m32 -Wall -no-pie -O0 line-appender.c -o line-appender.elf
7+
8+
build-ping-google-dns:
9+
gcc -m32 -Wall -no-pie -O0 ping-google-dns.c -o ping-google-dns.elf
10+
11+
build-santa-letters:
12+
gcc -m32 -Wall -no-pie -O0 santa-letters.c -o santa-letters.elf
13+
14+
clean:
15+
rm -f *.elf
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <stdio.h>
2+
3+
void append_files(char source_filename[], char destination_filename[]){
4+
FILE *source, *destination;
5+
char buf[100];
6+
7+
source = fopen(source_filename, "r");
8+
destination = fopen(destination_filename, "a+");
9+
10+
if (!source && !destination) {
11+
printf("[!] Files cannot be accessed.\n");
12+
13+
return;
14+
}
15+
else{
16+
printf("[!] Appending the content of %s to %s.", source_filename, destination_filename);
17+
}
18+
19+
fprintf(destination, "\n");
20+
21+
fgets(buf, sizeof(buf), source);
22+
fprintf(destination, "%s", buf);
23+
}
24+
25+
int main(int argc, char *argv[]){
26+
char *source, *destination;
27+
28+
if (argc != 3){
29+
printf("[!] Source and destination files were not provided.\n");
30+
31+
return -1;
32+
}
33+
source = argv[1];
34+
destination = argv[2];
35+
36+
append_files(source, destination);
37+
38+
return 0;
39+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <string.h>
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
5+
#define FIRST_SERVER "8.8.8.8"
6+
#define SECOND_SERVER "8.8.4.4"
7+
8+
int main(){
9+
char ip[32];
10+
char command[64] = "ping -c 1 ";
11+
12+
printf("[+] Google DNS IP you want to ping is: ");
13+
scanf("%31s", ip);
14+
15+
if (strncmp(ip, FIRST_SERVER, sizeof(FIRST_SERVER) - 1) == 0 || strncmp(ip, SECOND_SERVER, sizeof(SECOND_SERVER) - 1) == 0){
16+
printf("[+] Ping output is:\n\n");
17+
18+
strcat(command, ip);
19+
system(command);
20+
}
21+
else{
22+
printf("[!] Invalid IP address\n");
23+
}
24+
25+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
4+
int gifts_count = 32;
5+
6+
void print_letter(char *name) {
7+
8+
// Print the letter
9+
printf("\033[31mDear Santa Claus,\n\n");
10+
printf("My name is:\n\n\t");
11+
printf(name);
12+
printf("\n\nI swear I was a good kid, doing all my homework and getting good "
13+
"grades on all my tests. The only mistake I made this year was "
14+
"omitting the printf(%%s) usage class :(. As a "
15+
"result, I think I am deserving of %d gifts.\n\n", gifts_count);
16+
printf("Hope to see you on Christmas!\n\033[0m");
17+
}
18+
19+
int main(int argc, char *argv[]) {
20+
int helper = &gifts_count;
21+
22+
// Check the number of arguments
23+
if (argc != 2) {
24+
printf("Usage: %s FULL_NAME\n", argv[0]);
25+
26+
exit(1);
27+
}
28+
29+
print_letter(argv[1]);
30+
}
15.4 KB
Binary file not shown.

labs/vuln/support/export.pdf

1.12 MB
Binary file not shown.

labs/vuln/support/images/afl.webp

33.7 KB
Loading
188 KB
Loading
335 KB
Loading

labs/vuln/support/images/angr.png

223 KB
Loading

0 commit comments

Comments
 (0)