Exemplo n.º 1
0
    def test_get_csrf_token(self):
        responses.add(** mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])

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

        csrf = changeme.get_csrf_token(res, cred)
        assert csrf == 'foobar'
Exemplo n.º 2
0
    def test_get_csrf_token(self):
        responses.add(**mock.jboss_fp)
        res = requests.get(mock.jboss_fp['url'])

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

        csrf = changeme.get_csrf_token(res, cred)
        assert csrf == 'foobar'
Exemplo n.º 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
Exemplo n.º 4
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
Exemplo n.º 5
0
    def test_get_csrf_token_fail(self):
        orig = mock.jboss_fp['body']
        mock.jboss_fp['body'] = "foobar"
        responses.add(**mock.jboss_fp)
        mock.jboss_fp['body'] = orig

        res = requests.get(mock.jboss_fp['url'])

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

        csrf = changeme.get_csrf_token(res, cred)
        assert csrf is False
Exemplo n.º 6
0
    def test_get_csrf_token_fail(self):
        orig = mock.jboss_fp['body']
        mock.jboss_fp['body'] = "foobar"
        responses.add(** mock.jboss_fp)
        mock.jboss_fp['body'] = orig

        res = requests.get(mock.jboss_fp['url'])

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

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