MCPcopy Create free account
hub / github.com/achillean/shodan-python / search

Method search

shodan/client.py:483–515  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 12

search_cursorMethod · 0.95
searchFunction · 0.95
test_invalid_keyMethod · 0.95
test_search_simpleMethod · 0.45
test_search_emptyMethod · 0.45
test_search_facetsMethod · 0.45
test_search_minifyMethod · 0.45
test_exploits_searchMethod · 0.45

Calls 2

_requestMethod · 0.95
create_facet_stringFunction · 0.85

Tested by 10

test_invalid_keyMethod · 0.76
test_search_simpleMethod · 0.36
test_search_emptyMethod · 0.36
test_search_facetsMethod · 0.36
test_search_minifyMethod · 0.36
test_exploits_searchMethod · 0.36