Guest User

Untitled

a guest
Jan 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. /*
  2. Programma: iHack.c
  3. Autore: Marini Samuele
  4. Data: -
  5. */
  6.  
  7. #include<stdio.h>
  8. #include<string.h>
  9.  
  10. #define COL(x) "\033[" #x ";1m"
  11. #define dark COL(30)
  12. #define red COL(31)
  13. #define green COL(32)
  14. #define yellow COL(33)
  15. #define blue COL(34)
  16. #define pink COL(35)
  17. #define lblue COL(36)
  18. #define white COL(37)
  19. #define rosso COL(41)
  20. #define verde COL(42)
  21. #define giallo COL(43)
  22. #define blu COL(44)
  23. #define viola COL(45)
  24. #define azzurro COL(46)
  25. #define grigio COL(47)
  26. #define normal "\033[0m"
  27.  
  28. #define dim 100
  29.  
  30. int Livello_1(int* max_ten);
  31. int Livello_2();
  32. int Livello_3();
  33. int Livello_4();
  34. int Livello_5();
  35. int Livello_6();
  36. int Livello_7();
  37. int Livello_8();
  38. int Livello_9();
  39. int Livello_10();
  40.  
  41. int main()
  42. {
  43. char sino;
  44. int max_ten,liv=1,ver,inizio=0,a=0;
  45. do
  46. {
  47. do
  48. {
  49. if(inizio==0)
  50. {
  51. system("clear");
  52. printf(green);
  53. printf("***************************\n");
  54. printf("********** **********\n");
  55. printf("********* ");
  56. printf(red);
  57. printf("iHack");
  58. printf(green);
  59. printf(" *********\n");
  60. printf("********** **********\n");
  61. printf("***************************\n");
  62. printf(normal);
  63. printf("Premi invio per iniziare ");
  64. getchar();
  65. if(a==1)
  66. {
  67. getchar();
  68. }
  69. }
  70. switch(liv)
  71. {
  72. case 1:
  73. max_ten=0;
  74. inizio=1;
  75. do
  76. {
  77. ver=Livello_1(&max_ten);
  78. if(ver==0)
  79. {
  80. liv++;
  81. }
  82. }
  83. while(max_ten<3 && ver==1);
  84. if(max_ten==3)
  85. {
  86. system("clear");
  87. printf(red);
  88. printf(blu);
  89. printf(" WARNING \n");
  90. printf("INVALID USERNAME AND/OR\nPASSWORD! ATTEMPTED \nACCESS TOO MANY TIMES! \n");
  91. printf(normal);
  92. printf("Premi invio per continuare ");
  93. inizio=0;
  94. a=1;
  95. }
  96. break;
  97. case 2:
  98. printf("LIVELLO 2");
  99. getchar();
  100. getchar();
  101. break;
  102. case 3:
  103. break;
  104. case 4:
  105. break;
  106. case 5:
  107. break;
  108. case 6:
  109. break;
  110. case 7:
  111. break;
  112. case 8:
  113. break;
  114. case 9:
  115. break;
  116. case 10:
  117. break;
  118. }
  119. }
  120. while(max_ten<3);
  121. getchar();
  122. printf("Vuoi riavviare il gioco(s/n)?: ");
  123. scanf("%c", &sino);
  124. }
  125. while(sino=='s' || sino=='S');
  126. return 0;
  127. }
  128.  
  129. // LIVELLI
  130.  
  131. int Livello_1(int* max_ten)
  132. {
  133. int scelta;
  134. char Username[dim],Password[dim],Ver1[dim]={'j','a','c','k'},Ver2[dim]={'j','1','9','8','7'};
  135. do
  136. {
  137. system("clear");
  138. printf(red);
  139. printf(" LIVELLO 1\n");
  140. printf(blue);
  141. printf("Menù\n");
  142. printf("1| Inserisci Username/Password\n");
  143. printf("2| View Source\n");
  144. printf("3| Hint\n");
  145. printf(normal);
  146. printf("Scelta: ");
  147. scanf("%d", &scelta);
  148. if(scelta<1 || scelta>3)
  149. {
  150. printf(rosso);
  151. printf("Devi inserire una scelta valida\n");
  152. printf("Premi invio per continuare ");
  153. printf(normal);
  154. getchar();
  155. getchar();
  156. }
  157. }
  158. while(scelta<1 || scelta>3);
  159. switch(scelta)
  160. {
  161. case 1:
  162. system("clear");
  163. getchar();
  164. printf("Username: ");
  165. gets(Username);
  166. printf("Password: ");
  167. gets(Password);
  168. if(strcmp(Username,Ver1)==0)
  169. {
  170. if(strcmp(Password,Ver2)==0)
  171. {
  172. printf("Esatto\n");
  173. getchar();
  174. return 0;
  175. }
  176. }
  177. else
  178. {
  179. printf(red);
  180. printf("\n");
  181. printf(" WARNING\n\n");
  182. printf("INVALID USERNAME AND/OR\n PASSWORD\n");
  183. printf(normal);
  184. printf("Premi invio per continuare ");
  185. getchar();
  186. (*max_ten)++;
  187. return 1;
  188. }
  189. break;
  190. case 2:
  191. system("clear");
  192. printf(yellow);
  193. printf(" Source Code\n\n");
  194. printf("<html>\n<head>\n<a ret='style.css'/>\n</head>\n<body>\n<div id='wrapper'>\n");
  195. printf("<div id='container'>\nTHE DEPARTMENT OF\nHACKING\n<br />\n<br />\n");
  196. printf("form action=login.php\nmethod=put>\nUername\n<input type=text size=20\n class='form'/>\n");
  197. printf("<input type=hidden\nname=username value=jack />\n<br />\nPassword\n");
  198. printf("<input type=password size=20\nclass='form' />\n<input type=hidden\nname=password value=j1987 />\n");
  199. printf("<br />\n</form>\n**Unauthorized access to this site\nis strictly prohibited.**\n");
  200. printf("</div>\n</div>\n</body>\n</html>\n");
  201. printf(blue);
  202. printf("Premi invio per continuare ");
  203. printf(normal);
  204. getchar();
  205. getchar();
  206. break;
  207. case 3:
  208. system("clear");
  209. printf(yellow);
  210. printf(" HINT\n\n");
  211. printf("Honestly, its the first level. Well i\n");
  212. printf("think that you can come up with\n");
  213. printf("some sort of reSOURCE to help you\n");
  214. printf("break in.\n");
  215. printf(blue);
  216. printf("Premi invio per continuare ");
  217. printf(normal);
  218. getchar();
  219. getchar();
  220. break;
  221. }
  222. return 3;
  223. }
Add Comment
Please, Sign In to add comment