How to use the censys.base.CensysIndex function in censys

To help you get started, we’ve selected a few censys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github censys / censys-python / censys / certificates.py View on Github external
import unittest

from .base import CensysAPIBase, CensysIndex, CensysException

class CensysCertificates(CensysIndex):

    INDEX_NAME = "certificates"


class CensysCertificatesTests(unittest.TestCase):
    correct_search_result = {
        u'parsed.fingerprint_sha256': [u'a762bf68f167f6fbdf2ab00fdefeb8b96f91335ad6b483b482dfd42c179be076'],
        u'parsed.subject_dn': [u'C=US, CN=www.censys.io, emailAddress=hostmaster@censys.io']}

    correct_get_result = {"tags": [], "validation_timestamp": "2015-10-07T01:18:48+00:00",
                          "updated_at": "2015-10-06T20:18:50",
                          "raw": "MIIDQzCCAiugAwIBAgIEdGWCQjANBgkqhkiG9w0BAQsFADA8MRcwFQYDVQQDDA5uczEuZ29vZ2xlLmNvbTEhMB8GCSqGSIb3DQEJARYSc3NsQG5zMS5nb29nbGUuY29tMB4XDTE1MDkxMDA2NDkxOVoXDTE2MDkwOTA2NDkxOVowPDEXMBUGA1UEAwwObnMxLmdvb2dsZS5jb20xITAfBgkqhkiG9w0BCQEWEnNzbEBuczEuZ29vZ2xlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL2I5uWRiHRJNVqO26HZybIijYqj2aBLFF6qA1fkxqSMQmSpBgd6CbHKB2g2Lm1QVBbrnPuv07Q9+9YRFiPGjITwP0IUQbWbig11MoCIB8tfEgRtnIiW+8XESAXTvRTZrKX5cRV+aCz21XPi41z8+QrNSd3QEqofkA1o3Xb5jGkYOlPqEB5kTmKt26PjY5RfjxXOlyfs7oPVQxKaTSob4MPN2BTmkvqJWyi7rN+E8Vtgte0NKvAAWrJ9xg36fjuYsWR5HzCVNYK7K0GUdvaB5IAueDcrThYYloy6ErJWGOYhWUT5w6+BrRmc15q2Vz8MIjVKiNqGrmfJtNrWsghD3y8CAwEAAaNNMEswHQYDVR0OBBYEFNw+Lj9JsSZ4Ly3UREw8tZcL6Fl5MB8GA1UdIwQYMBaAFNw+Lj9JsSZ4Ly3UREw8tZcL6Fl5MAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBAC3r3hrkO51YX7AhfDX6sremmu9KQMHYcpMQHCrMsn2SEXqLYWW4fe/abEfZ2ADpG7G/c8Tevc5auyBEfEUMej6ZcOPQeHElXc+v8xVdUVwmKNlWYVV6b0FMT9Uzt1DP3C6sFnXURzX5tCVjf1r2Ef5DUPgZrYiqmVFjZ1rCoVTZ6Envy7pG3GWrwD6WPtx5BYkT0yPWn38RUZ5hY3Uyx5Zw1zYFqrY6xEBN8D+hvfFlwKIYn/goD/eoW6Htau2CJK8yoG0WjKCXrSQGoZ8PRnOfZ2YGiodtOSXkZxTNXnjgf4sRV3tZD/AkgBnuQZHfttTb1KF5dk3lpNMGNlnG9rw=",
                          "valid_nss": False,
                          "parsed": {
                              "fingerprint_sha256": "fce621c0dc1c666d03d660472f636ce91e66e96460545f0da7eb1a24873e2f70",
                              "subject_dn": "CN=ns1.google.com, emailAddress=ssl@ns1.google.com",
github censys / censys-python / censys / ipv4.py View on Github external
from __future__ import print_function
import unittest
import pprint

from .base import CensysAPIBase, CensysIndex, CensysException


class CensysIPv4(CensysIndex):

    INDEX_NAME = "ipv4"

class CensysIPv4Tests(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls._api = CensysIPv4()

    def testGet(self):
        self._api.view("84.206.102.184")

    def testEmptySearch(self):
        with self.assertRaises(CensysException):
            self._api._post("search/ipv4", data={"query1": "query"})
github censys / censys-python / censys / websites.py View on Github external
from __future__ import print_function
import unittest

from .base import CensysAPIBase, CensysIndex, CensysException

class CensysWebsites(CensysIndex):

    INDEX_NAME = "websites"


class CensysWebsitesTests(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls._api = CensysWebsites()

    def testGet(self):
        self._api.view("google.com")

    def testSearch(self):
        list(self._api.search("*", max_records=10))