Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.78 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void FileWriting(char *nme, FILE *list);
  5. void FileOutPut();
  6. void Trim(char *pass);
  7.  
  8. int main()
  9. {
  10. char nme[100], answer[4], answer2[4];
  11. int repeat=1;
  12.  
  13. printf("Hello Welcome to Killeramor's Password Permutation!\n");
  14. printf("---------------------------------------------------\n");
  15. printf("What is your Name? ");
  16. fgets(nme,100,stdin);
  17.  
  18. do
  19. {
  20. printf("Lets get started.\n");
  21.  
  22. FILE *list;
  23. list=fopen("Passwords.txt", "w");
  24. FileWriting(nme,list);
  25. fclose(list);
  26.  
  27. printf("Would you like to see what was posted to file?(Y/N) ");
  28. fgets(answer,4,stdin);
  29. if(tolower(answer[0]) == 'y')
  30. {
  31. FileOutPut();
  32. printf("Would you like to redo the file?(Y/N)");
  33. fgets(answer2,4,stdin);
  34. if (tolower(answer2[0]) == 'y')
  35. {
  36. repeat = 1;
  37. }
  38. else if (tolower(answer2[0]) == 'n')
  39. {
  40. repeat = 0;
  41. printf("Have a good day!\n");
  42. }
  43. }
  44. else if (tolower(answer[0]) == 'n')
  45. {
  46. printf("Thanks for using the program.\n");
  47. repeat = 2;
  48. }
  49. else
  50. {
  51. printf("Did not enter the way it was asked for.\n");
  52. }
  53. }while(repeat == 1);
  54.  
  55. system("pause");
  56. return 0;
  57. }
  58.  
  59. /* Function used to write to the File. */
  60. void FileWriting(char *nme, FILE *list)
  61. {
  62. int loop,num,rNum,lCheck;
  63. char pass[100];
  64. char a[5]="aA@4",b[5]="bB86",c[7]="cC(<[{",d[4]="dD0";
  65. char e[4]="eE3",f[3]="fF",g[5]="gG56",h[4]="hH#",i[5]="iI!1";
  66. char j[5]="jJ]}", k[4]="kK{", l[6]="lL|17", m[3]="mM", n[4]="nN^";
  67. char o[4]="oO0", p[4]="pP9",q[3]="qQ", r[3]="rR",s[4]="sS$", t[4]="tT+";
  68. char u[3]="uU", v[3]="vV", w[3]="wW", x[4]="xX*", y[3]="yY", z[3]="zZ";
  69. printf("\nEnter the password: ");
  70. fgets(pass,100,stdin);
  71. Trim(pass);
  72.  
  73. fprintf(list, "Generated by Killeramor's Password Permutation Generator.\n");
  74. fprintf(list,"---------------------------------------------------------\n");
  75. fprintf(list, "Permutation Password list for: %s\n", nme);
  76. fprintf(list, "Password Listing's:\n" );
  77. fprintf(list, "Password your using is:%s\n",pass);
  78. for (loop=0; loop < 10; loop++)
  79. {
  80. num = rand() % 10;
  81.  
  82. for(lCheck=0; lCheck < strlen(pass); lCheck++)
  83. {
  84. if (tolower(pass[lCheck]) == 'a')
  85. {
  86. rNum = rand() % 4;
  87. pass[lCheck]= a[rNum] ;
  88. }
  89. else if (tolower(pass[lCheck]) == 'b')
  90. {
  91. rNum = rand() % 4;
  92. pass[lCheck]= b[rNum] ;
  93. }
  94. else if (tolower(pass[lCheck]) == 'c')
  95. {
  96. rNum = rand() % 6;
  97. pass[lCheck]= c[rNum] ;
  98. }
  99. else if (tolower(pass[lCheck]) == 'd')
  100. {
  101. rNum = rand() % 3;
  102. pass[lCheck]= d[rNum] ;
  103. }
  104. else if (tolower(pass[lCheck]) == 'e')
  105. {
  106. rNum = rand() % 3;
  107. pass[lCheck]= e[rNum] ;
  108. }
  109. else if (tolower(pass[lCheck]) == 'f')
  110. {
  111. rNum = rand() % 2;
  112. pass[lCheck]= f[rNum] ;
  113. }
  114. else if (tolower(pass[lCheck]) == 'g')
  115. {
  116. rNum = rand() % 4;
  117. pass[lCheck]= g[rNum] ;
  118. }
  119. else if (tolower(pass[lCheck]) == 'h')
  120. {
  121. rNum = rand() % 3;
  122. pass[lCheck]= h[rNum] ;
  123. }
  124. else if (tolower(pass[lCheck]) == 'i')
  125. {
  126. rNum = rand() % 4;
  127. pass[lCheck]= i[rNum] ;
  128. }
  129. else if (tolower(pass[lCheck]) == 'j')
  130. {
  131. rNum = rand() % 4;
  132. pass[lCheck]= j[rNum] ;
  133. }
  134. else if (tolower(pass[lCheck]) == 'k')
  135. {
  136. rNum = rand() % 3;
  137. pass[lCheck]= k[rNum] ;
  138. }
  139. else if (tolower(pass[lCheck]) == 'l')
  140. {
  141. rNum = rand() % 5;
  142. pass[lCheck]= l[rNum] ;
  143. }
  144. else if (tolower(pass[lCheck]) == 'm')
  145. {
  146. rNum = rand() % 2;
  147. pass[lCheck]= m[rNum] ;
  148. }
  149. else if (tolower(pass[lCheck]) == 'n')
  150. {
  151. rNum = rand() % 3;
  152. pass[lCheck]= n[rNum] ;
  153. }
  154. else if (tolower(pass[lCheck]) == 'o')
  155. {
  156. rNum = rand() % 3;
  157. pass[lCheck]= o[rNum] ;
  158. }
  159. else if (tolower(pass[lCheck]) == 'p')
  160. {
  161. rNum = rand() % 3;
  162. pass[lCheck]= p[rNum] ;
  163. }
  164. else if (tolower(pass[lCheck]) == 'q')
  165. {
  166. rNum = rand() % 2;
  167. pass[lCheck]= q[rNum] ;
  168. }
  169. else if (tolower(pass[lCheck]) == 'r')
  170. {
  171. rNum = rand() % 2;
  172. pass[lCheck]= r[rNum] ;
  173. }
  174. else if (tolower(pass[lCheck]) == 's')
  175. {
  176. rNum = rand() % 3;
  177. pass[lCheck]= s[rNum] ;
  178. }
  179. else if (tolower(pass[lCheck]) == 't')
  180. {
  181. rNum = rand() % 3;
  182. pass[lCheck]= t[rNum] ;
  183. }
  184. else if (tolower(pass[lCheck]) == 'u')
  185. {
  186. rNum = rand() % 2;
  187. pass[lCheck]= u[rNum] ;
  188. }
  189. else if (tolower(pass[lCheck]) == 'v')
  190. {
  191. rNum = rand() % 2;
  192. pass[lCheck]= v[rNum] ;
  193. }
  194. else if (tolower(pass[lCheck]) == 'w')
  195. {
  196. rNum = rand() % 3;
  197. pass[lCheck]= w[rNum] ;
  198. }
  199. else if (tolower(pass[lCheck]) == 'x')
  200. {
  201. rNum = rand() % 3;
  202. pass[lCheck]= x[rNum] ;
  203. }
  204. else if (tolower(pass[lCheck]) == 'y')
  205. {
  206. rNum = rand() % 2;
  207. pass[lCheck]= y[rNum] ;
  208. }
  209. else if (tolower(pass[lCheck]) == 'z')
  210. {
  211. rNum = rand() % 2;
  212. pass[lCheck]= z[rNum] ;
  213. }
  214. }
  215.  
  216. fprintf(list,"Number:%d ", loop+1);
  217. fprintf(list," %s%d\n",pass,num);
  218.  
  219. }
  220.  
  221. }
  222.  
  223. /*Function used to open up the text Document.*/
  224. void FileOutPut()
  225. {
  226. int done=done+1;
  227. if ( done == 1)
  228. {
  229. system("setx path E:\\Password Permutations"); //System command to set the file path for the file.
  230. }
  231. system("start Passwords.txt");// System command to run the file.
  232. printf("\n");
  233. }
  234.  
  235. void Trim(char *pass)
  236. {
  237. char * p = pass;
  238. int l = strlen(p);
  239.  
  240. while(isspace(p[l - 1])) p[--l] = 0;
  241. while(*pass && isspace(* p)) ++p, --l;
  242.  
  243. memmove(pass, p, l + 1);
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement