import requests
import time
import random
from termcolor import cprint
import subprocess
import os.path
from random_user_agent.user_agent import UserAgent
from random_user_agent.params import SoftwareName, OperatingSystem


def create_UA():
    # you can also import SoftwareEngine, HardwareType, SoftwareType, Popularity from random_user_agent.params
    # you can also set number of user agents required by providing `limit` as parameter

	software_names = [SoftwareName.CHROME.value]
	operating_systems = [OperatingSystem.WINDOWS.value, OperatingSystem.LINUX.value]   

	user_agent_rotator = UserAgent(software_names=software_names, operating_systems=operating_systems, limit=100)

    # Get list of user agents.
	user_agents = user_agent_rotator.get_user_agents()

    # Get Random User Agent String.
	user_agent = user_agent_rotator.get_random_user_agent()
	return user_agent



bitbin_links = ['https://bitbin.it/oWdpwcJv/','https://bitbin.it/eJXeQF01/', 'https://bitbin.it/UsyS2ZoP/', 'https://bitbin.it/PsyAs1rD/', 'https://bitbin.it/3Ma3AaP6/', 'https://bitbin.it/mUUkzivt/', 'https://bitbin.it/MLVNLWdU/', 'https://bitbin.it/z3sakMf5/', 'https://bitbin.it/nOmii302/']


proxy_site_list = ["https://eu1.proxysite.com/includes/process.php?action=update","https://eu2.proxysite.com/includes/process.php?action=update" ,"https://eu3.proxysite.com/includes/process.php?action=update" ,"https://eu4.proxysite.com/includes/process.php?action=update" ,"https://eu5.proxysite.com/includes/process.php?action=update" ,"https://eu6.proxysite.com/includes/process.php?action=update" ,"https://eu15.proxysite.com/includes/process.php?action=update" ,"https://eu15.proxysite.com/includes/process.php?action=update" ,"https://eu7.proxysite.com/includes/process.php?action=update" ,"https://eu8.proxysite.com/includes/process.php?action=update" ,"https://eu9.proxysite.com/includes/process.php?action=update" ,"https://eu10.proxysite.com/includes/process.php?action=update" ,"https://eu11.proxysite.com/includes/process.php?action=update" ,"https://eu12.proxysite.com/includes/process.php?action=update" ,"https://eu13.proxysite.com/includes/process.php?action=update" "https://eu14.proxysite.com/includes/process.php?action=update" "https://eu15.proxysite.com/includes/process.php?action=update" ,"https://eu16.proxysite.com/includes/process.php?action=update" ,"https://eu17.proxysite.com/includes/process.php?action=update" ,"https://eu18.proxysite.com/includes/process.php?action=update" ,"https://us1.proxysite.com/includes/process.php?action=update" ,"https://us2.proxysite.com/includes/process.php?action=update" ,"https://us3.proxysite.com/includes/process.php?action=update" ,"https://us4.proxysite.com/includes/process.php?action=update" ,"https://us5.proxysite.com/includes/process.php?action=update" ,"https://us6.proxysite.com/includes/process.php?action=update", "https://us7.proxysite.com/includes/process.php?action=update" ,"https://us8.proxysite.com/includes/process.php?action=update","https://us9.proxysite.com/includes/process.php?action=update" ,"https://us10.proxysite.com/includes/process.php?action=update" ,"https://us11.proxysite.com/includes/process.php?action=update" ,"https://us12.proxysite.com/includes/process.php?action=update" ,"https://us13.proxysite.com/includes/process.php?action=update" ,"https://us14.proxysite.com/includes/process.php?action=update" ,"https://us15.proxysite.com/includes/process.php?action=update" ,"https://us16.proxysite.com/includes/process.php?action=update" ,"https://us17.proxysite.com/includes/process.php?action=update" ,"https://us18.proxysite.com/includes/process.php?action=update" ,"https://us19.proxysite.com/includes/process.php?action=update" ,"https://us20.proxysite.com/includes/process.php?action=update" ]		

def create_hits():

#   change_mac()
#this function generates traffic upon proxy list above
# Get a copy of the default headers that requests would use
    headers = requests.utils.default_headers()

# Update the headers with your custom ones
# You don't have to worry about case-sensitivity with
# the dictionary keys, because default_headers uses a custom
# CaseInsensitiveDict implementation within requests' source code.
    
    new_ua = create_UA()
    

    #headers.update(
      #  {
      #  'User-Agent': '{}'.format(new_ua),
      #  }
  #  )

 
    url = random.choice(proxy_site_list)
    cprint(f"the current used url is: {url}\n", "red","on_white")
    bitbin = random.choice(bitbin_links)
    cprint(f"the current bitbin link is: {bitbin}\n","green","on_white")
    headers = {'User_agent': '{}'.format(new_ua)}
    cprint("current user agent is: {}\n".format(new_ua),"blue", "on_white")
    data = {'update':'{}'.format(bitbin)}
    x = requests.post(url, json=data, headers=headers)
    if x:
        #subprocess.run(["figlet","hit done!"])
    time.sleep(random.randint(1,4))
		    
def main():
    subprocess.run(["reset"])
    subprocess.run(["clear"])
    z = input("enter how many hits do u need: ")
    for i in range(int(z)):
        create_hits()
		    

main()