Exemple #1
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)
Exemple #2
0
Fichier : wig.py Projet : 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
Exemple #3
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))
Exemple #4
0
    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)
Exemple #5
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
Exemple #6
0
Fichier : wig.py Projet : xstpl/wig
 def reset(self):
     self.data['results'] = Results(self.options)
     self.data['cache'] = Cache()