Search the SHODAN database. :param query: Search query; identical syntax to the website :type query: str :param page: (optional) Page number of the search results :type page: int :param limit: (optional) Number of results to return :type limit: int
(self, query, page=1, limit=None, offset=None, facets=None, minify=True)
| 481 | return self._request('/shodan/scan/{}'.format(scan_id), {}) |
| 482 | |
| 483 | def search(self, query, page=1, limit=None, offset=None, facets=None, minify=True): |
| 484 | """Search the SHODAN database. |
| 485 | |
| 486 | :param query: Search query; identical syntax to the website |
| 487 | :type query: str |
| 488 | :param page: (optional) Page number of the search results |
| 489 | :type page: int |
| 490 | :param limit: (optional) Number of results to return |
| 491 | :type limit: int |
| 492 | :param offset: (optional) Search offset to begin getting results from |
| 493 | :type offset: int |
| 494 | :param facets: (optional) A list of properties to get summary information on |
| 495 | :type facets: str |
| 496 | :param minify: (optional) Whether to minify the banner and only return the important data |
| 497 | :type minify: bool |
| 498 | |
| 499 | :returns: A dictionary with 2 main items: matches and total. If facets have been provided then another property called "facets" will be available at the top-level of the dictionary. Visit the website for more detailed information. |
| 500 | """ |
| 501 | args = { |
| 502 | 'query': query, |
| 503 | 'minify': minify, |
| 504 | } |
| 505 | if limit: |
| 506 | args['limit'] = limit |
| 507 | if offset: |
| 508 | args['offset'] = offset |
| 509 | else: |
| 510 | args['page'] = page |
| 511 | |
| 512 | if facets: |
| 513 | args['facets'] = create_facet_string(facets) |
| 514 | |
| 515 | return self._request('/shodan/host/search', args) |
| 516 | |
| 517 | def search_cursor(self, query, minify=True, retries=5): |
| 518 | """Search the SHODAN database. |