Example #1
0
def main():
    # parse arguments
    parser = argparse.ArgumentParser()
    choices = [
        "NBA", "NFL", "CFB", "PGAMain", "PGAWeekend", "PGAShowdown", "NHL",
        "MLB", "TEN"
    ]
    parser.add_argument("-i",
                        "--id",
                        type=int,
                        required=True,
                        help="Contest ID from DraftKings")
    parser.add_argument("-c", "--csv", help="Slate CSV from DraftKings")
    parser.add_argument(
        "-s",
        "--sport",
        choices=choices,
        required=True,
        help=
        "Type of contest (NBA, NFL, PGAMain, PGAWeekend, PGAShowdown, CFB, NHL, or MLB)",
    )
    parser.add_argument("-v", "--verbose", help="Increase verbosity")
    args = parser.parse_args()

    now = datetime.datetime.now(timezone("US/Eastern"))

    if args.csv:
        fn = args.csv
    else:
        fn = f"DKSalaries_{args.sport}_{now:%A}.csv"

    logger.debug(args)

    # pull contest standings from draftkings
    contest_list = pull_contest_zip(args.id)

    sheet = DFSSheet(args.sport)

    logger.debug(
        f"Creating Results object Results({args.sport}, {args.id}, {args.csv})"
    )
    r = Results(args.sport, args.id, args.csv)
    z = r.players_to_values()
    sheet.write_players(z)
    logger.info("Writing players to sheet")
    sheet.add_last_updated(now)

    if r.vip_list:
        logger.info("Writing vip_lineups to sheet")
        sheet.write_vip_lineups(r.vip_list)

    for u in r.vip_list:
        # logger.info("User: {}".format(u.name))
        logger.info("User: {}".format(u))
Example #2
0
    def __init__(self, args):

        self.options = {
            'url': args.url,
            'prefix': '',
            'user_agent': args.user_agent,
            'proxy': args.proxy,
            'verbosity': args.verbosity,
            'threads': 10,
            'chunk_size': 10,  # same as threads
            'run_all': args.run_all,
            'match_all': args.match_all,
            'stop_after': args.stop_after,
            'no_cache_load': args.no_cache_load,
            'no_cache_save': args.no_cache_save,
        }

        self.data = {
            'cache': Cache(),
            'results': Results(self.options),
            'fingerprints': Fingerprints(),
            'matcher': Match(),
            'colorizer': Color(),
            'printer': Printer(args.verbosity, Color()),
            'detected_cms': set(),
            'error_pages': set(),
            'queue': queue.Queue(),
            'requested': queue.Queue()
        }

        self.data['results'].set_printer(self.data['printer'])
        self.data['requester'] = Requester(self.options, self.data)
Example #3
0
    def __init__(self, host, profile, verbose, desperate):
        self.plugins = self.load_plugins()
        self.host = host
        self.results = Results()
        self.cache = Cache()
        self.profile = Profile(profile)
        self.colorizer = Color()
        self.logs = Log()
        self.verbose = verbose

        self.check_url()
        self.redirect()
        self.cache.set_host(self.host)

        if desperate:
            self.desperate = Desperate()
        else:
            self.desperate = None
Example #4
0
File: wig.py Project: xstpl/wig
    def __init__(self, args):
        urls = None
        if args.input_file is not None:
            args.quiet = True

            with open(args.input_file, 'r') as input_file:
                urls = []
                for url in input_file.readlines():
                    url = url.strip()
                    urls.append(url if '://' in url else 'http://' + url)

        else:
            args.url = args.url.lower()
            if '://' not in args.url:
                args.url = 'http://' + args.url

        text_printer = Printer(args.verbosity)
        cache = Cache()
        cache.printer = text_printer

        self.options = {
            'url': args.url,
            'urls': urls,
            'quiet': args.quiet,
            'prefix': '',
            'user_agent': args.user_agent,
            'proxy': args.proxy,
            'verbosity': args.verbosity,
            'threads': 10,
            'batch_size': 20,
            'run_all': args.run_all,
            'match_all': args.match_all,
            'stop_after': args.stop_after,
            'no_cache_load': args.no_cache_load,
            'no_cache_save': args.no_cache_save,
            'write_file': args.output_file,
            'subdomains': args.subdomains
        }

        self.data = {
            'cache': cache,
            'results': Results(self.options),
            'fingerprints': Fingerprints(),
            'matcher': Match(),
            'printer': text_printer,
            'detected_cms': set(),
            'error_pages': set(),
            'requested': queue.Queue()
        }

        if self.options['write_file'] is not None:
            self.json_outputter = OutputJSON(self.options, self.data)

        self.data['printer'].print_logo()

        self.results = None
Example #5
0
	def __init__(self, host, profile, verbose):
		self.plugins = self.load_plugins()
		self.host = host
		self.results = Results()
		self.cache = Cache()
		self.profile = Profile(profile)
		self.check_url()
		self.redirect()
		self.colorizer = Color()
		self.logs = Log()
		self.verbose = verbose
Example #6
0
File: wig.py Project: r00tb0x/wig
    def __init__(self, args):

        urls = None
        interactive = True

        if args.input_file is not None:
            interactive = False

            with open(args.input_file, 'r') as input_file:
                urls = []
                for url in input_file.readlines():
                    u = url.strip()
                    urls.append(u if '://' in u else 'http://' + u)

        elif '://' not in args.url:
            args.url = 'http://' + args.url

        self.options = {
            'url': args.url,
            'urls': urls,
            'interactive': interactive,
            'prefix': '',
            'user_agent': args.user_agent,
            'proxy': args.proxy,
            'verbosity': args.verbosity,
            'threads': 10,
            'batch_size': 20,
            'run_all': args.run_all,
            'match_all': args.match_all,
            'stop_after': args.stop_after,
            'no_cache_load': args.no_cache_load,
            'no_cache_save': args.no_cache_save,
            'write_file': args.output_file
        }

        self.data = {
            'cache': Cache(),
            'results': Results(self.options),
            'fingerprints': Fingerprints(),
            'matcher': Match(),
            'colorizer': Color(),
            'printer': Printer(args.verbosity, Color()),
            'detected_cms': set(),
            'error_pages': set(),
            'requested': queue.Queue()
        }

        if self.options['write_file'] is not None:
            self.json_outputter = OutputJSON(self.options, self.data)
Example #7
0
File: wig.py Project: kylinpoet/wig
	def __init__(self, host, profile, verbose, desperate):
		self.plugins = self.load_plugins()
		self.host = host
		self.results = Results()
		self.cache = Cache()		
		self.profile = Profile(profile)
		self.colorizer = Color()
		self.logs = Log()
		self.verbose = verbose

		self.check_url()
		self.redirect()
		self.cache.set_host(self.host)

		if desperate:
			self.desperate = Desperate()
		else:
			self.desperate = None
Example #8
0
File: wig.py Project: xstpl/wig
 def reset(self):
     self.data['results'] = Results(self.options)
     self.data['cache'] = Cache()
Example #9
0
class Wig():

	def __init__(self, host, profile, verbose, desperate, plugin_name=None):
		self.plugins = self.load_plugins()
		self.host = host
		self.results = Results()
		self.cache = Cache()		
		self.profile = Profile(profile)
		self.colorizer = Color()
		self.logs = Log()
		self.verbose = verbose
		self.plugin_name = plugin_name

		self.check_url()
		self.redirect()
		self.cache.set_host(self.host)

		if desperate:
			self.desperate = Desperate()
		else:
			self.desperate = None


	def redirect(self):
		# detects redirection if this happend
		try:
			r = requests.get(self.host, verify=False)
		except:
			print("Invalid URL or host not found. Exiting...")
			sys.exit(0)

		if not r.url == self.host:

			# ensure that sub-folders and files are removed
			parts = r.url.split('//')
			http, url = parts[0:2]

			# remove subfolders and/or files
			# http://example.com/test -> http://example.com/
			if '/' in url:
				redirected = http + '//' + url.split('/')[0] + '/'
			else:
				redirected = http + '//' + url + '/'

			self.host = redirected

	
	def check_url(self):
		# adds http:// to input if not present
		if not self.host.startswith("http"):
			self.host = "http://" + self.host


	def load_plugins(self):
		# load all the plugins listed in plugins/__init__.py
		all_plugins = []
		for p in plugins.__all__:
			plugin_path = "plugins." + p
			__import__(plugin_path)
			all_plugins.append(sys.modules[plugin_path])

		return all_plugins


	def run(self):
		t = time.time()
		num_fps = 0
		num_plugins = 0
		# loops over all the plugins loaded
		for plugin in self.plugins:

			# a loaded plugin might have more than one plugin, so 'ps' is a list
			ps = plugin.get_instances(self.host, self.cache, self.results)
			num_plugins += len(ps)
			for p in ps:

				# give a status of which plugin is run
				print(p.name, end="                                                \r")
				sys.stdout.flush()

				# applies the choosen profile by removing fingerprints from the 
				# fingerprint set if these do not match the choosen profile
				p.set_profile(self.profile, self.plugin_name)

				# the main plugin method
				p.run()
				num_fps += p.get_num_fps()

				# check if running desperate mode.
				if self.desperate:
					# add the plugins fingerprints to the global fingerprint database
					self.desperate.add_fingerprints(p.get_items_for_desperate_mode())


				# add logs
				self.logs.add( p.get_logs() )


		if self.desperate:
			self.desperate.set_cache(self.cache)
			self.desperate.run()
			for i in self.desperate.get_matches():
				self.results.add('Desperate', i['cms'], i, i['count'])

		# check the response headers for information
		ch = CheckHeaders(self.cache, self.results, self.logs)
		ch.run()

		run_time = "%.1f" % (time.time() - t)
		num_urls = self.cache.get_num_urls()

		status = "Time: %s sec | Plugins: %s | Urls: %s | Fingerprints: %s" % (run_time, num_plugins, num_urls, num_fps)
		bar = "_"*len(status)
		self.results.set_width(len(status))

		print(self.results)
		print(bar)
		print(status + "\n")

		if self.verbose:
			print(bar)
			print(self.logs)
Example #10
0
class Wig():
    def __init__(self, host, profile, verbose, desperate, plugin_name=None):
        self.plugins = self.load_plugins()
        self.host = host
        self.results = Results()
        self.cache = Cache()
        self.profile = Profile(profile)
        self.colorizer = Color()
        self.logs = Log()
        self.verbose = verbose
        self.plugin_name = plugin_name

        self.check_url()
        self.redirect()
        self.cache.set_host(self.host)

        if desperate:
            self.desperate = Desperate()
        else:
            self.desperate = None

    def redirect(self):
        # detects redirection if this happend
        try:
            r = requests.get(self.host, verify=False)
        except:
            print("Invalid URL or host not found. Exiting...")
            sys.exit(0)

        if not r.url == self.host:

            # ensure that sub-folders and files are removed
            parts = r.url.split('//')
            http, url = parts[0:2]

            # remove subfolders and/or files
            # http://example.com/test -> http://example.com/
            if '/' in url:
                redirected = http + '//' + url.split('/')[0] + '/'
            else:
                redirected = http + '//' + url + '/'

            self.host = redirected

    def check_url(self):
        # adds http:// to input if not present
        if not self.host.startswith("http"):
            self.host = "http://" + self.host

    def load_plugins(self):
        # load all the plugins listed in plugins/__init__.py
        all_plugins = []
        for p in plugins.__all__:
            plugin_path = "plugins." + p
            __import__(plugin_path)
            all_plugins.append(sys.modules[plugin_path])

        return all_plugins

    def run(self):
        t = time.time()
        num_fps = 0
        num_plugins = 0
        # loops over all the plugins loaded
        for plugin in self.plugins:

            # a loaded plugin might have more than one plugin, so 'ps' is a list
            ps = plugin.get_instances(self.host, self.cache, self.results)
            num_plugins += len(ps)
            for p in ps:

                # give a status of which plugin is run
                print(p.name,
                      end="                                                \r")
                sys.stdout.flush()

                # applies the choosen profile by removing fingerprints from the
                # fingerprint set if these do not match the choosen profile
                p.set_profile(self.profile, self.plugin_name)

                # the main plugin method
                p.run()
                num_fps += p.get_num_fps()

                # check if running desperate mode.
                if self.desperate:
                    # add the plugins fingerprints to the global fingerprint database
                    self.desperate.add_fingerprints(
                        p.get_items_for_desperate_mode())

                # add logs
                self.logs.add(p.get_logs())

        if self.desperate:
            self.desperate.set_cache(self.cache)
            self.desperate.run()
            for i in self.desperate.get_matches():
                self.results.add('Desperate', i['cms'], i, i['count'])

        # check the response headers for information
        ch = CheckHeaders(self.cache, self.results, self.logs)
        ch.run()

        run_time = "%.1f" % (time.time() - t)
        num_urls = self.cache.get_num_urls()

        status = "Time: %s sec | Plugins: %s | Urls: %s | Fingerprints: %s" % (
            run_time, num_plugins, num_urls, num_fps)
        bar = "_" * len(status)
        self.results.set_width(len(status))

        print(self.results)
        print(bar)
        print(status + "\n")

        if self.verbose:
            print(bar)
            print(self.logs)
Example #11
0
class Wig():

	def __init__(self, host, profile, verbose):
		self.plugins = self.load_plugins()
		self.host = host
		self.results = Results()
		self.cache = Cache()
		self.profile = Profile(profile)
		self.check_url()
		self.redirect()
		self.colorizer = Color()
		self.logs = Log()
		self.verbose = verbose


	def redirect(self):
		# detects redirection if this happend
		r = requests.get(self.host, verify=False)
		if not r.url == self.host:

			# ensure that sub-folders and files are removed
			parts = r.url.split('//')
			http, url = parts[0:2]

			# remove subfolders and/or files
			# http://example.com/test -> http://example.com/
			if '/' in url:
				redirected = http + '//' + url.split('/')[0] + '/'
			else:
				redirected = http + '//' + url + '/'

			self.host = redirected

	
	def check_url(self):
		# adds http:// to input if not present
		if not self.host.startswith("http"):
			self.host = "http://" + self.host


	def load_plugins(self):
		# load all the plugins listed in plugins/__init__.py
		all_plugins = []
		for p in plugins.__all__:
			plugin_path = "plugins." + p
			__import__(plugin_path)
			all_plugins.append(sys.modules[plugin_path])

		return all_plugins


	def run(self):
		t = time.time()
		num_fps = 0
		num_plugins = 0
		# loops over all the plugins loaded
		for plugin in self.plugins:

			# a loaded plugin might have more than one plugin, so 'ps' is a list
			ps = plugin.get_instances(self.host, self.cache, self.results)
			num_plugins += len(ps)
			for p in ps:

				# give a status of which plugin is run
				print(p.name, end="                                                \r")
				sys.stdout.flush()

				# applies the choosen profile by removing fingerprints from the 
				# fingerprint set if these do not match the choosen profile
				p.set_profile(self.profile)

				# the main plugin method
				p.run()
				num_fps += p.get_num_fps()

				# add logs
				self.logs.add( p.get_logs() )


		run_time = "%.1f" % (time.time() - t)
		num_urls = self.cache.get_num_urls()

		status = "Time: %s sec | Plugins: %s | Urls: %s | Fingerprints: %s" % (run_time, num_plugins, num_urls, num_fps)
		bar = "_"*len(status)
		self.results.set_width(len(status))

		print(self.results)
		print(bar)
		print(status + "\n")

		if self.verbose:
			print(bar)
			print(self.logs)