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.

40 line
2.0 KiB

5 年之前
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <limits.h>
  4. void not_even_called(){
  5. puts("\nWelcome Garuda Muda\n");
  6. system("/bin/sh");
  7. }
  8. void tulisan(){
  9. puts("██████╗ ██╗ █████╗ ██████╗ ██╗ ██╗ ███████╗███████╗██████╗ ██╗ ██╗██╗ ██████╗███████╗");
  10. puts("██╔══██╗██║██╔══██╗██╔══██╗╚██╗ ██╔╝ ██╔════╝██╔════╝██╔══██╗██║ ██║██║██╔════╝██╔════╝");
  11. puts("██║ ██║██║███████║██████╔╝ ╚████╔╝ ███████╗█████╗ ██████╔╝██║ ██║██║██║ █████╗ ");
  12. puts("██║ ██║██║██╔══██║██╔══██╗ ╚██╔╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║██║ ██╔══╝ ");
  13. puts("██████╔╝██║██║ ██║██║ ██║ ██║ ███████║███████╗██║ ██║ ╚████╔╝ ██║╚██████╗███████╗");
  14. puts("╚═════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═════╝╚══════╝\n");
  15. }
  16. int main()
  17. {
  18. char a[4];
  19. int b;
  20. char c[16];
  21. strcpy(a,"KSL");
  22. b = 14045;
  23. tulisan();
  24. printf("Welcome to Diary Application \n");
  25. printf("write something : ");
  26. gets(c);
  27. if(strlen(c) > 20){
  28. printf("karakter gak boleh lebih dari 20\n");
  29. } else{
  30. if(b == 0x67616c66) not_even_called();
  31. else printf("isi diary kamu : %s\n",c);
  32. }
  33. exit(0);
  34. }