Guest User

Untitled

a guest
Apr 22nd, 2018
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. #define PHP_RAND_MAX 0x7fff
  6. #define RAND_RANGE(__n, __min, __max, __tmax) \
  7. (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
  8.  
  9. unsigned int state;
  10.  
  11. static unsigned int winrand() {
  12. const unsigned int a = 214013;
  13. const unsigned int c = 2531011;
  14. state = a * state + c;
  15. return (state >> 16) & 0x7fff;
  16. }
  17.  
  18. static char * gen(int len, char * token)
  19. {
  20. char * pt = token;
  21.  
  22. while (len--) {
  23. int choose = RAND_RANGE(winrand(), 0, 2, PHP_RAND_MAX);
  24. if (choose == 0) {
  25. *pt = RAND_RANGE(winrand(), 'A', 'Z', PHP_RAND_MAX);
  26. } else if(choose == 1) {
  27. *pt = RAND_RANGE(winrand(), 'a', 'z', PHP_RAND_MAX);
  28. } else {
  29. *pt = RAND_RANGE(winrand(), '0', '9', PHP_RAND_MAX);
  30. }
  31. pt++;
  32. }
  33. *pt = 0;
  34. return token;
  35. }
  36.  
  37. int main() {
  38. char token[11];
  39. unsigned int i = 0;
  40. while (1) {
  41. state = i;
  42. gen(10, token);
  43. printf("[i]=%d, token=%s\n", i, token);
  44. if (strcmp(token, "308AXoL3zs") == 0) {
  45. printf("[+] SUCCESS !\n");
  46. printf("next token: %s\n", gen(10, token));
  47. printf("next of next token: %s\n", gen(10,token));
  48. return 0;
  49. }
  50. i++;
  51. }
  52. }
RAW Paste Data