Exemplo n.º 1
0
            user["TeamSubnet"] = "fd00:1337:" + str(user["Id"]) + "::"

        return users
    elif style == "scoreboard":
        print("scoreboard style")
        c.execute(
            "SELECT users.id, users.team_name, users.username, users.university, countries.code as country_code, countries.name as country_name, images.data as logo_b64 FROM users JOIN countries ON countries.code = users.country LEFT JOIN images on images.user_id = users.id;"
        )
        users = c.fetchall()

        for user in users:
            user["team_subnet"] = "fd00:1337:" + str(user["id"]) + "::"
            if user["logo_b64"] is not None:
                user["logo_b64"] = (base64.b64encode(
                    user["logo_b64"])).decode('utf-8')

        return users

    print("you have no style")
    return []


parser = argparse.ArgumentParser()
parser.add_argument(
    "style", help="select your json style - \"gameengine\" | \"scoreboard\"")
args = parser.parse_args()
print("exporting teams to teams.json ")
f = open("teams.json", "w")
f.write(json.dumps({"Teams": get_users(args.style)}, indent=2, sort_keys=True))
f.close()
print("exporting teams done!")
Exemplo n.º 2
0
import requests
import argparse
from configparser import ConfigParser
from pprint import pprint

## API Configuration Data
## Parses .mxtbx file for API Key
parser = ConfigParser()
parser.read('.mxtbx')
API_KEY = parser.get('mxtbx', 'key')
API_URL = 'https://api.mxtoolbox.com/api/v1'

parser = argparse.ArgumentParser()
parser.add_argument('-l',
                    '--list',
                    nargs='+',
                    type=str,
                    help='IP Address or Addressees space sparated',
                    required=True)
args = parser.parse_args()
ips = args.list


def get_blacklist_results(ip):
    '''
    Utilizes the MXToolBox API to do a Blacklist lookup on the supplied ip
    address.

    Args:
        ip (str): IP address to perform blacklist check on.

    Returns:
Exemplo n.º 3
0
    def clone_parser_hook(self,
                          clone_parser: configparser.ConfigParser) -> None:
        """Add reference_tests_dir argument to parser.

        Args:
            clone_parser: The ``clone`` subparser.
        """
        clone_parser.add_argument(
            "--junit4-reference-tests-dir",
            help="Path to a directory with reference tests.",
            type=str,
            dest="junit4_reference_tests_dir",
            required=not self._reference_tests_dir,
        )

        clone_parser.add_argument(
            "--junit4-ignore-tests",
            help="Names of test classes to ignore.",
            type=str,
            dest="junit4_ignore_tests",
            nargs="+",
        )

        clone_parser.add_argument(
            "--junit4-hamcrest-path",
            help="Absolute path to the `{}` library.".format(
                _junit4_runner.HAMCREST_JAR),
            type=str,
            dest="junit4_hamcrest_path",
            # required if not picked up in config_hook nor on classpath
            required=not self._hamcrest_path
            and _junit4_runner.HAMCREST_JAR not in self._classpath,
        )

        clone_parser.add_argument(
            "--junit4-junit-path",
            help="Absolute path to the `{}` library.".format(
                _junit4_runner.JUNIT_JAR),
            type=str,
            dest="junit4_junit_path",
            # required if not picked up in config_hook nor on classpath
            required=not self._junit_path
            and _junit4_runner.JUNIT_JAR not in self._classpath,
        )

        clone_parser.add_argument(
            "--junit4-disable-security",
            help=("Disable the default security policy (student code can do "
                  "whatever)."),
            dest="junit4_disable_security",
            action="store_true",
        )

        verbosity = clone_parser.add_mutually_exclusive_group()
        verbosity.add_argument(
            "--junit4-verbose",
            help="Display more information about test failures.",
            dest="junit4_verbose",
            action="store_true",
        )
        verbosity.add_argument(
            "--junit4-very-verbose",
            help="Display the full failure output, without truncating.",
            dest="junit4_very_verbose",
            action="store_true",
        )

        clone_parser.add_argument(
            "--junit4-run-student-tests",
            help="Run test classes found in the student repos instead of "
            "those from the reference tests directory. Only tests that exist "
            "in the reference tests directory will be searched for.",
            dest="junit4_run_student_tests",
            action="store_true",
        )

        clone_parser.add_argument(
            "--junit4-timeout",
            help="Maximum amount of seconds a test class is allowed to run "
            "before timing out.",
            dest="junit4_timeout",
            type=int,
            default=self._timeout,
        )