예제 #1
0
    def test_idrac_fp(self):
        responses.add(** mock.idrac_fp)
        res = requests.get(mock.idrac_fp['url'])

        matches = changeme.get_fingerprint_matches(res, self.creds)

        assert len(matches) == 1
        assert matches[0]['name'] == self.idrac_name
예제 #2
0
    def test_idrac_fp(self):
        responses.add(**mock.idrac_fp)
        res = requests.get(mock.idrac_fp['url'])

        matches = changeme.get_fingerprint_matches(res, self.creds)

        assert len(matches) == 1
        assert matches[0]['name'] == self.idrac_name
예제 #3
0
    def test_get_csrf_token_no_token(self):
        responses.add(** mock.zabbix_fp)
        res = requests.get(mock.zabbix_fp['url'])

        cred = self.get_cred('Zabbix')
        assert cred['name'] == 'Zabbix'

        csrf = changeme.get_csrf_token(res, cred)
        assert csrf is False

        matches = changeme.get_fingerprint_matches(res, self.creds)
        assert len(matches) == 1
예제 #4
0
    def test_get_fingerprint_matches_tomcat_fail(self):
        responses.add(** mock.jboss_fp)
        res = requests.get(mock.tomcat_fp['url'])

        matches = changeme.get_fingerprint_matches(res, self.creds)

        for i in matches:
            if i['name'] == self.tomcat_name:
                matched = True
            else:
                matched = False
        assert not matched
예제 #5
0
    def test_get_csrf_token_no_token(self):
        responses.add(**mock.zabbix_fp)
        res = requests.get(mock.zabbix_fp['url'])

        cred = self.get_cred('Zabbix')
        assert cred['name'] == 'Zabbix'

        csrf = changeme.get_csrf_token(res, cred)
        assert csrf is False

        matches = changeme.get_fingerprint_matches(res, self.creds)
        assert len(matches) == 1
예제 #6
0
    def test_get_fingerprint_matches_tomcat_fail(self):
        responses.add(**mock.jboss_fp)
        res = requests.get(mock.tomcat_fp['url'])

        matches = changeme.get_fingerprint_matches(res, self.creds)

        for i in matches:
            if i['name'] == self.tomcat_name:
                matched = True
            else:
                matched = False
        assert not matched
예제 #7
0
    def test_get_fingerprint_matches_jboss(self):
        responses.add(** mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])

        # Verify the response came back correctly
        assert res.status_code == 200
        assert "Welcome to the JBoss AS 6 Admin Console" in res.text

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.jboss_name:
                matched = True
        assert matched
예제 #8
0
    def test_get_fingerprint_matches_tomcat(self):
        responses.add(** mock.tomcat_fp)
        res = requests.get(mock.tomcat_fp['url'])

        # Verify the response came back correctly
        assert res.status_code == 401
        assert res.headers.get('WWW-Authenticate')

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.tomcat_name:
                matched = True
        assert matched
예제 #9
0
    def test_get_fingerprint_matches_jboss(self):
        responses.add(**mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])

        # Verify the response came back correctly
        assert res.status_code == 200
        assert "Welcome to the JBoss AS 6 Admin Console" in res.text

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.jboss_name:
                matched = True
        assert matched
예제 #10
0
    def test_get_fingerprint_matches_tomcat(self):
        responses.add(**mock.tomcat_fp)
        res = requests.get(mock.tomcat_fp['url'])

        # Verify the response came back correctly
        assert res.status_code == 401
        assert res.headers.get('WWW-Authenticate')

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.tomcat_name:
                matched = True
        assert matched
예제 #11
0
    def test_get_fingerprint_matches_jboss_fail_body(self):
        orig = mock.jboss_fp['body']
        mock.jboss_fp['body'] = "foobar"
        responses.add(** mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])
        mock.jboss_fp['body'] = orig

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.jboss_name:
                matched = True
            else:
                matched = False
        assert not matched
예제 #12
0
    def test_get_fingerprint_matches_jboss_fail_body(self):
        orig = mock.jboss_fp['body']
        mock.jboss_fp['body'] = "foobar"
        responses.add(**mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])
        mock.jboss_fp['body'] = orig

        matches = changeme.get_fingerprint_matches(res, self.creds)

        matched = False
        for i in matches:
            if i['name'] == self.jboss_name:
                matched = True
            else:
                matched = False
        assert not matched