def main():
    global hunt_started
    scan_options = [config.pod, config.cidr, config.remote, config.internal]
    try:
        if config.list:
            list_hunters()
            return

        if not any(scan_options):
            if not interactive_set_config(): return

        hunt_started = True
        handler.publish_event(HuntStarted())
        handler.publish_event(HostScanEvent())

        # Blocking to see discovery output
        handler.join()
    except KeyboardInterrupt:
        logging.debug("Kube-Hunter stopped by user")
    # happens when running a container without interactive option
    except EOFError:
        logging.error("\033[0;31mPlease run again with -it\033[0m")
    finally:
        if hunt_started:
            handler.publish_event(HuntFinished())
            handler.join()
            handler.free()
            logging.debug("Cleaned Queue")
Exemple #2
0
def main():
    global hunt_started
    scan_options = [config.pod, config.cidr, config.remote, config.internal]
    try:
        if config.list:
            list_hunters()
            return

        if not any(scan_options):
            if not interactive_set_config(): return

        hunt_started = True
        handler.publish_event(HuntStarted())
        handler.publish_event(HostScanEvent())

        # Blocking to see discovery output
        handler.join()
    except KeyboardInterrupt:
        logging.debug("Kube-Hunter stopped by user")
    finally:
        if hunt_started:
            handler.publish_event(HuntFinished())
            handler.join()
            handler.free()
            logging.debug("Cleaned Queue")

    if config.pod:
        while True:
            time.sleep(5)
Exemple #3
0
def main():
    global hunt_started
    URL = "http://hotsix.kro.kr/re_result.php"
    intro = "\x1b[1;34m\n\n"
    intro += "    Dg.     qDi                             iQBBBBi :BB:                   dKDRBdu.              :BB  QBg          BBY\n"
    intro += "    BBr     BBP             KBv            BBQv7jQv  JJ                    BBBMQBBBBs            .BQ  iU.          72\n"
    intro += "    BB      BBj    sgBPr   jBBBjr         iBQ        :. ij.    uu          BQ:    .BBu    LRQU.  .BB   ..    LDBgi ...   .2BBK:   .vr   .vr   :IQBP:\n"
    intro += "    BQQDQQRbBBs  EBBSudBB: DBBBR5          KBBBs     BBi.QB:  BB7          BBr     7BB  SBBiiBBP  BB  BBB  EBBqUEX QBg  BQB1uQBB  DBB   dBB  QBdirgv\n"
    intro += "    BBRgQQMEBBv LBB    .BB  BBr              rQBQB.  BBi  ZBsBE            BBr     vBB iBBi::UBB  QB  PBB LBB      BQS BBP    1BB jBQ   jBB  BQg.\n"
    intro += "    BB      BBs gBB     BB  BB7                 vQB  QBi  .QBQi            BB:     BBr 5BB:i7r:i  BB  PBB QBg      BBU BBr    rBB UBB   LBB   :PBBBi\n"
    intro += "    BBi     BBI  BB7   BBM  BBE           vBr. .DBQ  BQr bBB PBB           BBM7YIBQB7   BBr      .QB  gBB .BBL   : BQE rBB.  .BBr iBB.  BBB  r   BBB\n"
    intro += "    BB:     BQs   PBBBBBr   :BBBb         .BBBBBBj   BB:JBQ   bBB          QBBBBBgr      PBBBBBv .BB  XBR   EBBBBg QB1  .QBBBQQ.   UBBBXXBB .BBQBBS\n\x1b[1;m"
    print(intro)
    print(
        "\x1b[1;34m    ================================================================================================================================================\x1b[1;m"
    )
    print("\x1b[1;34m    Hi, Kube-Six!\x1b[1;m")
    print(
        "\x1b[1;34m    Kube-Six scans security weaknesses in Kubernetes clusters!\x1b[1;m"
    )
    print(
        "\x1b[1;34m    ================================================================================================================================================\n\x1b[1;m"
    )
    print("\x1b[1;34m    write your email (ex. [email protected])\x1b[1;m")

    USER_TOKEN = raw_input("\x1b[1;34m    My Email: \x1b[1;m")
    if not "@" in USER_TOKEN:
        USER_TOKEN = USER_TOKEN.split("@")[0]
        print("check your email form:)")
        return
    else:
        email.set_email(USER_TOKEN)
        res = requests.post(URL, data={'chk': '0', 'token': USER_TOKEN})
        if not "1" in res.text:
            print(
                "\x1b[1;34mThis email already exists.\n Please Try again.\x1b[1;m"
            )
            return
        else:
            try:
                hunt_started_lock.acquire()
                hunt_started = True
                hunt_started_lock.release()

                handler.publish_event(HostScanEvent())

                handler.join()
            except KeyboardInterrupt:
                logging.debug("Kube-Hunter stopped by user")
            except EOFError:
                logging.error("\033[0;31mPlease run again with -it\033[0m")
            finally:
                hunt_started_lock.acquire()
                if hunt_started:
                    hunt_started_lock.release()
                    handler.publish_event(HuntReported())
                    handler.join()
                    handler.free()
                    logging.debug("Cleaned Queue")
                else:
                    hunt_started_lock.release()