List soal PWN untuk KSL Seleksi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. //gcc -g -no-pie -fno-stack-protector -fno-pic -fno-builtin -mpreferred-stack-boundary=2 -m32 diary.c -o diary
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <limits.h>
  5. void not_even_called(){
  6. puts("\nWelcome Garuda Muda\n");
  7. system("/bin/sh");
  8. }
  9. void init(){
  10. setvbuf(stdin, NULL, _IONBF, 0);
  11. setvbuf(stdout, NULL, _IONBF, 0);
  12. setvbuf(stderr, NULL, _IONBF, 0);
  13. }
  14. void tulisan(){
  15. puts("██████╗ ██╗ █████╗ ██████╗ ██╗ ██╗ ███████╗███████╗██████╗ ██╗ ██╗██╗ ██████╗███████╗");
  16. puts("██╔══██╗██║██╔══██╗██╔══██╗╚██╗ ██╔╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██║██╔════╝██╔════╝");
  17. puts("██║ ██║██║███████║██████╔╝ ╚████╔╝ ███████╗█████╗ ██████╔╝██║ ██║██║██║ █████╗ ");
  18. puts("██║ ██║██║██╔══██║██╔══██╗ ╚██╔╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║██║ ██╔══╝ ");
  19. puts("██████╔╝██║██║ ██║██║ ██║ ██║ ███████║███████╗██║ ██║ ╚████╔╝ ██║╚██████╗███████╗");
  20. puts("╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═════╝╚══════╝\n");
  21. }
  22. int main()
  23. {
  24. init();
  25. char a[4];
  26. int b;
  27. char c[16];
  28. strcpy(a,"KSL");
  29. b = 14045;
  30. tulisan();
  31. printf("Welcome to Diary Application \n");
  32. printf("write something : ");
  33. gets(c);
  34. if(strlen(c) > 20){
  35. printf("karakter gak boleh lebih dari 20\n");
  36. } else{
  37. if(b == 0x67616c66) not_even_called();
  38. else printf("isi diary kamu : %s\n",c);
  39. }
  40. exit(0);
  41. }