The official wrapper for spyse.com API, written in Python, aimed to help developers build their integrations with Spyse.

Overview

Python wrapper for Spyse API

The official wrapper for spyse.com API, written in Python, aimed to help developers build their integrations with Spyse.

Spyse is the most complete Internet assets search engine for every cybersecurity professional.

Examples of data Spyse delivers:

  • List of 300+ most popular open ports found on 3.5 Billion publicly accessible IPv4 hosts.
  • Technologies used on 300+ most popular open ports and IP addresses and domains using a particular technology.
  • Security score for each IP host and website, calculated based on the found vulnerabilities.
  • List of websites hosted on each IPv4 host.
  • DNS and WHOIS records of the domain names.
  • SSL certificates provided by the website hosts.
  • Structured content of the website homepages.
  • Abuse reports associated with IPv4 hosts.
  • Organizations and industries associated with the domain names.
  • Email addresses found during the Internet scanning, associated with a domain name.

More information about the data Spyse collects is available on the Our data page.

Spyse provides an API accessible via token-based authentication. API tokens are available only for registered users on their account page.

For more information about the API, please check the API Reference.

Installation

pip3 install spyse-python

Updating

pip3 install --no-cache-dir spyse-python

Quick start

from spyse import Client

client = Client("your-api-token-here")

d = client.get_domain_details('tesla.com')

print(f"Domain details:")
print(f"Website title: {d.http_extract.title}")
print(f"Alexa rank: {d.alexa.rank}")
print(f"Certificate subject org: {d.cert_summary.subject.organization}")
print(f"Certificate issuer org: {d.cert_summary.issuer.organization}")
print(f"Updated at: {d.updated_at}")
print(f"DNS Records: {d.dns_records}")
print(f"Technologies: {d.technologies}")
print(f"Vulnerabilities: {d.cve_list}")
print(f"Trackers: {d.trackers}")
# ...

Examples

Note: You need to export access_token to run any example:

export SPYSE_API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

How to search

Using Spyse you can search for any Internet assets by their digital fingerprints. To do that, you need to form a specific search query and pass it to 'search', 'scroll', or 'count' methods.

Each search query can contain multiple search params. Each search param consists of name, operator, and value.

Check API docs to find out all existing combinations. Here is an example for domains search: https://spyse-dev.readme.io/reference/domains#domain_search You may also be interested in our GUI for building and testing queries before jumping to code: https://spyse.com/advanced-search/domain

Example search request to find subdomains of att.com:

from spyse import Client, SearchQuery, QueryParam, DomainSearchParams, Operators

# Prepare query
q = SearchQuery()
domain = "att.com"

# Add param to search for att.com subdomains
q.append_param(QueryParam(DomainSearchParams.name, Operators.ends_with, '.' + domain))

# Add param to search only for alive subdomains
q.append_param(QueryParam(DomainSearchParams.http_extract_status_code, Operators.equals, "200"))

# Add param to remove subdomains seen as PTR records
q.append_param(QueryParam(DomainSearchParams.is_ptr, Operators.equals, "False"))

# Next, you can use the query to run search, count or scroll methods
c = Client("your-api-token-here")
total_count = c.count_domains(q)
search_results = c.search_domains(q).results
scroll_results = c.scroll_domains(q).results

Example search request to find any alive IPv4 hosts in US, with open port 22 and running nginx:

from spyse import Client, SearchQuery, QueryParam, IPSearchParams, Operators

# Prepare query
q = SearchQuery()

# Add param to search for IPv4 hosts located in US
q.append_param(QueryParam(IPSearchParams.geo_country_iso_code, Operators.equals, 'US'))

# Add param to search only for hosts with open 22 port
q.append_param(QueryParam(IPSearchParams.open_port, Operators.equals, "22"))

# Add param to search only for hosts with nginx
q.append_param(QueryParam(IPSearchParams.port_technology_name, Operators.contains, "nginx"))

# Next, you can use the query to run search, count or scroll methods
c = Client("your-api-token-here")
total_count = c.count_ip(q)
search_results = c.search_ip(q).results
scroll_results = c.scroll_ip(q).results

Scroll vs Search

While a 'search' request allows to paginate over the first 10'000 results, the 'scroll search' can be used for deep pagination over a larger number of results (or even all results) in much the same way as you would use a cursor on a traditional database.

In order to use scrolling, the initial search response will return a 'search_id' data field which should be specified in the subsequent requests in order to iterate over the rest of results.

Limitations

The scroll is available only for customers with 'Pro' subscription.

Example code to check if the scroll is available for your account

from spyse import Client
c = Client("your-api-token-here")

if c.get_quotas().is_scroll_search_enabled:
    print("Scroll is available")
else:
    print("Scroll is NOT available")

Development

Installation

git clone https://github.com/spyse-com/spyse-python
pip install -e .

Run tests:

cd tests
python client_test.py

License

Distributed under the MIT License. See LICENSE for more information.

Troubleshooting and contacts

For any proposals and questions, please write at:

Comments
  • Update deps and add a dependabot.yml file

    Update deps and add a dependabot.yml file

    This PR is to fix issues with spyse using out of date deps and allow projects that use this SDK to be able to install new versions of deps that they use by fixing sypse SDK to use the latest of its deps. If this PR gets accepted can you then please tag a new release to pypi with these changes, thanks

    opened by L1ghtn1ng 0
  • Domain Lookup doesn't return result

    Domain Lookup doesn't return result

    As the issue mentioned, i'm trying to experiment with spyse-py to automate my search queries. Using the script template (Already input the token-key and some domain name example) it wont show the result. Screenshot_2022-04-30-15-09-35-27

    opened by MC189 0
  • Update license entry

    Update license entry

    It should be the license identifier and not the license text.

    At the moment PyPI shows the content of the LICENSE.md file.

    This would also allow third-party tools (e. g., pyp2rpm) to get the license details in a simple way.

    opened by fabaff 0
  • spyse.response.RateLimitError: too many requests

    spyse.response.RateLimitError: too many requests

    from spyse import Client
    
    
    def main():
        client = Client("token")
        q = client.get_quotas()
    
    
    if __name__ == '__main__':
        main()
    
    

    Traceback:

    Traceback (most recent call last):
      File "/home/name/py-trash/privatbank/main.py", line 11, in <module>
        main()
      File "/home/name/py-trash/privatbank/main.py", line 7, in main
        q = client.get_quotas()
      File "/home/name/py-trash/venv/lib/python3.9/site-packages/spyse/client.py", line 106, in get_quotas
        response.check_errors()
      File "/home/name/py-trash/venv/lib/python3.9/site-packages/spyse/response.py", line 117, in check_errors
        raise RateLimitError(m)
    spyse.response.RateLimitError: too many requests
    
    

    Python 3.9.9

    Package            Version
    ------------------ ---------
    certifi            2021.10.8
    charset-normalizer 2.0.11
    dataclasses        0.6
    dataclasses-json   0.5.6
    idna               3.3
    limiter            0.1.2
    marshmallow        3.14.1
    marshmallow-enum   1.5.1
    mypy-extensions    0.4.3
    pip                21.2.4
    requests           2.26.0
    responses          0.13.4
    setuptools         58.0.4
    six                1.16.0
    spyse-python       2.2.3
    token-bucket       0.2.0
    typing_extensions  4.0.1
    typing-inspect     0.7.1
    urllib3            1.26.8
    wheel              0.37.0
    
    opened by fabelx 2
  • make dataclasses optional

    make dataclasses optional

    Hi, can you make dataclasses conditional, since it is a backport for Python 3.6 and included in newer Python versions?

    https://github.com/spyse-com/spyse-python/blob/main/requirements.txt#L2 https://github.com/spyse-com/spyse-python/blob/main/setup.py#L21

    Thanks

    opened by blshkv 0
Releases(v2.2.3)
Owner
Spyse
Internet assets search engine
Spyse
The official command-line client for spyse.com

Spyse CLI The official command-line client for spyse.com. NOTE: This tool is currently in the early stage beta and shouldn't be used in production. Yo

Spyse 43 Dec 8, 2022
Python library for Spurwing API to schedule appointments, manage calendars and custom integrations.

Spurwing API Python Library Lightweight Python library for Spurwing's API. Spurwing's API makes it easy to add robust scheduling and booking to your a

Spurwing 1 Jul 14, 2021
🚀 An asynchronous python API wrapper meant to replace discord.py - Snappy discord api wrapper written with aiohttp & websockets

Pincer An asynchronous python API wrapper meant to replace discord.py ❗ The package is currently within the planning phase ?? Links |Join the discord

Pincer 125 Dec 26, 2022
Talon accessibility - Experimental Talon integrations using macOS accessibility APIs

talon_accessibility Experimental Talon integrations using macOS accessibility AP

Phil Cohen 11 Dec 23, 2022
Ubuntu env build; Nginx build; DB build;

Deploy 介绍 Deploy related scripts bitnami Dependencies Ubuntu openssl envsubst docker v18.06.3 docker-compose init base env upload https://gitlab-runn

Colin(liuji) 10 Dec 1, 2021
TypeRig is a Python library aimed at simplifying the current FontLab API

TypeRig TypeRig is a Python library aimed at simplifying the current FontLab API while offering some additional functionality that is heavily biased t

Vassil Kateliev 41 Nov 2, 2022
Asyncevents: a small library to help developers perform asynchronous event handling in Python

asyncevents - Asynchronous event handling for modern Python asyncevents is a small library to help developers perform asynchronous event handling in m

Mattia 5 Aug 7, 2022
This software's intent is to automate all activities related to manage Axie Infinity Scholars. It is specially aimed to mangers with large scholar roasters.

Axie Scholars Utilities This software's intent is to automate all activities related to manage Scholars. It is specially aimed to mangers with large s

Ferran Marin 153 Nov 16, 2022
Async ready API wrapper for Revolt API written in Python.

Mutiny Async ready API wrapper for Revolt API written in Python. Installation Python 3.9 or higher is required To install the library, you can just ru

null 16 Mar 29, 2022
This an API wrapper library for the OpenSea API written in Python 3.

OpenSea NFT API Python 3 wrapper This an API wrapper library for the OpenSea API written in Python 3. The library provides a simplified interface to f

Attila Tóth 159 Dec 26, 2022
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022
A python library created to make life easier for Telegram API Developers.

opentele A python library created to make life easier for Telegram API Developers. Read the documentation Features Convert Telegram Desktop tdata sess

null 103 Jan 2, 2023
Design and build a wrapper for the Open Weather API current weather data service

Design and build a wrapper for the Open Weather API current weather data service that returns a city's temperature, with caching, also allowing for the temperature of the latest queried cities that are still validly cached to be retrieved.

Duan Rafael Ribeiro 1 Jun 27, 2022
(@Tablada32BOT is my bot in twitter) This is a simple bot, its main and only function is to reply to tweets where they mention their bot with their @

Remember If you are going to host your twitter bot on a page where they can read your code, I recommend that you create an .env file and put your twit

null 3 Jun 4, 2021
a simple python script that monitors the binance hotwallet and refunds the withdrawal fee to encourage people to withdraw their Nano and help decentralisation

Nano_Binance_Refund_Bot a simple python script that monitors the binance hotwallet and refunds the withdrawal fee to encourage people to withdraw thei

James Coxon 5 Apr 7, 2022
Aws-lambda-requests-wrapper - Request/Response wrapper for AWS Lambda with API Gateway

AWS Lambda Requests Wrapper Request/Response wrapper for AWS Lambda with API Gat

null 1 May 20, 2022
Official Python client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Python apps.

MonkeyLearn API for Python Official Python client for the MonkeyLearn API. Build and run machine learning models for language processing from your Pyt

MonkeyLearn 157 Nov 22, 2022
The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards

The scope of this project will be to build a data ware house on Google Cloud Platform that will help answer common business questions as well as powering dashboards.

Shweta_kumawat 2 Jan 20, 2022
An open source development framework to help you build data workflows and modern data architecture on AWS.

AWS DataOps Development Kit (DDK) The AWS DataOps Development Kit is an open source development framework for customers that build data workflows and

Amazon Web Services - Labs 111 Dec 23, 2022