├── .gitignore ├── LICENSE ├── README.rst ├── phish_ai_api └── __init__.py ├── setup.cfg └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | .idea/ 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | env/ 13 | build/ 14 | develop-eggs/ 15 | dist/ 16 | downloads/ 17 | eggs/ 18 | .eggs/ 19 | lib/ 20 | lib64/ 21 | parts/ 22 | sdist/ 23 | var/ 24 | wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | 58 | # Flask stuff: 59 | instance/ 60 | .webassets-cache 61 | 62 | # Scrapy stuff: 63 | .scrapy 64 | 65 | # Sphinx documentation 66 | docs/_build/ 67 | 68 | # PyBuilder 69 | target/ 70 | 71 | # Jupyter Notebook 72 | .ipynb_checkpoints 73 | 74 | # pyenv 75 | .python-version 76 | 77 | # celery beat schedule file 78 | celerybeat-schedule 79 | 80 | # SageMath parsed files 81 | *.sage.py 82 | 83 | # dotenv 84 | .env 85 | 86 | # virtualenv 87 | .venv 88 | venv/ 89 | ENV/ 90 | 91 | # Spyder project settings 92 | .spyderproject 93 | .spyproject 94 | 95 | # Rope project settings 96 | .ropeproject 97 | 98 | # mkdocs documentation 99 | /site 100 | 101 | # mypy 102 | .mypy_cache/ 103 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Phish.AI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | phish-ai-api 2 | ============ 3 | .. image:: https://img.shields.io/badge/License-MIT-blue.svg 4 | .. image:: https://img.shields.io/badge/python-2.7%2B%203.5%2B-blue.svg 5 | 6 | Summary 7 | ------- 8 | Official python API for Phish.AI public and private API to detect zero-day phishing websites 9 | 10 | How it Works (TLDR) 11 | ------------------- 12 | Essentially we have a very big computer vision database of known websites and their legitimate domains. 13 | The API surf to a given website takes a screenshots of the website and then compare it with our database and if we detect that it is similar to a known website but hosted on a different domain we classify it as malicious and classify the targeted brand (which website this site tries to mimic). 14 | 15 | The Engine is in beta and doesn't protect all brands yet. we make the database bigger every day, if you believe your brand is not in our database and you want us to crawl it, just drop me a line at yp@phish.ai 16 | 17 | Privacy Policy 18 | -------------- 19 | The full privacy policy is at: https://www.phish.ai/phish-ai-privacy-policy/. By using the Public API you agree to our Privacy Policy and allow us to share your submission with the security community. If you want a Private API Key please contact us at info@phish.ai. 20 | 21 | Useful resources 22 | ---------------- 23 | * UI Version: https://app.phish.ai 24 | * Raw API Documentation: https://app.phish.ai/ (under documentation, "Thanks PyPi for not allowing minimum-cash sign") 25 | * Official website: https://www.phish.ai 26 | * Blog: https://www.phish.ai/blog 27 | * Chrome Extension: https://github.com/phishai/phish-protect 28 | 29 | Community Libraries 30 | ------------------- 31 | * NPM - https://www.npmjs.com/package/phishai (Not Official) 32 | * C# - https://github.com/AgentBurgundy/AntiPhish.NET (Not Official) 33 | 34 | Installation 35 | ------------ 36 | 37 | 38 | .. code-block:: bash 39 | 40 | $ pip install phish-ai-api 41 | 42 | 43 | Usage 44 | ----- 45 | 46 | 47 | .. code-block:: python 48 | 49 | from __future__ import print_function 50 | from phish_ai_api import API 51 | 52 | ph = API(api_key='None or private api key you can request at info@phish.ai') 53 | res = ph.scan_url('https://google.com') 54 | print(res) 55 | print(ph.get_report(res['scan_id'])) 56 | 57 | 58 | Output 59 | ------ 60 | 61 | 62 | .. code-block:: json 63 | 64 | {"scan_id": "pQz7bGMwxgzGboNyX8cy"} 65 | 66 | 67 | .. code-block:: json 68 | 69 | {"domain": "google.com", 70 | "ip_address": "74.125.124.113", 71 | "iso_code": "US", 72 | "status": "completed", 73 | "target": "Google", 74 | "time": "2018-04-15T07:27:37.860Z", 75 | "title": "google", 76 | "tld": "com", 77 | "url": "http://google.com", 78 | "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/67.0.3391.0 Safari/537.36", 79 | "user_email": "api", 80 | "verdict": "clean"} 81 | 82 | Issues & Contributing 83 | --------------------- 84 | Found a Bug/Have a feature request feel free to open an Issue and we will look into it. Cheers. 85 | -------------------------------------------------------------------------------- /phish_ai_api/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import requests 3 | 4 | ENDPOINT_URL = 'https://app.phish.ai/api/' 5 | 6 | 7 | class ApiError(Exception): 8 | pass 9 | 10 | 11 | class API(object): 12 | def __init__(self, api_key=None): 13 | self.api_key = api_key 14 | 15 | def scan_url(self, url): 16 | res = requests.post(ENDPOINT_URL + 'url/scan', data={'url': url}, headers={'Authorization': self.api_key}) 17 | if res.status_code != requests.codes.ok: 18 | raise ApiError(res.text) 19 | return res.json() 20 | 21 | def get_report(self, scan_id): 22 | res = requests.get(ENDPOINT_URL + 'url/report?scan_id=' + scan_id, headers={'Authorization': self.api_key}) 23 | if res.status_code != requests.codes.ok: 24 | raise ApiError(res.text) 25 | return res.json() -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from setuptools import setup 4 | from codecs import open 5 | 6 | 7 | def readme(): 8 | with open('README.rst', 'r', 'utf-8') as f: 9 | return f.read() 10 | 11 | 12 | setup(name='phish-ai-api', 13 | version='1.7', 14 | description='Phish.AI API wrapper', 15 | long_description=readme(), 16 | author='Yevgeny Pats', 17 | author_email='yp@phish.ai', 18 | url='https://github.com/phishai/phish-ai-api', 19 | packages=['phish_ai_api'], 20 | classifiers=['Intended Audience :: Developers', 21 | 'Natural Language :: English', 22 | 'License :: OSI Approved :: MIT License', 23 | 'Programming Language :: Python :: 2.7', 24 | 'Programming Language :: Python :: 3.5'] 25 | ) 26 | --------------------------------------------------------------------------------