Package: et-api
Proofpoint Emerging Threats API PackageLibrary implements all of the functions of the ET API via Python.Requirements:Python 3.9+requestspysocksInstalling the PackageYou can install the API library using the following command directly from Github.pip install git+https://github.com/pfptcommunity/et-api-python.gitor can install the API library using pip.pip install et-apiET API VersionsSelecting the version of the ET API is done at time of import# Version 1fromet_api.v1import*Creating an API client objectfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")Querying Reputation Categoriesfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")# Get all the reputation categoriescategories=client.reputation_categories()forcategoryincategories:print(category)Querying Domain Informationfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")forreputationinclient.domains["yahoo"].reputation():print(reputation)forurlinclient.domains["yahoo"].urls():print("URL: ",url)forsampleinclient.domains["yahoo"].samples():print("Sample: ",sample)foripsinclient.domains["yahoo"].ips():print("IPs: ",ips)foreventinclient.domains["yahoo"].events():print("Event: ",event)fornsinclient.domains["yahoo"].nameservers():print("Nameserver: ",ns)forkey,valueinclient.domains["yahoo"].whois().items():print("{}={}".format(key,value))Querying IP Informationfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")# Get IP Informationip="98.137.11.164"forreputationinclient.ips[ip].reputation():print("Reputation:",reputation)forurlinclient.ips[ip].urls():print("URL: ",url)forsampleinclient.ips[ip].samples():print("Sample: ",sample)fordomaininclient.ips[ip].domains():print("Domain: ",domain)foreventinclient.ips[ip].events():print("Event: ",event)forgeoinclient.ips[ip].geo_location():print("Geo: ",geo)Querying Malware Samplesfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")# Get Malware Samplesmd5="cd88c95ca03b86d9ca32f322d69a7ee9"details=client.samples[md5]()print("details:",details)forconnectioninclient.samples[md5].connections():print("Connection:",connection)foreventinclient.samples[md5].ids_events():print("Event:",event)fordnsinclient.samples[md5].dns():print("DNS:",dns)forhttpinclient.samples[md5].http():print("HTTP:",http)Querying Malware Samplesfromet_api.v1import*fromet_api.commonimport*if__name__=='__main__':client=Client("<enter_your_api_key_here>")sid="2012199"info=client.sids[sid]()print("SigInfo:",info.sid,'-->',info.name)f=IPFilter()# SortBy and SortOrder are located in et_api.commonf.sort_by=SortBy.LAST_SEENf.sort_direction=SortOrder.ASCENDINGforipinclient.sids[sid].ips(f):print("IP:",ip)fordomaininclient.sids[sid].domains():print("Domain:",domain)forsampleinclient.sids[sid].samples():print("Sample:",sample)forkey,valueinclient.sids[sid].signature().items():print("{}={}".format(key,value))forkey,valueinclient.sids[sid].documentation().items():print("{}={}".format(key,value))forrefinclient.sids[sid].references():print("Type:",ref.type)print("Description:",ref.description)print("Urls:",ref.urls)Proxy SupportSocks5 Proxy Example:fromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")credentials="{}:{}@".format("proxyuser","proxypass")client.session.proxies={'https':"{}://{}{}:{}".format('socks5',credentials,'<your_proxy>','8128')}HTTP Proxy Example (Squid):fromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")credentials="{}:{}@".format("proxyuser","proxypass")client.session.proxies={'https':"{}://{}{}:{}".format('http',credentials,'<your_proxy>','3128')}HTTP Timeout Settingsfromet_api.v1import*if__name__=='__main__':client=Client("<enter_your_api_key_here>")# Timeout in seconds, connect timeoutclient.timeout=600# Timeout advanced, connect / read timeoutclient.timeout=(3.05,27)Type Hinting and Auto Completion HelpersAll dictionaries and lists have helper properties to prevent needing to identify the key values associated.LimitationsThere are currently no known limitations.For more information please see:https://apidocs.emergingthreats.net/#introduction