Package: abuseipdb-wrapper
Infopython wrapper for abuseipdb API ->https://docs.abuseipdb.com/#introductiongives you informations about abuse level of specified IP addressesfocused on local db caching and viewingInstallstable version from pypipipinstallabuseipdb-wrapperor newest version from githubpipinstallgit+https://github.com/streanger/abuseipdb-wrapper.gitCommand-line usageabusePython usageinit `AbuseIPDB` objectInitAbuseIPDBobject using API KEY created onhttps://www.abuseipdb.com/. Optionally you can providedb_filefor your local database. It is recommended becasue this project focuses on storing data for further quick access without need of another requests.fromabuseipdb_wrapperimportAbuseIPDBAPI_KEY='YOUR_API_KEY'abuse=AbuseIPDB(API_KEY=API_KEY,db_file='abuseipdb.json')abuse.colors_legend()check list of IP’sSpecify list of IP’s to check and apply them usingadd_ip_listmethod. Next step runcheckmethod and wait.ips=['1.2.3.4','5.6.7.8','9.10.11.12','13.14.15.16']abuse.add_ip_list(ips)abuse.check()abuse.tor_info_enrich()# new feature from v.0.1.7# get info about tor exit nodesno db caching approachIf you are not interested in caching data in local database and only want to request for IP addresses one by one use the following code.
Have in mind that.check_ipmethod enriches results and removesreportssection
If using wrapper is like overkill in your project, go to:https://docs.abuseipdb.com/?python#check-endpointfromabuseipdb_wrapperimportAbuseIPDBAPI_KEY='YOUR_API_KEY'abuse=AbuseIPDB(API_KEY=API_KEY)ips=['1.2.3.4','2.3.4.5','3.4.5.6']forIPinips:result=abuse.check_ip()# enriched with url and request timeresult=abuse.check_ip_orig()# results in original formprint(result)show local dbTo display collected information useshow_dbcall. Data table should be displayed on terminal. Alternatively callprinton yourAbuseIPDBobject. Before showing db you can specifiy columns to be displayed. Do it usingapply_columns_ordermethod.columns=['ipAddress','abuseConfidenceScore','totalReports','countryCode','domain','isp']abuse.apply_columns_order(columns)# show db by print or using .show_db methodprint(abuse)abuse.show_db(matched_only=False,table_view=True)db viewerFor interactive IPs check and use.viewermethod. It let you to provide list of IP’s or single one. Use help for more information.abuse.viewer()# commands inside interactive viewcolumns[columnslist]# shows or apply columns orderexport[csv,html,xlsx]# export to fileall# show all databaseexport db to csv fileabuse.export_csv('out.csv',matched_only=False)export db to styled html fileabuse.export_html_styled('out.html',matched_only=False)export db to styled xlsx fileabuse.export_xlsx_styled('out.xlsx',matched_only=False)convert to dataframe objectdf=abuse.get_df(matched_only=False)json columnsabuseConfidenceScorecountryCodedate  # additionaldomainhostnamesipAddressipVersionisPublicisWhitelistedisplastReportedAtnumDistinctUserstotalReportsurl  # additionalusageTypeisTorNode  # additionalScreenshotscli entrypointcolors legendinteractive viewer helpchecking IPsshowing IPs in vertical modeshowing IPs in table modeIdeaswrap text in table columns (not only cut off with dots)allow for justify/center tableallow for db sorting (specified by user)IP ranges for viewer -> 1.2.3.0/24think of more info than ‘data’ section in api response: reports -> comments, categoriescheck subnet 1.2.3.4/24 ->https://www.abuseipdb.com/check-block/1.2.3.4/24allow passing arguments (colors) for style_df function from abuse class levelexport html (from rich)Changelogv.0.1.7:abuseentrypointcolumnscommand in interactive viewexportcommand in interactive view (to .csv, .html, .xlsx)tor exit nodes enrichmentstoring db file in user home directoryoriginal API request ->.check_ip_origgetpass and keyring for API_KEY read & storev.0.1.6and before:black background for better view in powershellexport to html (from pandas df)export to xlsxexport to csvwrap text in table cells - made using rich tablereturn dataframe objectdate of last check