Wrapper around the Shodan REST and Streaming APIs :param key: The Shodan API key that can be obtained from your account page (https://account.shodan.io) :type key: str :ivar exploits: An instance of `shodan.Shodan.Exploits` that provides access to the Exploits REST API. :ivar stream
| 37 | |
| 38 | |
| 39 | class Shodan: |
| 40 | """Wrapper around the Shodan REST and Streaming APIs |
| 41 | |
| 42 | :param key: The Shodan API key that can be obtained from your account page (https://account.shodan.io) |
| 43 | :type key: str |
| 44 | :ivar exploits: An instance of `shodan.Shodan.Exploits` that provides access to the Exploits REST API. |
| 45 | :ivar stream: An instance of `shodan.Shodan.Stream` that provides access to the Streaming API. |
| 46 | """ |
| 47 | |
| 48 | class Data: |
| 49 | |
| 50 | def __init__(self, parent): |
| 51 | self.parent = parent |
| 52 | |
| 53 | def list_datasets(self): |
| 54 | """Returns a list of datasets that the user has permission to download. |
| 55 | |
| 56 | :returns: A list of objects where every object describes a dataset |
| 57 | """ |
| 58 | return self.parent._request('/shodan/data', {}) |
| 59 | |
| 60 | def list_files(self, dataset): |
| 61 | """Returns a list of files that belong to the given dataset. |
| 62 | |
| 63 | :returns: A list of objects where each object contains a 'name', 'size', 'timestamp' and 'url' |
| 64 | """ |
| 65 | return self.parent._request('/shodan/data/{}'.format(dataset), {}) |
| 66 | |
| 67 | class Dns: |
| 68 | |
| 69 | def __init__(self, parent): |
| 70 | self.parent = parent |
| 71 | |
| 72 | def domain_info(self, domain, history=False, type=None, page=1): |
| 73 | """Grab the DNS information for a domain. |
| 74 | """ |
| 75 | args = { |
| 76 | 'page': page, |
| 77 | } |
| 78 | if history: |
| 79 | args['history'] = history |
| 80 | if type: |
| 81 | args['type'] = type |
| 82 | return self.parent._request('/dns/domain/{}'.format(domain), args) |
| 83 | |
| 84 | class Notifier: |
| 85 | |
| 86 | def __init__(self, parent): |
| 87 | self.parent = parent |
| 88 | |
| 89 | def create(self, provider, args, description=None): |
| 90 | """Get the settings for the specified notifier that a user has configured. |
| 91 | |
| 92 | :param provider: Provider name |
| 93 | :type provider: str |
| 94 | :param args: Provider arguments |
| 95 | :type args: dict |
| 96 | :param description: Human-friendly description of the notifier |