elibj123

Untitled

Mar 16th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. import json
  2. import pika
  3. import hashlib
  4.  
  5. with open('hexstrings.txt', 'r') as fp:
  6. hash_list = fp.readlines()
  7. hash_list = [hash.strip() for hash in hash_list]
  8. print 'Loaded hash list'
  9.  
  10. username = 'wmpdxxri'
  11. password = 'U54DKYFi22O5geZQ-sDUKIatP1JvNN_N'
  12. host = 'orangutan.rmq.cloudamqp.com'
  13. vhost = username
  14.  
  15. exchange='ie3x'
  16.  
  17. creds = pika.PlainCredentials(username, password)
  18. params = pika.ConnectionParameters(credentials=creds, host=host,
  19. virtual_host = vhost)
  20.  
  21. conn = pika.BlockingConnection(params)
  22.  
  23. channel = conn.channel()
  24. channel.exchange_declare(exchange='ie3x', type='topic')
  25.  
  26.  
  27. pattern = 'IEEE?Xtreme'
  28. def callback(ch, method, properties, body):
  29. global hash_list, pattern
  30. # print body
  31. msg = json.loads(body)
  32.  
  33. if msg['event'] == 'password':
  34. print 'New password message with %d passwords' % len(msg['passwords'])
  35. print '%s-%s' % (msg['passwords'][0], msg['passwords'][-1])
  36. for password in msg['passwords']:
  37. hash = hashlib.sha256(pattern.replace('?', password)).hexdigest()
  38. if hash in hash_list:
  39. print 'Password MATCH %s:%s' % (password, hash)
  40. match_msg = {'event': 'match', 'hash': hash, 'password': password}
  41. channel.basic_publish(exchange='ie3x', routing_key='match', body=json.dumps(match_msg))
  42. ch.basic_ack(delivery_tag=method.delivery_tag)
  43.  
  44. channel.queue_declare(queue='ie3x_worker')
  45. channel.queue_bind(queue='ie3x_worker', exchange='ie3x', routing_key='password')
  46.  
  47. channel.basic_qos(prefetch_count=1)
  48. channel.basic_consume(callback, queue='ie3x_worker')
  49.  
  50. print 'Waiting for messages...'
  51. channel.start_consuming()
Add Comment
Please, Sign In to add comment