'Search the entire Shodan Exploits archive using the same query syntax
as the website.
Arguments:
query    -- exploit search query; same syntax as website
Optional arguments:
sources  -- metasploit, cve, osvdb, exploitdb, or packetstorm
cve      -- CVE identifier (ex. 2010-0432)
osvdb    -- OSVDB identifier (ex. 11666)
msb      -- Microsoft Security Bulletin ID (ex. MS05-030)
bid      -- Bugtraq identifier (ex. 13951)'

def search(self, query, sources=[], cve=None, osvdb=None, msb=None, bid=None):

    if sources:
        query += ('    source:' + ','.join(sources))
    if cve:
        query += ('    cve:%s' % str(cve).strip())
    if osvdb:
        query += ('    osvdb:%s' % str(osvdb).strip())
    if msb:
        query += ('    msb:%s' % str(msb).strip())
    if bid:
        query += ('    bid:%s' % str(bid).strip())
    return self.parent._request('search_exploits', {'q': query})
