F5_connector.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:Phantom-Cyber 作者: joelwking 项目源码 文件源码
def _test_connectivity(self, param):
        """
        Called when the user depresses the test connectivity button on the Phantom UI.
        Use a basic query to determine if the IP address, username and password is correct,
            curl -k -u admin:redacted -X GET https://192.0.2.1/mgmt/tm/ltm/
        """
        self.debug_print("%s TEST_CONNECTIVITY %s" % (F5_Connector.BANNER, param))

        config = self.get_config()
        host = config.get("device")
        F5 = iControl.BIG_IP(host=host,
                    username=config.get("username"),
                    password=config.get("password"),
                    uri="/mgmt/tm/sys/software/image",
                    method="GET")
        msg = "test connectivity to %s status_code: " % host

        if F5.genericGET():
            # True is success
            return self.set_status_save_progress(phantom.APP_SUCCESS, msg + "%s %s" % (F5.status_code, httplib.responses[F5.status_code]))
        else:
            # None or False, is a failure based on incorrect IP address, username, passords
            return self.set_status_save_progress(phantom.APP_ERROR, msg + "%s %s" % (F5.status_code, F5.response))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号