diff --git a/pa/lab3/chall_pickles.py b/pa/lab3/chall_pickles.py new file mode 100644 index 0000000..1ec45b6 --- /dev/null +++ b/pa/lab3/chall_pickles.py @@ -0,0 +1,9 @@ +from pwn import * + +HOST = "mustard.stt.rnl.tecnico.ulisboa.pt" +PORT = 25653 + +conn = remote(HOST, PORT) +line = conn.interactive() + +SSof_148:BHdrm8TgNq diff --git a/pa/lab3/read_file.c b/pa/lab3/read_file.c new file mode 100644 index 0000000..3e4e880 --- /dev/null +++ b/pa/lab3/read_file.c @@ -0,0 +1,30 @@ +#include +#include +#include + +int main() { + char file_to_read[64] = {0}; + + printf("Insert filename to read: "); + fflush(stdout); + + int res = read(STDIN_FILENO, file_to_read, sizeof(file_to_read)); + file_to_read[res-1] = '\x00'; + + if(!access(file_to_read, R_OK)) { + FILE *fd; + char buffer[2048] = {0}; + + puts("Content: \n===========================\n"); + + fd = fopen(file_to_read, "r"); + fread(buffer, sizeof(buffer), 1, fd); + + printf("%s\n", buffer); + puts("==========================="); + } else { + printf("No permission to read '%s'\n", file_to_read); + } + + return 0; +}