Beispiel #1
0
 def _set_http_profile_default_profile(self):
     default_profile = '/Common/http'
     result = self._http_profile.get_default_profile([self.PROFILE_NAME])
     #TODO(retr0h): Pycontrol indicates a new http profile's parent
     # is 'http'.  However, `tmsh list /ltm profile http` doesn't seem
     # to agree.
     #
     #  ltm profile http test-pycontrol {
     #      app-service none
     #      insert-xforwarded-for enabled
     #  }
     #
     # Expected:
     #
     #  ltm profile http test-pycontrol {
     #      app-service none
     #      defaults-from http
     #      insert-xforwarded-for enabled
     #  }
     #
     if result[0] == default_profile:
         msg = '  - already has default profile'
         utils.print_yellow(msg)
     else:
         args_dict = {
             'profile_names': [self.PROFILE_NAME],
             'defaults': [default_profile]
         }
         self._http_profile.set_default_profile(**args_dict)
         msg = '  - added default profile'
         utils.print_green(msg)
Beispiel #2
0
 def _set_http_profile_default_profile(self):
     default_profile = '/Common/http'
     result = self._http_profile.get_default_profile([self.PROFILE_NAME])
     #TODO(retr0h): Pycontrol indicates a new http profile's parent
     # is 'http'.  However, `tmsh list /ltm profile http` doesn't seem
     # to agree.
     #
     #  ltm profile http test-pycontrol {
     #      app-service none
     #      insert-xforwarded-for enabled
     #  }
     #
     # Expected:
     #
     #  ltm profile http test-pycontrol {
     #      app-service none
     #      defaults-from http
     #      insert-xforwarded-for enabled
     #  }
     #
     if result[0] == default_profile:
         msg = '  - already has default profile'
         utils.print_yellow(msg)
     else:
         args_dict = {'profile_names': [self.PROFILE_NAME],
                      'defaults': [default_profile]}
         self._http_profile.set_default_profile(**args_dict)
         msg = '  - added default profile'
         utils.print_green(msg)
Beispiel #3
0
    def enter_rest_room(self):
        while 1:
            self.sem_queue.acquire()
            if self.queue.qsize() > 0:
                p = self.queue.get()
                self.sem_queue.release()
                self.sem_mutex.acquire()
                if self.gender_bathroom == p[0]:
                    self.sem_mutex.release()
                    self.sem_bathroom.acquire()
                    t1 = threading.Thread(target=self.out_box, args=(p, ))
                    t1.start()
                else:
                    print_yellow('|WAIT|>  Waiting for other same-sex person')
                    while self.count_bathroom > 0:
                        self.sem_mutex.release()
                        self.sem_mutex.acquire()
                    self.sem_mutex.release()
                    self.sem_bathroom.acquire()
                    self.gender_bathroom = p[0]
                    if self.queue_time.qsize() > 0:
                        t = self.queue_time.get()
                        t2 = threading.Thread(target=self.out_box, args=(p, t))
                        t2.start()
                    else:
                        t2 = threading.Thread(target=self.out_box, args=(p, ))
                        t2.start()

            else:
                self.sem_queue.release()
Beispiel #4
0
def run_boot(build):
    cbl_arch = get_cbl_name()
    kernel_image = cwd() + "/" + get_image_name()
    boot_qemu = [
        "./boot-utils/boot-qemu.sh", "-a", cbl_arch, "-k", kernel_image
    ]
    # If we are running a sanitizer build, we should increase the number of
    # cores and timeout because booting is much slower
    if "CONFIG_KASAN=y" in build["kconfig"] or \
       "CONFIG_KCSAN=y" in build["kconfig"] or \
       "CONFIG_UBSAN=y" in build["kconfig"]:
        boot_qemu += ["-s", "4"]
        if "CONFIG_KASAN=y" in build["kconfig"]:
            boot_qemu += ["-t", "20m"]
        else:
            boot_qemu += ["-t", "10m"]
        if "CONFIG_KASAN_KUNIT_TEST=y" in build["kconfig"] or \
           "CONFIG_KCSAN_KUNIT_TEST=y" in build["kconfig"]:
            print_yellow(
                "Disabling Oops problem matcher under Sanitizer KUnit build")
            print("::remove-matcher owner=linux-kernel-oopses")

    # Before spawning a process with potentially different IO buffering,
    # flush the existing buffers so output is ordered correctly.
    sys.stdout.flush()
    sys.stderr.flush()

    try:
        subprocess.run(boot_qemu, check=True)
    except subprocess.CalledProcessError as e:
        if e.returncode == 124:
            print_red("Image failed to boot")
        raise e
Beispiel #5
0
 def _create_http_profile(self):
     profiles = self._http_profile.get_list()
     if self.PROFILE_NAME in profiles:
         msg = '  - already exists'
         utils.print_yellow(msg)
     else:
         self._http_profile.create(profile_names=[self.PROFILE_NAME])
         msg = '  - created'
         utils.print_green(msg)
Beispiel #6
0
 def _create_http_profile(self):
     profiles = self._http_profile.get_list()
     if self.PROFILE_NAME in profiles:
         msg = '  - already exists'
         utils.print_yellow(msg)
     else:
         self._http_profile.create(profile_names=[self.PROFILE_NAME])
         msg = '  - created'
         utils.print_green(msg)
Beispiel #7
0
 def _set_snat_pool(self, name):
     result = self._virtual_server.get_snat_pool(virtual_servers=[name])
     if result[0] == self.SNAT_POOL:
         msg = '  - snat pool already exists for {0}'.format(name)
         utils.print_yellow(msg)
     else:
         self._virtual_server.set_snat_pool(virtual_servers=[name],
                                            snatpools=[self.SNAT_POOL])
         msg = '  - added snat pool for {0}'.format(name)
         utils.print_green(msg)
Beispiel #8
0
def boot_test(build):
    if build["result"] == "fail":
        print_red("fatal build errors encountered during build, skipping boot")
        sys.exit(1)
    if "BOOT" in os.environ and os.environ["BOOT"] == "0":
        print_yellow("boot test disabled via config, skipping boot")
        return
    fetch_kernel_image(build)
    fetch_dtb(build)
    run_boot(build)
Beispiel #9
0
 def _set_ntp_servers(self):
     inet = self._pc.System.Inet
     result = inet.get_ntp_server_address()
     if sorted(result) == sorted(self.NTP_SERVERS_LIST):
         msg = '  - already has ntp servers'
         utils.print_yellow(msg)
     else:
         inet \
             .set_ntp_server_address(ntp_addresses=self.NTP_SERVERS_LIST)
         msg = '  - added ntp servers'
         utils.print_green(msg)
Beispiel #10
0
 def _set_ntp_servers(self):
     inet = self._pc.System.Inet
     result = inet.get_ntp_server_address()
     if sorted(result) == sorted(self.NTP_SERVERS_LIST):
         msg = '  - already has ntp servers'
         utils.print_yellow(msg)
     else:
         inet \
             .set_ntp_server_address(ntp_addresses=self.NTP_SERVERS_LIST)
         msg = '  - added ntp servers'
         utils.print_green(msg)
Beispiel #11
0
def fetch_kernel_image(build):
    image_name = get_image_name()
    url = build["download_url"] + image_name
    print_yellow("fetching kernel image from: %s" % url)
    # TODO: use something more robust like python wget library.
    urllib.request.urlretrieve(url, image_name)
    # Suspect download is failing.
    if os.path.exists:
        print_yellow("Filesize: %d" % os.path.getsize(image_name))
    else:
        print_red("Unable to download kernel image")
        sys.exit(1)
Beispiel #12
0
 def _create_mysql_monitor(self):
     monitors = self._monitor.get_template_list()
     filtered = [monitor for monitor in monitors
                 if monitor.template_name == self.MONITOR_NAME]
     if filtered:
         msg = '  - mysql_monitor already exists'
         utils.print_yellow(msg)
     else:
         # TODO(retr0h): How to upload a custom monitor.  Once uploaded
         # can configure an external template.
         msg = '  - need to upload and configure mysql_monitor'
         utils.print_red(msg)
Beispiel #13
0
 def _create_rule_x_forwarded_protocol(self):
     rules = self._rule.get_list()
     if self.RULE_NAME in rules:
         msg = '  - already has x-forwarded-protocol rule'
         utils.print_yellow(msg)
     else:
         struct = 'LocalLB.Rule.RuleDefinition'
         ctx = self._rule.typefactory.create(struct)
         ctx.rule_name = self.RULE_NAME
         ctx.rule_definition = self.IRULE
         self._rule.create([ctx])
         msg = '  - created x-forwarded-protocol rule'
         utils.print_green(msg)
Beispiel #14
0
 def _set_time_zone(self):
     """
     TODO(retr0h): How to set the time zone.  Cannot find API docs on how
     to do this.  The current timezone can be obtained via:
       ``self._pc.System.SystemInfo.get_time_zone().time_zone``
     """
     system_info = self._pc.System.SystemInfo
     result = system_info.get_time_zone()
     if result.time_zone == 'UTC':
         msg = '  - already has UTC time'
         utils.print_yellow(msg)
     else:
         msg = '  - need to set device to UTC time'
         utils.print_red(msg)
Beispiel #15
0
 def _import_certificate_from_file(self, cert_name, cert_file):
     if self._get_certificate(cert_name):
         msg = '  - cert {0} already exists'.format(cert_name)
         utils.print_yellow(msg)
     else:
         with open(cert_file, 'r') as file:
             data = file.read()
             args_dict = {'mode': self.MANAGEMENT_MODE_TYPE,
                          'cert_ids': [cert_name],
                          'pem_data': [data],
                          'overwrite': False}
             self._key_cert.certificate_import_from_pem(**args_dict)
             msg = '  - added cert {0}'.format(cert_name)
             utils.print_green(msg)
Beispiel #16
0
 def _set_time_zone(self):
     """
     TODO(retr0h): How to set the time zone.  Cannot find API docs on how
     to do this.  The current timezone can be obtained via:
       ``self._pc.System.SystemInfo.get_time_zone().time_zone``
     """
     system_info = self._pc.System.SystemInfo
     result = system_info.get_time_zone()
     if result.time_zone == 'UTC':
         msg = '  - already has UTC time'
         utils.print_yellow(msg)
     else:
         msg = '  - need to set device to UTC time'
         utils.print_red(msg)
Beispiel #17
0
 def _create_mysql_monitor(self):
     monitors = self._monitor.get_template_list()
     filtered = [
         monitor for monitor in monitors
         if monitor.template_name == self.MONITOR_NAME
     ]
     if filtered:
         msg = '  - mysql_monitor already exists'
         utils.print_yellow(msg)
     else:
         # TODO(retr0h): How to upload a custom monitor.  Once uploaded
         # can configure an external template.
         msg = '  - need to upload and configure mysql_monitor'
         utils.print_red(msg)
Beispiel #18
0
 def _set_tcp_custom_keepalive(self):
     result = self._tcp_profile.get_keep_alive_interval([self.PROFILE_NAME])
     if result[0].value == self.KEEP_ALIVE_INTERVAL:
         msg = '  - already has custom keepalive'
         utils.print_yellow(msg)
     else:
         ctx = self._tcp_profile.typefactory.create('LocalLB.ProfileULong')
         ctx.value = self.KEEP_ALIVE_INTERVAL
         ctx.default_flag = False
         args_dict = {'profile_names': [self.PROFILE_NAME],
                      'intervals': [ctx]}
         self._tcp_profile.set_keep_alive_interval(**args_dict)
         msg = '  - added custom keepalive'
         utils.print_green(msg)
Beispiel #19
0
 def _set_tcp_custom_keepalive(self):
     result = self._tcp_profile.get_keep_alive_interval([self.PROFILE_NAME])
     if result[0].value == self.KEEP_ALIVE_INTERVAL:
         msg = '  - already has custom keepalive'
         utils.print_yellow(msg)
     else:
         ctx = self._tcp_profile.typefactory.create('LocalLB.ProfileULong')
         ctx.value = self.KEEP_ALIVE_INTERVAL
         ctx.default_flag = False
         args_dict = {
             'profile_names': [self.PROFILE_NAME],
             'intervals': [ctx]
         }
         self._tcp_profile.set_keep_alive_interval(**args_dict)
         msg = '  - added custom keepalive'
         utils.print_green(msg)
Beispiel #20
0
 def _set_http_profile_x_forward_for(self):
     result = self._http_profile \
                  .get_insert_xforwarded_for_header_mode([self.PROFILE_NAME])  # NOQA
     if result[0].value == self.INSERT_X_FORWARDED_FOR:
         msg = '  - already has x-forwarding'
         utils.print_yellow(msg)
     else:
         ctx = self._http_profile.typefactory \
                                 .create('LocalLB.ProfileProfileMode')
         ctx.value = self.INSERT_X_FORWARDED_FOR
         ctx.default_flag = False
         args_dict = {'profile_names': [self.PROFILE_NAME], 'modes': [ctx]}
         self._http_profile \
             .set_insert_xforwarded_for_header_mode(**args_dict)
         msg = '  - added x-forwarding'
         utils.print_green(msg)
Beispiel #21
0
 def _import_certificate_from_file(self, cert_name, cert_file):
     if self._get_certificate(cert_name):
         msg = '  - cert {0} already exists'.format(cert_name)
         utils.print_yellow(msg)
     else:
         with open(cert_file, 'r') as file:
             data = file.read()
             args_dict = {
                 'mode': self.MANAGEMENT_MODE_TYPE,
                 'cert_ids': [cert_name],
                 'pem_data': [data],
                 'overwrite': False
             }
             self._key_cert.certificate_import_from_pem(**args_dict)
             msg = '  - added cert {0}'.format(cert_name)
             utils.print_green(msg)
Beispiel #22
0
 def _set_http_profile_x_forward_for(self):
     result = self._http_profile \
                  .get_insert_xforwarded_for_header_mode([self.PROFILE_NAME])  # NOQA
     if result[0].value == self.INSERT_X_FORWARDED_FOR:
         msg = '  - already has x-forwarding'
         utils.print_yellow(msg)
     else:
         ctx = self._http_profile.typefactory \
                                 .create('LocalLB.ProfileProfileMode')
         ctx.value = self.INSERT_X_FORWARDED_FOR
         ctx.default_flag = False
         args_dict = {'profile_names': [self.PROFILE_NAME], 'modes': [ctx]}
         self._http_profile \
             .set_insert_xforwarded_for_header_mode(**args_dict)
         msg = '  - added x-forwarding'
         utils.print_green(msg)
Beispiel #23
0
 def _create_pool(self, pool, hosts, port):
     pools = self._pool.get_list()
     if pool in pools:
         msg = "  - {0} already exists".format(pool)
         utils.print_yellow(msg)
     else:
         # Odd, must create a sequence, even when the docs state othewise.
         # https://devcentral.f5.com/wiki/iControl.LocalLB__Pool__create_v2.ashx  # NOQA
         member_sequence = self._get_common_ip_port_definition_sequence()
         members = []
         for host in hosts:
             member = self._get_common_address_port(host, port)
             members.append(member)
         member_sequence.items = members
         self._pool.create_v2(pool_names=[pool], lb_methods=[self.LB_METHOD], members=[member_sequence])
         msg = "  - {0} created".format(pool)
         utils.print_green(msg)
Beispiel #24
0
    def _set_chain_file(self, profile):
        result = self._ssl_profile.get_chain_file([profile])
        cert_basename = '%s.crt' % cert.Cert.INTERMEDIATE_BUNDLE.split('/')[-1]
        re_cert = re.compile(r'%(cert_basename)s' % locals())
        if result[0].value and re_cert.search(result[0].value):
            msg = '  - {0} already has chain file'.format(profile)
            utils.print_yellow(msg)
        else:
            struct = 'LocalLB.ProfileString'
            ctx = self._ssl_profile.typefactory.create(struct)
            ctx.value = '%s.crt' % cert.Cert.INTERMEDIATE_BUNDLE
            ctx.default_flag = False

            self._ssl_profile.set_chain_file(profile_names=[profile],
                                             chains=[ctx])
            msg = '  - {0} added chain file'.format(profile)
            utils.print_green(msg)
Beispiel #25
0
    def _set_chain_file(self, profile):
        result = self._ssl_profile.get_chain_file([profile])
        cert_basename = '%s.crt' % cert.Cert.INTERMEDIATE_BUNDLE.split('/')[-1]
        re_cert = re.compile(r'%(cert_basename)s' % locals())
        if result[0].value and re_cert.search(result[0].value):
            msg = '  - {0} already has chain file'.format(profile)
            utils.print_yellow(msg)
        else:
            struct = 'LocalLB.ProfileString'
            ctx = self._ssl_profile.typefactory.create(struct)
            ctx.value = '%s.crt' % cert.Cert.INTERMEDIATE_BUNDLE
            ctx.default_flag = False

            self._ssl_profile.set_chain_file(profile_names=[profile],
                                             chains=[ctx])
            msg = '  - {0} added chain file'.format(profile)
            utils.print_green(msg)
Beispiel #26
0
def print_clang_info(build):
    # There is no point in printing the clang version information for anything
    # other than clang-nightly because the stable branches are very unlikely to
    # have regressions that require triage based on build date and revision
    # information
    if get_requested_llvm_version() != "clang-nightly":
        return

    metadata_file = "metadata.json"
    url = build["download_url"] + metadata_file
    _fetch(metadata_file, url, metadata_file)
    metadata_json = json.loads(open(metadata_file).read())
    print_yellow("Printing clang-nightly checkout date and hash")
    subprocess.run([
        "./parse-debian-clang.sh", "--print-info", "--version-string",
        metadata_json["compiler"]["version_full"]
    ])
Beispiel #27
0
def check_built_config(build):
    # Only check built configs if we have specific CONFIGs requested.
    custom = False
    for config in build["kconfig"]:
        if 'CONFIG' in config:
            custom = True
    if not custom:
        return

    fetch_built_config(build)
    # Build dictionary of CONFIG_NAME: y/m/n ("is not set" translates to 'n').
    configs = dict()
    for line in open(".config"):
        line = line.strip()
        if len(line) == 0:
            continue

        name = None
        state = None
        if '=' in line:
            name, state = line.split('=', 1)
        elif line.startswith("# CONFIG_"):
            name, state = line.split(" ", 2)[1:]
            if state != "is not set":
                print_yellow("Could not parse '%s' from .config line '%s'!?" %
                             (name, line))
            state = 'n'
        elif not line.startswith("#"):
            print_yellow("Could not parse .config line '%s'!?" % (line))
        configs[name] = state

    # Compare requested configs against the loaded dictionary.
    fail = False
    for config in build["kconfig"]:
        if not 'CONFIG' in config:
            continue
        name, state = config.split('=')
        # If a config is missing from the dictionary, it is considered 'n'.
        if state != configs.get(name, 'n'):
            print_red("FAIL: %s not found in .config!" % (config))
            fail = True
        else:
            print("ok: %s=%s" % (name, state))
    if fail:
        sys.exit(1)
Beispiel #28
0
 def _create_pool(self, pool, hosts, port):
     pools = self._pool.get_list()
     if pool in pools:
         msg = '  - {0} already exists'.format(pool)
         utils.print_yellow(msg)
     else:
         # Odd, must create a sequence, even when the docs state othewise.
         # https://devcentral.f5.com/wiki/iControl.LocalLB__Pool__create_v2.ashx  # NOQA
         member_sequence = self._get_common_ip_port_definition_sequence()
         members = []
         for host in hosts:
             member = self._get_common_address_port(host, port)
             members.append(member)
         member_sequence.items = members
         self._pool.create_v2(pool_names=[pool],
                              lb_methods=[self.LB_METHOD],
                              members=[member_sequence])
         msg = '  - {0} created'.format(pool)
         utils.print_green(msg)
Beispiel #29
0
def fetch_dtb(build):
    config = os.environ["CONFIG"]
    if config != "multi_v5_defconfig" and config != "aspeed_g5_defconfig":
        return
    dtb = {
        "multi_v5_defconfig": "aspeed-bmc-opp-palmetto.dtb",
        "aspeed_g5_defconfig": "aspeed-bmc-opp-romulus.dtb",
    }[config]
    dtb_path = "dtbs/" + dtb
    url = build["download_url"] + dtb_path
    # mkdir -p
    os.makedirs(dtb_path.split("/")[0], exist_ok=True)
    print_yellow("fetching DTB from: %s" % url)
    urllib.request.urlretrieve(url, dtb_path)
    if os.path.exists:
        print_yellow("Filesize: %d" % os.path.getsize(dtb_path))
    else:
        print_red("Unable to download dtb")
        sys.exit(1)
Beispiel #30
0
def _fetch(title, url, dest):
    current_time = time.strftime("%H:%M:%S", time.localtime())
    print_yellow("%s: fetching %s from: %s" % (current_time, title, url))
    # TODO: use something more robust like python wget library.
    retries = 0
    max_retries = 7
    retry_codes = [404, 500, 504]
    while retries < max_retries:
        try:
            if retries:
                time.sleep(2**retries)
            retries += 1
            urllib.request.urlretrieve(url, dest)
            break
        except ConnectionResetError as err:
            print_yellow('%s download error ("%s"), retrying...' %
                         (title, str(err)))
            pass
        except urllib.error.HTTPError as err:
            if err.code in retry_codes:
                print_yellow("%s download error (%d), retrying..." %
                             (title, err.code))
                pass
            else:
                print_red("%d error trying to download %s" % (err.code, title))
                sys.exit(1)
        except urllib.error.URLError as err:
            print_yellow('%s download error ("%s"), retrying...' %
                         (title, str(err)))
            pass

    if retries == max_retries:
        print_red("Unable to download %s after %d tries" %
                  (title, max_retries))
        sys.exit(1)

    if os.path.exists(dest):
        print_yellow("Filesize: %d" % os.path.getsize(dest))
    else:
        print_red("Unable to download %s" % (title))
        sys.exit(1)
Beispiel #31
0
    def _create_virtual_server(self, name, vip_dict):
        virtual_servers = self._virtual_server.get_list()
        domain = vip_dict['dns']
        if name in virtual_servers:
            msg = '  - {0} already exists'.format(name)
            utils.print_yellow(msg)
        else:
            vss = self._get_virtual_server_definition(name,
                                                      vip_dict['ip'],
                                                      vip_dict['front_port'],
                                                      self.PROTOCOL_TYPE)
            pool = utils.pool_name(domain, vip_dict['back_port'])
            vsrs = self._get_virtual_server_resource(pool)
            vsps = self._get_virtual_server_profile(vip_dict['monitor'],
                                                    domain)

            self._virtual_server.create(definitions=vss,
                                        wildmasks=[self.WILDMASKS],
                                        resources=vsrs,
                                        profiles=[vsps])
            msg = '  - {0} created'.format(name)
            utils.print_green(msg)
Beispiel #32
0
    def _set_monitor(self, pool, monitor):
        result = self._pool.get_monitor_association([pool])
        templates = result[0].monitor_rule.monitor_templates
        if monitor in templates:
            msg = "  - monitor {0} already exists for {1}".format(monitor, pool)
            utils.print_yellow(msg)
        else:
            struct = "LocalLB.MonitorRule"
            monitor_rule = self._pool.typefactory.create(struct)
            monitor_rule.type = self.MONITOR_RULE_TYPE
            monitor_rule.quorum = self.MONITOR_RULE_QUORUM
            monitor_rule.monitor_templates = [monitor]

            struct = "LocalLB.Pool.MonitorAssociation"
            monitor_assoc = self._pool.typefactory.create(struct)
            monitor_assoc.pool_name = pool
            monitor_assoc.monitor_rule = monitor_rule

            args_dict = {"monitor_associations": [monitor_assoc]}
            self._pool.set_monitor_association(**args_dict)
            msg = "  - monitor {0} created for {1}".format(monitor, pool)
            utils.print_green(msg)
Beispiel #33
0
    def _create_ssl_profile(self, profile, key_profile, cert_profile):
        profiles = self._ssl_profile.get_list()

        if profile in profiles:
            msg = '  - {0} already exists'.format(profile)
            utils.print_yellow(msg)
        else:
            struct = 'LocalLB.ProfileString'
            key_ctx = self._ssl_profile.typefactory.create(struct)
            key_ctx.value = key_profile
            key_ctx.default_flag = False

            struct = 'LocalLB.ProfileString'
            cert_ctx = self._ssl_profile.typefactory.create(struct)
            cert_ctx.value = cert_profile
            cert_ctx.default_flag = False

            #TODO(retr0h): Could batch add all at once.
            self._ssl_profile.create_v2(profile_names=[profile],
                                        keys=[key_ctx],
                                        certs=[cert_ctx])
            msg = '  - {0} created'.format(profile)
            utils.print_green(msg)
Beispiel #34
0
    def _set_monitor(self, pool, monitor):
        result = self._pool.get_monitor_association([pool])
        templates = result[0].monitor_rule.monitor_templates
        if monitor in templates:
            msg = '  - monitor {0} already exists for {1}'.format(monitor,
                                                                  pool)
            utils.print_yellow(msg)
        else:
            struct = 'LocalLB.MonitorRule'
            monitor_rule = self._pool.typefactory.create(struct)
            monitor_rule.type = self.MONITOR_RULE_TYPE
            monitor_rule.quorum = self.MONITOR_RULE_QUORUM
            monitor_rule.monitor_templates = [monitor]

            struct = 'LocalLB.Pool.MonitorAssociation'
            monitor_assoc = self._pool.typefactory.create(struct)
            monitor_assoc.pool_name = pool
            monitor_assoc.monitor_rule = monitor_rule

            args_dict = {'monitor_associations': [monitor_assoc]}
            self._pool.set_monitor_association(**args_dict)
            msg = '  - monitor {0} created for {1}'.format(monitor, pool)
            utils.print_green(msg)
Beispiel #35
0
    def _create_ssl_profile(self, profile, key_profile, cert_profile):
        profiles = self._ssl_profile.get_list()

        if profile in profiles:
            msg = '  - {0} already exists'.format(profile)
            utils.print_yellow(msg)
        else:
            struct = 'LocalLB.ProfileString'
            key_ctx = self._ssl_profile.typefactory.create(struct)
            key_ctx.value = key_profile
            key_ctx.default_flag = False

            struct = 'LocalLB.ProfileString'
            cert_ctx = self._ssl_profile.typefactory.create(struct)
            cert_ctx.value = cert_profile
            cert_ctx.default_flag = False

            #TODO(retr0h): Could batch add all at once.
            self._ssl_profile.create_v2(profile_names=[profile],
                                        keys=[key_ctx],
                                        certs=[cert_ctx])
            msg = '  - {0} created'.format(profile)
            utils.print_green(msg)
Beispiel #36
0
def check_log(build):
    warnings_count = build["warnings_count"]
    errors_count = build["errors_count"]
    if warnings_count + errors_count > 0:
        print_yellow("%d warnings, %d errors" % (warnings_count, errors_count))
        fetch_logs(build)
Beispiel #37
0
def boot_test(build):
    if build["result"] == "fail":
        print_red("fatal build errors encountered during build, skipping boot")
        sys.exit(1)
    if "BOOT" in os.environ and os.environ["BOOT"] == "0":
        print_yellow("boot test disabled via config, skipping boot")
        return
    fetch_kernel_image(build)
    fetch_dtb(build)
    run_boot(build)


if __name__ == "__main__":
    missing = []
    for var in ["ARCH", "CONFIG", "LLVM_VERSION"]:
        if not var in os.environ:
            missing.append(var)
    if len(missing):
        for var in missing:
            print_red("$%s must be specified" % var)
        show_builds()
        sys.exit(1)
    build = verify_build()
    print_yellow("Register clang error/warning problem matchers")
    for problem_matcher in glob.glob(".github/problem-matchers/*.json"):
        print("::add-matcher::%s" % (problem_matcher))
    print_clang_info(build)
    check_log(build)
    check_built_config(build)
    boot_test(build)
Beispiel #38
0
def fetch_logs(build):
    url = build["download_url"] + "build.log"
    print_yellow("fetching logs from %s" % build["download_url"])
    # TODO: use something more robust like python wget library.
    response = urllib.request.urlopen(url).read().decode("UTF-8")
    print(response)
Beispiel #39
0
    def work(self):
        lat = self.fort['latitude']
        lng = self.fort['longitude']

        self.api.fort_details(fort_id=self.fort['id'],
                              latitude=lat,
                              longitude=lng)
        response_dict = self.api.call()
        if 'responses' in response_dict \
                and'FORT_DETAILS' in response_dict['responses'] \
                and 'name' in response_dict['responses']['FORT_DETAILS']:
            fort_details = response_dict['responses']['FORT_DETAILS']
            fort_name = fort_details['name'].encode('utf8', 'replace')
        else:
            fort_name = 'Unknown'
        logger.log('[#] Now at Pokestop: ' + fort_name + ' - Spinning...',
                   'yellow')
        sleep(2)
        self.api.fort_search(fort_id=self.fort['id'],
                             fort_latitude=lat,
                             fort_longitude=lng,
                             player_latitude=f2i(self.position[0]),
                             player_longitude=f2i(self.position[1]))
        response_dict = self.api.call()
        if 'responses' in response_dict and \
                'FORT_SEARCH' in response_dict['responses']:

            spin_details = response_dict['responses']['FORT_SEARCH']
            if spin_details['result'] == 1:
                logger.log("[+] Loot: ", 'green')
                experience_awarded = spin_details.get('experience_awarded',
                                                      False)
                if experience_awarded:
                    logger.log("[+] " + str(experience_awarded) + " xp",
                               'green')

                items_awarded = spin_details.get('items_awarded', False)
                if items_awarded:
                    tmp_count_items = {}
                    for item in items_awarded:
                        item_id = item['item_id']
                        if not item_id in tmp_count_items:
                            tmp_count_items[item_id] = item['item_count']
                        else:
                            tmp_count_items[item_id] += item['item_count']

                    for item_id, item_count in tmp_count_items.iteritems():
                        item_name = self.item_list[str(item_id)]

                        logger.log(
                            "[+] " + str(item_count) + "x " + item_name +
                            " (Total: " +
                            str(self.bot.item_inventory_count(item_id)) + ")",
                            'green')

                        # RECYCLING UNWANTED ITEMS
                        if str(item_id) in self.config.item_filter:
                            logger.log(
                                "[+] Recycling " + str(item_count) + "x " +
                                item_name + "...", 'green')
                            #RECYCLE_INVENTORY_ITEM
                            response_dict_recycle = self.bot.drop_item(
                                item_id=item_id, count=item_count)

                            if response_dict_recycle and \
                                'responses' in response_dict_recycle and \
                                'RECYCLE_INVENTORY_ITEM' in response_dict_recycle['responses'] and \
                                    'result' in response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']:
                                result = response_dict_recycle['responses'][
                                    'RECYCLE_INVENTORY_ITEM']['result']
                            if result is 1:  # Request success
                                logger.log("[+] Recycling success", 'green')
                            else:
                                logger.log("[+] Recycling failed!", 'red')
                else:
                    logger.log("[#] Nothing found.", 'yellow')

                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))

                if not items_awarded and not experience_awarded and not pokestop_cooldown:
                    message = (
                        'Stopped at Pokestop and did not find experience, items '
                        'or information about the stop cooldown. You are '
                        'probably softbanned. Try to play on your phone, '
                        'if pokemons always ran away and you find nothing in '
                        'PokeStops you are indeed softbanned. Please try again '
                        'in a few hours.')
                    raise RuntimeError(message)
            elif spin_details['result'] == 2:
                logger.log("[#] Pokestop out of range")
            elif spin_details['result'] == 3:
                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))
            elif spin_details['result'] == 4:
                print_red("[#] Inventory is full, switching to catch mode...")
                self.config.mode = 'poke'

            if 'chain_hack_sequence_number' in response_dict['responses'][
                    'FORT_SEARCH']:
                time.sleep(2)
                return response_dict['responses']['FORT_SEARCH'][
                    'chain_hack_sequence_number']
            else:
                print_yellow('[#] may search too often, lets have a rest')
                return 11
        sleep(8)
        return 0
    def work(self):
        lat = self.fort['latitude']
        lng = self.fort['longitude']

        self.api.fort_details(fort_id=self.fort['id'],
                              latitude=lat,
                              longitude=lng)
        response_dict = self.api.call()
        if 'responses' in response_dict \
                and'FORT_DETAILS' in response_dict['responses'] \
                and 'name' in response_dict['responses']['FORT_DETAILS']:
            fort_details = response_dict['responses']['FORT_DETAILS']
            fort_name = fort_details['name'].encode('utf8', 'replace')
        else:
            fort_name = 'Unknown'
        logger.log('[#]  Sekarang berada di  Pokestop: ' + fort_name + ' - Memutar...',
                   'yellow')
        sleep(2)
        self.api.fort_search(fort_id=self.fort['id'],
                             fort_latitude=lat,
                             fort_longitude=lng,
                             player_latitude=f2i(self.position[0]),
                             player_longitude=f2i(self.position[1]))
        response_dict = self.api.call()
        if 'responses' in response_dict and \
                'FORT_SEARCH' in response_dict['responses']:

            spin_details = response_dict['responses']['FORT_SEARCH']
            if spin_details['result'] == 1:
                logger.log("[+] Loot: ", 'green')
                experience_awarded = spin_details.get('experience_awarded',
                                                      False)
                if experience_awarded:
                    logger.log("[+] " + str(experience_awarded) + " xp",
                               'green')

                items_awarded = spin_details.get('items_awarded', False)
                if items_awarded:
                    self.config.mode = 'all'
                    tmp_count_items = {}
                    for item in items_awarded:
                        item_id = item['item_id']
                        if not item_id in tmp_count_items:
                            tmp_count_items[item_id] = item['item_count']
                        else:
                            tmp_count_items[item_id] += item['item_count']

                    for item_id, item_count in tmp_count_items.iteritems():
                        item_name = self.item_list[str(item_id)]

                        logger.log("[+] " + str(item_count) +
                                    "x " + item_name +
                                    " (Total: " + str(self.bot.item_inventory_count(item_id)) + ")", 'green')
                        
                        # RECYCLING UNWANTED ITEMS
                        if str(item_id) in self.config.item_filter:
                            logger.log("[+] Recycling " + str(item_count) + "x " + item_name + "...", 'green')
                            #RECYCLE_INVENTORY_ITEM
                            response_dict_recycle = self.bot.drop_item(item_id=item_id, count=item_count)

                            if response_dict_recycle and \
                                'responses' in response_dict_recycle and \
                                'RECYCLE_INVENTORY_ITEM' in response_dict_recycle['responses'] and \
                                    'result' in response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']:
                                result = response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['result']
                            if result is 1: # Request success
                                logger.log("[+] Recycling success", 'green')
                            else:
                                logger.log("[+] Recycling gagal!", 'red')
                else:
                    logger.log("[#] Nothing found.", 'yellow')

                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))

                if not items_awarded and not experience_awarded and not pokestop_cooldown:
                        print_red('Masih kena softbanned')
                        self.config.mode = 'farm'
            elif spin_details['result'] == 2:
                logger.log("[#] Pokestop out of range")
            elif spin_details['result'] == 3:
                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop  cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))
            elif spin_details['result'] == 4:
                print_red("[#] Inventory penuh, ke mode berburu...")
                self.config.mode = 'poke'

            if 'chain_hack_sequence_number' in response_dict['responses'][
                    'FORT_SEARCH']:
                time.sleep(2)
                return response_dict['responses']['FORT_SEARCH'][
                    'chain_hack_sequence_number']
            else:
                print_yellow('[#] Leren seek...')
                return 11
        sleep(8)
        return 0
    def work(self):
        lat = self.fort["latitude"]
        lng = self.fort["longitude"]
        unit = self.config.distance_unit  # Unit to use when printing formatted distance

        fortID = self.fort["id"]
        dist = distance(self.position[0], self.position[1], lat, lng)

        logger.log("[#] Found fort {} at distance {}".format(fortID, format_dist(dist, unit)))

        if dist > 0:
            logger.log("[#] Need to move closer to Pokestop")
            position = (lat, lng, 0.0)

            if self.config.walk > 0:
                self.stepper.walk_to(self.config.walk, *position)
            else:
                self.api.set_position(*position)
            self.api.player_update(latitude=lat, longitude=lng)
            logger.log("[#] Arrived at Pokestop")
            sleep(2)

        self.api.fort_details(fort_id=self.fort["id"],
                              latitude=lat,
                              longitude=lng)
        response_dict = self.api.call()
        fort_details = response_dict.get("responses", {}).get("FORT_DETAILS", {})
        fort_name = fort_details.get("name").encode("utf8", "replace")
        fort_name = fort_name if fort_name is not None else "Unknown"
        logger.log("[#] Now at Pokestop: " + fort_name + " - Spinning...",
                   "yellow")
        sleep(3)
        self.api.fort_search(fort_id=self.fort["id"],
                             fort_latitude=lat,
                             fort_longitude=lng,
                             player_latitude=f2i(self.position[0]),
                             player_longitude=f2i(self.position[1]))
        response_dict = self.api.call()
        spin_details = response_dict.get("responses", {}).get("FORT_SEARCH", {})
        spin_result = spin_details.get("result")
        if spin_result == 1:
            logger.log("[+] Loot: ", "green")
            experience_awarded = spin_details.get("experience_awarded",
                                                  False)
            if experience_awarded:
                logger.log("[+] " + str(experience_awarded) + " xp",
                           "green")

            items_awarded = spin_details.get("items_awarded", False)
            if items_awarded:
                tmp_count_items = {}
                for item in items_awarded:
                    item_id = item["item_id"]
                    if item_id not in tmp_count_items:
                        tmp_count_items[item_id] = item["item_count"]
                    else:
                        tmp_count_items[item_id] += item["item_count"]

                for item_id, item_count in tmp_count_items.iteritems():
                    item_id = str(item_id)
                    item_name = self.item_list[item_id]

                    logger.log("[+] " + str(item_count) + "x " + item_name,
                               "green")

            else:
                logger.log("[#] Nothing found.", "yellow")

            pokestop_cooldown = spin_details.get(
                "cooldown_complete_timestamp_ms")
            if pokestop_cooldown:
                seconds_since_epoch = time.time()
                logger.log("[#] PokeStop on cooldown. Time left: " + str(
                    format_time((pokestop_cooldown / 1000) -
                                seconds_since_epoch)))

            if not items_awarded and not experience_awarded and not pokestop_cooldown:
                message = (
                    "Stopped at Pokestop and did not find experience, items "
                    "or information about the stop cooldown. You are "
                    "probably softbanned. Try to play on your phone, "
                    "if pokemons always ran away and you find nothing in "
                    "PokeStops you are indeed softbanned. Please try again "
                    "in a few hours.")
                raise RuntimeError(message)
        elif spin_result == 2:
            logger.log("[#] Pokestop out of range")
        elif spin_result == 3:
            pokestop_cooldown = spin_details.get(
                "cooldown_complete_timestamp_ms")
            if pokestop_cooldown:
                seconds_since_epoch = time.time()
                logger.log("[#] PokeStop on cooldown. Time left: " + str(
                    format_time((pokestop_cooldown / 1000) -
                                seconds_since_epoch)))
        elif spin_result == 4:
            print_red("[#] Inventory is full, switching to catch mode...")
            self.config.mode = "poke"

        if "chain_hack_sequence_number" in fort_details:
            time.sleep(2)
            return fort_details[
                "chain_hack_sequence_number"]
        else:
            print_yellow("[#] may search too often, lets have a rest")
            return 11
        sleep(10)
        return 0
Beispiel #42
0
    def work(self):
        lat = self.fort['latitude']
        lng = self.fort['longitude']
        unit = self.config.distance_unit  # Unit to use when printing formatted distance

        fortID = self.fort['id']
        dist = distance(self.position[0], self.position[1], lat, lng)

        # print('[#] Found fort {} at distance {}m'.format(fortID, dist))
        logger.log('[#] Found fort {} at distance {}'.format(
            fortID, format_dist(dist, unit)))

        if dist > 10:
            logger.log('[#] Need to move closer to Pokestop')
            position = (lat, lng, 0.0)

            if self.config.walk > 0:
                self.stepper._walk_to(self.config.walk, *position)
            else:
                self.api.set_position(*position)
            self.api.player_update(latitude=lat, longitude=lng)
            response_dict = self.api.call()
            logger.log('[#] Arrived at Pokestop')
            sleep(2)

        self.api.fort_details(fort_id=self.fort['id'],
                              latitude=lat,
                              longitude=lng)
        response_dict = self.api.call()
        if 'responses' in response_dict \
                and'FORT_DETAILS' in response_dict['responses'] \
                and 'name' in response_dict['responses']['FORT_DETAILS']:
            fort_details = response_dict['responses']['FORT_DETAILS']
            fort_name = fort_details['name'].encode('utf8', 'replace')
        else:
            fort_name = 'Unknown'
        logger.log('[#] Now at Pokestop: ' + fort_name + ' - Spinning...',
                   'yellow')
        sleep(2)
        self.api.fort_search(fort_id=self.fort['id'],
                             fort_latitude=lat,
                             fort_longitude=lng,
                             player_latitude=f2i(self.position[0]),
                             player_longitude=f2i(self.position[1]))
        response_dict = self.api.call()
        if 'responses' in response_dict and \
                'FORT_SEARCH' in response_dict['responses']:

            spin_details = response_dict['responses']['FORT_SEARCH']
            if spin_details['result'] == 1:
                logger.log("[+] Loot: ", 'green')
                experience_awarded = spin_details.get('experience_awarded',
                                                      False)
                if experience_awarded:
                    logger.log("[+] " + str(experience_awarded) + " xp",
                               'green')

                items_awarded = spin_details.get('items_awarded', False)
                if items_awarded:
                    tmp_count_items = {}
                    for item in items_awarded:
                        item_id = item['item_id']
                        if not item_id in tmp_count_items:
                            tmp_count_items[item_id] = item['item_count']
                        else:
                            tmp_count_items[item_id] += item['item_count']

                    for item_id, item_count in tmp_count_items.iteritems():
                        item_id = str(item_id)
                        item_name = self.item_list[item_id]

                        logger.log("[+] " + str(item_count) + "x " + item_name,
                                   'green')

                else:
                    logger.log("[#] Nothing found.", 'yellow')

                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))

                if not items_awarded and not experience_awarded and not pokestop_cooldown:
                    message = (
                        'Stopped at Pokestop and did not find experience, items '
                        'or information about the stop cooldown. You are '
                        'probably softbanned. Try to play on your phone, '
                        'if pokemons always ran away and you find nothing in '
                        'PokeStops you are indeed softbanned. Please try again '
                        'in a few hours.')
                    raise RuntimeError(message)
            elif spin_details['result'] == 2:
                logger.log("[#] Pokestop out of range")
            elif spin_details['result'] == 3:
                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))
            elif spin_details['result'] == 4:
                print_red("[#] Inventory is full, switching to catch mode...")
                self.config.mode = 'poke'

            if 'chain_hack_sequence_number' in response_dict['responses'][
                    'FORT_SEARCH']:
                time.sleep(2)
                return response_dict['responses']['FORT_SEARCH'][
                    'chain_hack_sequence_number']
            else:
                print_yellow('[#] may search too often, lets have a rest')
                return 11
        sleep(8)
        return 0
Beispiel #43
0
    def work(self):
        lat = self.fort['latitude']
        lng = self.fort['longitude']

        self.api.fort_details(fort_id=self.fort['id'],
                              latitude=lat,
                              longitude=lng)
        response_dict = self.api.call()
        if 'responses' in response_dict \
                and'FORT_DETAILS' in response_dict['responses'] \
                and 'name' in response_dict['responses']['FORT_DETAILS']:
            fort_details = response_dict['responses']['FORT_DETAILS']
            fort_name = fort_details['name'].encode('utf8', 'replace')
        else:
            fort_name = 'Unknown'
        logger.log('[#] Now at Pokestop: ' + fort_name + ' - Spinning...',
                   'yellow')
        sleep(2)
        self.api.fort_search(fort_id=self.fort['id'],
                             fort_latitude=lat,
                             fort_longitude=lng,
                             player_latitude=f2i(self.position[0]),
                             player_longitude=f2i(self.position[1]))
        response_dict = self.api.call()
        if 'responses' in response_dict and \
                'FORT_SEARCH' in response_dict['responses']:

            spin_details = response_dict['responses']['FORT_SEARCH']
            if spin_details['result'] == 1:
                logger.log("[+] Loot: ", 'green')
                experience_awarded = spin_details.get('experience_awarded',
                                                      False)
                if experience_awarded:
                    logger.log("[+] " + str(experience_awarded) + " xp",
                               'green')

                items_awarded = spin_details.get('items_awarded', False)
                if items_awarded:
                    tmp_count_items = {}
                    for item in items_awarded:
                        item_id = item['item_id']
                        if not item_id in tmp_count_items:
                            tmp_count_items[item_id] = item['item_count']
                        else:
                            tmp_count_items[item_id] += item['item_count']

                    for item_id, item_count in tmp_count_items.iteritems():
                        item_name = self.item_list[str(item_id)]

                        logger.log("[+] " + str(item_count) +
                                    "x " + item_name +
                                    " (Total: " + str(self.bot.item_inventory_count(item_id)) + ")", 'green')

                        # RECYCLING UNWANTED ITEMS
                        if str(item_id) in self.config.item_filter:
                            logger.log("[+] Recycling " + str(item_count) + "x " + item_name + "...", 'green')
                            #RECYCLE_INVENTORY_ITEM
                            response_dict_recycle = self.bot.drop_item(item_id=item_id, count=item_count)

                            if response_dict_recycle and \
                                'responses' in response_dict_recycle and \
                                'RECYCLE_INVENTORY_ITEM' in response_dict_recycle['responses'] and \
                                    'result' in response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']:
                                result = response_dict_recycle['responses']['RECYCLE_INVENTORY_ITEM']['result']
                            if result is 1: # Request success
                                logger.log("[+] Recycling success", 'green')
                            else:
                                logger.log("[+] Recycling failed!", 'red')
                else:
                    logger.log("[#] Nothing found.", 'yellow')

                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))

                if not items_awarded and not experience_awarded and not pokestop_cooldown:
                    message = (
                        'Stopped at Pokestop and did not find experience, items '
                        'or information about the stop cooldown. You are '
                        'probably softbanned. Try to play on your phone, '
                        'if pokemons always ran away and you find nothing in '
                        'PokeStops you are indeed softbanned. Please try again '
                        'in a few hours.')
                    raise RuntimeError(message)
            elif spin_details['result'] == 2:
                logger.log("[#] Pokestop out of range")
            elif spin_details['result'] == 3:
                pokestop_cooldown = spin_details.get(
                    'cooldown_complete_timestamp_ms')
                if pokestop_cooldown:
                    seconds_since_epoch = time.time()
                    logger.log('[#] PokeStop on cooldown. Time left: ' + str(
                        format_time((pokestop_cooldown / 1000) -
                                    seconds_since_epoch)))
            elif spin_details['result'] == 4:
                print_red("[#] Inventory is full, switching to catch mode...")
                self.config.mode = 'poke'

            if 'chain_hack_sequence_number' in response_dict['responses'][
                    'FORT_SEARCH']:
                time.sleep(2)
                return response_dict['responses']['FORT_SEARCH'][
                    'chain_hack_sequence_number']
            else:
                print_yellow('[#] may search too often, lets have a rest')
                return 11
        sleep(8)
        return 0