├── .env ├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature-request.md └── stale.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── INSTALL.md ├── KingPhisher ├── KingPhisherServer ├── LICENSE ├── Pipfile ├── README.md ├── data ├── client │ ├── king-phisher.desktop │ └── king_phisher │ │ ├── client_config.json │ │ ├── completion │ │ ├── html.json │ │ └── jinja.json │ │ ├── king-phisher-client.ui │ │ ├── king-phisher-icon.ico │ │ ├── king-phisher-icon.svg │ │ ├── plugin-documentation.html │ │ ├── plugins │ │ └── check_for_updates.py │ │ ├── queries │ │ ├── get_campaign.graphql │ │ ├── get_campaign_export.graphql │ │ ├── get_campaigns.graphql │ │ ├── get_site_template.graphql │ │ └── get_site_templates.graphql │ │ └── style │ │ ├── _colors.scss │ │ ├── _common.scss │ │ ├── background.svg │ │ ├── theme.v1.css │ │ ├── theme.v2.css │ │ └── theme.v2.scss ├── king-phisher-logo.png ├── king-phisher.ipynb ├── king_phisher │ ├── schemas │ │ └── json │ │ │ ├── king-phisher.catalog.collections.json │ │ │ ├── king-phisher.catalog.json │ │ │ ├── king-phisher.security.json │ │ │ ├── king-phisher.security.key.json │ │ │ ├── king-phisher.server.config.json │ │ │ └── king-phisher.template.site.metadata.json │ └── security.json ├── msf │ ├── README.md │ └── sms.rb ├── pylintrc ├── server │ ├── king_phisher │ │ ├── GeoLite2-City.mmdb │ │ ├── alembic.ini │ │ ├── alembic │ │ │ ├── README │ │ │ ├── env.py │ │ │ ├── script.py.mako │ │ │ └── versions │ │ │ │ ├── 24a4a626ff7c_schema_v3.py │ │ │ │ ├── 7c315088952_schema_v4.py │ │ │ │ ├── 83e4121b299_schema_v5.py │ │ │ │ ├── a695de64338_schema_v6.py │ │ │ │ ├── b76eab0a059_schema_v7.py │ │ │ │ ├── b8443afcb9e_schema_v8.py │ │ │ │ └── c9a8d520a26_schema_v9.py │ │ ├── javascript_hook.js │ │ ├── pages │ │ │ ├── error_404.html │ │ │ ├── page-variables.html │ │ │ ├── page-variables.txt │ │ │ ├── redirect-dark.html │ │ │ └── redirect-light.html │ │ ├── server_config.yml │ │ ├── table-api.json │ │ └── youtube.js │ └── service_files │ │ ├── king-phisher.conf │ │ └── king-phisher.service └── zsh │ ├── _KingPhisher │ └── _KingPhisherServer ├── docs ├── requirements.txt └── source │ ├── _static │ └── theme_overrides.css │ ├── change_log.rst │ ├── client │ ├── completion_data.rst │ ├── configuration.rst │ ├── gobject_signals.rst │ ├── index.rst │ └── key_shortcuts.rst │ ├── conf.py │ ├── development │ ├── architecture.dot │ ├── architecture_overview.rst │ ├── classifiers.rst │ ├── environment_vars.rst │ ├── index.rst │ ├── modules.rst │ ├── release_steps.rst │ ├── signals.dot │ ├── style_guide.rst │ ├── versions_reference.rst │ └── windows_build.rst │ ├── index.rst │ ├── king_phisher │ ├── archive.rst │ ├── catalog.rst │ ├── client │ │ ├── application.rst │ │ ├── assistants │ │ │ ├── campaign.rst │ │ │ └── index.rst │ │ ├── client_rpc.rst │ │ ├── dialogs │ │ │ ├── about.rst │ │ │ ├── campaign_selection.rst │ │ │ ├── clone_page.rst │ │ │ ├── company_editor.rst │ │ │ ├── configuration.rst │ │ │ ├── entry.rst │ │ │ ├── exception.rst │ │ │ ├── index.rst │ │ │ ├── login.rst │ │ │ ├── ssh_host_key.rst │ │ │ └── tag_editor.rst │ │ ├── export.rst │ │ ├── graphs.rst │ │ ├── gui_utilities.rst │ │ ├── index.rst │ │ ├── mailer.rst │ │ ├── plugins.rst │ │ ├── server_events.rst │ │ ├── tabs │ │ │ ├── campaign.rst │ │ │ ├── index.rst │ │ │ └── mail.rst │ │ ├── web_cloner.rst │ │ ├── widget │ │ │ ├── completion_providers.rst │ │ │ ├── extras.rst │ │ │ ├── index.rst │ │ │ ├── managers.rst │ │ │ └── resources.rst │ │ └── windows │ │ │ ├── campaign_import.rst │ │ │ ├── compare_campaigns.rst │ │ │ ├── html.rst │ │ │ ├── index.rst │ │ │ ├── main.rst │ │ │ ├── plugin_manager.rst │ │ │ └── rpc_terminal.rst │ ├── color.rst │ ├── constants.rst │ ├── errors.rst │ ├── find.rst │ ├── geoip.rst │ ├── ics.rst │ ├── index.rst │ ├── ipaddress.rst │ ├── its.rst │ ├── plugins.rst │ ├── security_keys.rst │ ├── serializers.rst │ ├── server │ │ ├── aaa.rst │ │ ├── build.rst │ │ ├── configuration.rst │ │ ├── database │ │ │ ├── index.rst │ │ │ ├── manager.rst │ │ │ ├── models.rst │ │ │ ├── storage.rst │ │ │ └── validation.rst │ │ ├── fs_utilities.rst │ │ ├── graphql │ │ │ ├── index.rst │ │ │ ├── middleware.rst │ │ │ ├── schema.rst │ │ │ └── types │ │ │ │ ├── database.rst │ │ │ │ └── index.rst │ │ ├── index.rst │ │ ├── letsencrypt.rst │ │ ├── plugins.rst │ │ ├── pylibc.rst │ │ ├── rest_api.rst │ │ ├── server.rst │ │ ├── server_rpc.rst │ │ ├── signals.rst │ │ ├── template_extras.rst │ │ ├── web_sockets.rst │ │ └── web_tools.rst │ ├── sms.rst │ ├── smtp_server.rst │ ├── spf.rst │ ├── ssh_forward.rst │ ├── startup.rst │ ├── templates.rst │ ├── testing.rst │ ├── ua_parser.rst │ ├── utilities.rst │ ├── version.rst │ └── xor.rst │ ├── plugins │ ├── client.rst │ ├── compatibility.rst │ ├── index.rst │ └── server.rst │ └── server │ ├── database │ ├── database_relationships.dot │ ├── index.rst │ ├── overview.rst │ └── schema.rst │ ├── graphql │ ├── example_queries.rst │ ├── index.rst │ ├── overview.rst │ └── schema.rst │ ├── index.rst │ ├── published_events.rst │ ├── rest_api.rst │ ├── rpc_api.rst │ └── signals.rst ├── king_phisher ├── __init__.py ├── archive.py ├── catalog.py ├── client │ ├── __init__.py │ ├── __main__.py │ ├── application.py │ ├── assistants │ │ ├── __init__.py │ │ └── campaign.py │ ├── client_rpc.py │ ├── dialogs │ │ ├── __init__.py │ │ ├── about.py │ │ ├── campaign_selection.py │ │ ├── clone_page.py │ │ ├── company_editor.py │ │ ├── configuration.py │ │ ├── entry.py │ │ ├── exception.py │ │ ├── login.py │ │ ├── ssh_host_key.py │ │ └── tag_editor.py │ ├── export.py │ ├── graphs.py │ ├── gui_utilities.py │ ├── mailer.py │ ├── plugins.py │ ├── server_events.py │ ├── tabs │ │ ├── __init__.py │ │ ├── campaign.py │ │ └── mail.py │ ├── web_cloner.py │ ├── widget │ │ ├── __init__.py │ │ ├── completion_providers.py │ │ ├── extras.py │ │ ├── managers.py │ │ └── resources.py │ └── windows │ │ ├── __init__.py │ │ ├── campaign_import.py │ │ ├── compare_campaigns.py │ │ ├── html.py │ │ ├── main.py │ │ ├── plugin_manager.py │ │ └── rpc_terminal.py ├── color.py ├── constants.py ├── errors.py ├── find.py ├── geoip.py ├── ics.py ├── ipaddress.py ├── its.py ├── plugins.py ├── security_keys.py ├── serializers.py ├── server │ ├── __init__.py │ ├── __main__.py │ ├── aaa.py │ ├── build.py │ ├── configuration.py │ ├── database │ │ ├── __init__.py │ │ ├── manager.py │ │ ├── models.py │ │ ├── schema_migration.py │ │ ├── storage.py │ │ └── validation.py │ ├── fs_utilities.py │ ├── graphql │ │ ├── __init__.py │ │ ├── middleware.py │ │ ├── schema.py │ │ └── types │ │ │ ├── __init__.py │ │ │ ├── database.py │ │ │ ├── misc.py │ │ │ ├── ssl.py │ │ │ └── templates.py │ ├── letsencrypt.py │ ├── plugins.py │ ├── pylibc.py │ ├── rest_api.py │ ├── server.py │ ├── server_rpc.py │ ├── signals.py │ ├── template_extras.py │ ├── web_sockets.py │ └── web_tools.py ├── sms.py ├── smtp_server.py ├── spf.py ├── sphinxext │ ├── __init__.py │ ├── _exttools.py │ ├── database.py │ ├── graphql.py │ └── rpc.py ├── ssh_forward.py ├── startup.py ├── templates.py ├── testing.py ├── ua_parser.py ├── utilities.py ├── version.py └── xor.py ├── readthedocs.yml ├── tests ├── __init__.py ├── client │ ├── __init__.py │ ├── application.py │ ├── client_rpc.py │ ├── dialogs.py │ ├── export.py │ ├── graphs.py │ ├── gtk_builder.py │ ├── gui_utilities.py │ ├── mailer.py │ ├── server_events.py │ └── widget │ │ ├── __init__.py │ │ ├── completion_providers.py │ │ └── managers.py ├── color.py ├── find.py ├── geoip.py ├── ics.py ├── ipaddress.py ├── pipfile.py ├── plugins.py ├── security_keys.py ├── serializers.py ├── server │ ├── __init__.py │ ├── aaa.py │ ├── configuration.py │ ├── database │ │ ├── __init__.py │ │ ├── manager.py │ │ ├── models.py │ │ ├── storage.py │ │ └── validation.py │ ├── graphql.py │ ├── letsencrypt.py │ ├── rest_api.py │ ├── server.py │ ├── server_rpc.py │ ├── template_extras.py │ └── web_tools.py ├── sms.py ├── spf.py ├── templates.py ├── ua_parser.py ├── utilities.py ├── version.py └── xor.py └── tools ├── certbot_wrapper.py ├── database_console.py ├── debug_smtp_server.py ├── development ├── build_msi.bat ├── cx_freeze.py ├── key_tool.py └── test_runner.py ├── install.sh ├── mac_client ├── Dockerfile └── README.md ├── otp_enroll.py ├── spf_check.py ├── targets_from_recon_ng.py └── uninstall.sh /.env: -------------------------------------------------------------------------------- 1 | PIPENV_VENV_IN_PROJECT=True 2 | 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.mmdb filter=lfs diff=lfs merge=lfs -text 2 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | The intent of this document is to outline the steps for a user to get started 3 | with making contributions to the main King Phisher repository or one of it's 4 | subproject repositories. 5 | 6 | ## Making Changes 7 | The following steps are used to propose changes to the repository in the form 8 | of a pull request. 9 | 10 | * Clone the repository 11 | * Create a topic branch that is up to date with the `dev` branch 12 | * Make your changes to this branch 13 | * Ensure all unit tests pass after the changes are implemented 14 | * Push the topic branch up to your repository on GitHub 15 | * Submit a Pull Request to the `dev` branch 16 | * Explain what the changes do (why they are useful, what they fix etc.) 17 | * When fixing a bug, include instructions to reproduce it and error 18 | message details if applicable 19 | * Include steps to test the changes 20 | * Work with the repository owners by answering questions and making changes 21 | * Wait for the pull request to be merged 22 | * Enjoy a tasty beverage, you earned it! 23 | 24 | Some things that will increase the chance that your pull request is accepted 25 | and generally speed things along: 26 | 27 | * Write documentation for functions that are not event or signal handlers 28 | * Write unit tests 29 | * Follow our [style guide][style] 30 | * Run style checks with `pylint --rcfile=data/pylintrc path/to/changed/files` 31 | and ensure no warnings or errors are present 32 | * Write a [good commit message][commit] 33 | 34 | [style]: http://king-phisher.readthedocs.io/en/latest/development/style_guide.html 35 | [commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Report an issue that you're experiencing 4 | 5 | --- 6 | 7 | ## Issue Description 8 | I experience an issue when I... and the results I expected are... 9 | 10 | ## Reproduction Steps 11 | 1. Start King Phisher 12 | 2. Do something to trigger the crash 13 | 14 | ## Environment Details 15 | 16 | Host OS: Ubuntu 18.04 GNOME, Kali 2, etc. 17 | King Phisher Version: x.y.z 18 | 19 | ## Error Details / Stack Trace 20 | 21 | ``` 22 | If you are opening an issue regarding the client, copy text from the "Error 23 | Details" of the error dialog in the client here. If you are opening an issue 24 | regarding the server copy the relevant lines from the logs here. 25 | ``` 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | # Feature Description 8 | 9 | 10 | ## Alternatives Solutions 11 | 12 | 13 | ## Example Use Case 14 | 15 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 21 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: stale 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.conf 2 | *.css.map 3 | *.db 4 | *.geany 5 | *.html 6 | *.log 7 | *.mmdb 8 | *.py[cod] 9 | *.yml 10 | *.yml.bck* 11 | 12 | .pylintrc 13 | .python-version 14 | .venv 15 | .venv/* 16 | Pipfile.lock 17 | build/* 18 | configs/* 19 | dist/* 20 | docs/build/* 21 | docs/coverage/* 22 | docs/html/* 23 | ssl/* 24 | 25 | lextab.py 26 | yacctab.py 27 | DODO 28 | todo.txt 29 | notes.txt 30 | 31 | data/.ipynb_checkpoints/* 32 | data/client/king_phisher/#king-phisher-client.ui# 33 | data/client/king_phisher/king-phisher-client.ui~ 34 | data/server/king_phisher/plugins/* 35 | data/client/king_phisher/style/.sass-cache/* 36 | !.github/*.yml 37 | !data/client/king_phisher/plugin-documentation.html 38 | !data/server/docker/docker-compose.yml 39 | !data/server/king_phisher/*.mmdb 40 | !data/server/king_phisher/error_*.html 41 | !data/server/king_phisher/server_config.yml 42 | !data/server/king_phisher/server_config_verification.yml 43 | !data/server/king_phisher/service_files/* 44 | !data/*/king_phisher/*/*.html 45 | !readthedocs.yml 46 | 47 | # ignore mprofile output 48 | mprofile_*.dat 49 | 50 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Install ![GitHub Downloads][downloads-status] 2 | The King Phisher client is supported on Windows and Linux, while the King Phisher 3 | server is only supported on Linux. 4 | 5 | ## Linux (Client & Server) 6 | For installation on [supported Linux][operating-systems] distros: 7 | 8 | ```bash 9 | wget -q https://github.com/securestate/king-phisher/raw/master/tools/install.sh && \ 10 | sudo bash ./install.sh 11 | ``` 12 | 13 | This process may result in errors being displayed. In this case, allow 14 | the installation process to continue as it will attempt to address as 15 | many of them as it can. 16 | 17 | ## Windows (Client Only) 18 | Download the latest [Windows build here.][releases] 19 | 20 | ### Windows 10 Subsystem For Linux (WSL) 21 | This is recommend for windows users as this will provide faster performance and 22 | more features. 23 | 24 | - Enable [WSL][wsl] 25 | - When choosing your linux distro select Ubuntu 18.04 or Kali 26 | - Download and install a X Window System Server. The two below are the most popular 27 | - [Xming][xming] 28 | - [VcXsrv][vcxsrv] 29 | - From powershell run `bash` to get your linux terminal 30 | - run `echo "export DISPLAY=127.0.0.1:0.0" >> ~/.bashrc` 31 | - Install King Phisher with the commands from the Linux (Client & Server) section above 32 | - Change working directory to King Phisher and start client 33 | - `cd /opt/king-phisher` 34 | - `./KingPhisher` 35 | 36 | ## Getting Started 37 | - [Getting Started][wiki-getting-started] 38 | - [How to videos][videos] 39 | - [Wiki][wiki] 40 | 41 | [downloads-status]: https://img.shields.io/github/downloads/securestate/king-phisher/total.svg?style=flat-square 42 | [operating-systems]: https://github.com/securestate/king-phisher/wiki/Advanced-Installation#install-script-supported-flavors 43 | [releases]: https://github.com/securestate/king-phisher/releases 44 | [videos]: https://securestate.wistia.com/projects/laevqz2p29 45 | [wiki]: https://github.com/securestate/king-phisher/wiki 46 | [wiki-getting-started]: https://github.com/securestate/king-phisher/wiki/Getting-Started 47 | [wsl]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 48 | [vcxsrv]: https://sourceforge.net/projects/vcxsrv/ 49 | [xming]: https://sourceforge.net/projects/xming/ 50 | -------------------------------------------------------------------------------- /KingPhisher: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 -B 2 | # -*- coding: utf-8 -*- 3 | # 4 | # KingPhisher 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import argparse 34 | import os 35 | import sys 36 | 37 | from king_phisher import startup 38 | 39 | def main(): 40 | parser = argparse.ArgumentParser(description='King Phisher Client', conflict_handler='resolve') 41 | startup.argp_add_client(parser) 42 | return startup.pipenv_entry(parser, os.path.basename(__file__)) 43 | 44 | if __name__ == '__main__': 45 | sys.exit(main()) 46 | -------------------------------------------------------------------------------- /KingPhisherServer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 -B 2 | # -*- coding: utf-8 -*- 3 | # 4 | # KingPhisherServer 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import argparse 34 | import os 35 | import sys 36 | 37 | from king_phisher import startup 38 | 39 | def main(): 40 | parser = argparse.ArgumentParser(description='King Phisher Server', conflict_handler='resolve') 41 | startup.argp_add_server(parser) 42 | return startup.pipenv_entry(parser, os.path.basename(__file__)) 43 | 44 | if __name__ == '__main__': 45 | sys.exit(main()) 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2018, SecureState LLC 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of the project nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | setuptools = "==41.2.0" 8 | alembic = "==1.2.0" 9 | blinker = "==1.4" 10 | boltons = "==19.1.0" 11 | cryptography = "==2.7.0" 12 | Cython = "==0.29.13" 13 | dnspython = "==1.16.0" 14 | ecdsa = "==0.13.3" 15 | geoip2 = "==2.9.0" 16 | geojson = "==2.5.0" 17 | graphene = "==2.1.8" 18 | graphene-sqlalchemy = "==2.1.2" 19 | graphql-relay = "==2.0.0" 20 | icalendar = "==4.0.3" 21 | ipaddress = "==1.0.22" 22 | jsonschema = "==2.6.0" 23 | msgpack-python = "==0.5.6" 24 | paramiko = "==2.6.0" 25 | pluginbase = "==1.0.0" 26 | psycopg2 = "==2.8.3" 27 | py-gfm = "==0.1.4" 28 | pygobject = "==3.34.0" 29 | pyotp = "==2.3.0" 30 | python-pam = "==1.8.4" 31 | pytz = "==2019.2" 32 | requests = "==2.22.0" 33 | requests-file = "==1.4.3" 34 | six = "==1.12.0" 35 | smoke-zephyr = "==1.4.1" 36 | termcolor = "==1.1.0" 37 | tzlocal = "==2.0.0" 38 | websocket-client = "==0.56.0" 39 | AdvancedHTTPServer = "~=2.2" 40 | email_validator = "==1.0.4" 41 | Jinja2 = "==2.11.3" 42 | Markdown = "==2.6.11" 43 | MarkupSafe = "==1.1.1" 44 | PyYAML = "==5.4" 45 | SQLAlchemy = "==1.3.8" 46 | XlsxWriter = "==1.2.1" 47 | numpy = "==1.20.2" 48 | rule-engine = "~=1.1" 49 | matplotlib = "==2.2.4" 50 | 51 | [dev-packages] 52 | sphinx = "==1.7.9" 53 | sphinxcontrib-httpdomain = "==1.5.0" 54 | sphinx-rtd-theme = "==0.4.2" 55 | ipython = "*" 56 | pyopenssl = "==18.0.0" 57 | ipdb = "*" 58 | jupyter = "*" 59 | ipykernel = "*" 60 | 61 | [scripts] 62 | KingPhisher = "python -m king_phisher.client" 63 | KingPhisherServer = "python -m king_phisher.server" 64 | unittest = "python -m unittest -v tests" 65 | 66 | [pipenv] 67 | allow_site_packages = true 68 | -------------------------------------------------------------------------------- /data/client/king-phisher.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=King Phisher 3 | GenericName=King Phisher 4 | Exec=/usr/bin/python3 /opt/king-phisher/KingPhisher 5 | Path=/opt/king-phisher 6 | Terminal=false 7 | Type=Application 8 | Categories=Network;Security; 9 | Comment=Phishing Campaign Toolkit 10 | Icon=king-phisher-icon 11 | -------------------------------------------------------------------------------- /data/client/king_phisher/client_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "cache.age": "4h", 3 | "catalogs": [ 4 | "https://raw.githubusercontent.com/securestate/king-phisher-plugins/master/catalog.json" 5 | ], 6 | "dashboard.bottom": "VisitsTimeline", 7 | "dashboard.top_left": "Overview", 8 | "dashboard.top_right": "VisitorInfo", 9 | "filter.campaign.expired": false, 10 | "filter.campaign.other_users": false, 11 | "filter.campaign.user": true, 12 | "gui.show_deaddrop": false, 13 | "mailer.attachment_file": "", 14 | "mailer.attachment_file.post_processing": null, 15 | "mailer.calendar_invite_all_day": false, 16 | "mailer.calendar_invite_date": { 17 | "__complex_type__": "datetime.date", 18 | "value": "2015-10-19" 19 | }, 20 | "mailer.calendar_invite_duration": 60.0, 21 | "mailer.calendar_invite_location": "", 22 | "mailer.calendar_invite_start_hour": 12.0, 23 | "mailer.calendar_invite_start_minute": 0.0, 24 | "mailer.calendar_invite_summary": "", 25 | "mailer.calendar_request_rsvp": false, 26 | "mailer.company_name": "", 27 | "mailer.html_file": "", 28 | "mailer.importance": "Normal", 29 | "mailer.max_messages_per_connection": 5, 30 | "mailer.message_type": "email", 31 | "mailer.message_uid.charset": { 32 | "digits": true, 33 | "lower": true, 34 | "upper": true 35 | }, 36 | "mailer.recipient_email_cc": "", 37 | "mailer.recipient_email_to": "", 38 | "mailer.reply_to_email": "", 39 | "mailer.sensitivity": "Normal", 40 | "mailer.source_email": "", 41 | "mailer.source_email_alias": "", 42 | "mailer.source_email_smtp": "", 43 | "mailer.subject": "", 44 | "mailer.target_email_address": "", 45 | "mailer.target_field": "to", 46 | "mailer.target_file": "", 47 | "mailer.target_name": "", 48 | "mailer.target_type": "file", 49 | "mailer.webserver_url": "", 50 | "plugins": {}, 51 | "plugins.enabled": [], 52 | "plugins.installed": {}, 53 | "plugins.pip.install_dependencies": true, 54 | "proxy.url": null, 55 | "rpc.serializer": null, 56 | "server": "localhost:22", 57 | "server.history": [], 58 | "server_remote_port": 80, 59 | "server_use_ssl": false, 60 | "server_username": "", 61 | "sftp_client": "filezilla --logontype=interactive sftp://{username}@{server}{web_root}", 62 | "smtp_max_send_rate": 45.0, 63 | "smtp_server": "localhost:25", 64 | "smtp_ssh_enable": false, 65 | "smtp_ssl_enable": false, 66 | "smtp_username": "", 67 | "spf_check_level": 1, 68 | "spf_check_timeout": 10, 69 | "ssh_preferred_key": null, 70 | "ssh_server": "localhost:22", 71 | "ssh_username": "", 72 | "text_font": "monospace 11", 73 | "text_source.theme": "cobalt" 74 | } 75 | -------------------------------------------------------------------------------- /data/client/king_phisher/king-phisher-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/data/client/king_phisher/king-phisher-icon.ico -------------------------------------------------------------------------------- /data/client/king_phisher/plugin-documentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ plugin.title }} 5 | 11 | 12 | 13 |

{{ plugin.title }}

14 | {{ markdown }} 15 | 16 | 17 | -------------------------------------------------------------------------------- /data/client/king_phisher/plugins/check_for_updates.py: -------------------------------------------------------------------------------- 1 | import distutils.version 2 | 3 | import king_phisher.version as version 4 | import king_phisher.client.plugins as plugins 5 | import king_phisher.client.gui_utilities as gui_utilities 6 | 7 | import requests 8 | import requests.exceptions 9 | 10 | StrictVersion = distutils.version.StrictVersion 11 | 12 | def release_to_version(release): 13 | return StrictVersion(release['tag_name'][1:]) 14 | 15 | def get_latest_release(): 16 | try: 17 | releases = requests.get('https://api.github.com/repos/securestate/king-phisher/releases').json() 18 | except requests.exceptions.ConnectionError: 19 | return None 20 | releases = [release for release in releases if not release['draft']] 21 | releases = sorted( 22 | releases, 23 | key=release_to_version, 24 | reverse=True 25 | ) 26 | return releases[0] 27 | 28 | class Plugin(plugins.ClientPlugin): 29 | authors = ['Spencer McIntyre'] 30 | title = 'Check For Updates' 31 | description = """ 32 | Automatically check for updates to the King Phisher project by inspecting 33 | the latest GitHub releases. If a new version has been released, the user 34 | will be notified with a dialog box after logging into the server. 35 | """ 36 | homepage = 'https://github.com/securestate/king-phisher' 37 | version = '1.0.1' 38 | def initialize(self): 39 | self.signal_connect('server-connected', self.signal_server_connected) 40 | return True 41 | 42 | def signal_server_connected(self, _): 43 | release = get_latest_release() 44 | if release is None: 45 | self.logger.error('failed to find the latest release') 46 | return 47 | self.logger.info('found latest release: ' + release['tag_name']) 48 | client_version = StrictVersion(version.distutils_version) 49 | release_version = release_to_version(release) 50 | server_version = self.application.rpc('version')['version_info'] 51 | server_version = StrictVersion("{major}.{minor}.{micro}".format(**server_version)) 52 | out_of_date = None 53 | 54 | if release_version > client_version: 55 | out_of_date = 'Client' 56 | elif release_version > server_version: 57 | out_of_date = 'Server' 58 | if out_of_date is None: 59 | return 60 | 61 | gui_utilities.show_dialog_info( 62 | 'New Version Available', 63 | self.application.main_window, 64 | "The King Phisher {part} is out of date,\n" 65 | "{release[tag_name]} is now available.".format(part=out_of_date, release=release), 66 | secondary_use_markup=True 67 | ) 68 | -------------------------------------------------------------------------------- /data/client/king_phisher/queries/get_campaign.graphql: -------------------------------------------------------------------------------- 1 | # retrieve a campaign by it's ID 2 | query getCampaign($id: String!) { 3 | db { 4 | campaign(id: $id) { 5 | id 6 | created 7 | name 8 | description 9 | expiration 10 | maxCredentials 11 | 12 | credentialRegexUsername 13 | credentialRegexPassword 14 | credentialRegexMfaToken 15 | 16 | campaignType { 17 | id 18 | name 19 | } 20 | company { 21 | id 22 | name 23 | } 24 | user { 25 | id 26 | name 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /data/client/king_phisher/queries/get_campaigns.graphql: -------------------------------------------------------------------------------- 1 | # retrieve information about all the campaigns 2 | query getCampaigns($cursor: String, $page: Int) { 3 | db { 4 | campaigns(first: $page, after: $cursor) { 5 | edges { 6 | node { 7 | id 8 | created 9 | description 10 | expiration 11 | name 12 | company { 13 | name 14 | } 15 | campaignType { 16 | name 17 | } 18 | messages { 19 | total 20 | } 21 | user { 22 | name 23 | } 24 | } 25 | } 26 | pageInfo { 27 | hasNextPage 28 | startCursor 29 | endCursor 30 | } 31 | total 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data/client/king_phisher/queries/get_site_template.graphql: -------------------------------------------------------------------------------- 1 | # retrieve information for site templates by hostname 2 | query getSiteTemplates($hostname: String!) { 3 | siteTemplates(hostname: $hostname) { 4 | edges { 5 | node { 6 | created 7 | hostname 8 | path 9 | metadata { 10 | authors 11 | classifiers 12 | description 13 | pages 14 | } 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /data/client/king_phisher/queries/get_site_templates.graphql: -------------------------------------------------------------------------------- 1 | # retrieve information for all site templates 2 | query getSiteTemplates { 3 | siteTemplates { 4 | edges { 5 | node { 6 | created 7 | hostname 8 | path 9 | metadata { 10 | authors 11 | classifiers 12 | description 13 | pages 14 | } 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /data/client/king_phisher/style/_colors.scss: -------------------------------------------------------------------------------- 1 | $theme_color_0: #00203a; 2 | $theme_color_1: #5d84a8; 3 | $theme_color_2: #00bf8c; 4 | $theme_color_bg: shade($theme_color_0, 1.2); 5 | $theme_color_fg: #ffffff; 6 | $theme_color_tv_bg: $theme_color_0; 7 | $theme_color_tv_fg: #ffffff; 8 | $theme_color_tv_hobg: $theme_color_1; 9 | $theme_color_tv_hofg: #ffffff; 10 | 11 | /* two primary colors for mixing and one for highlighting */ 12 | @define-color theme_color_0 #{"" + $theme_color_0}; 13 | @define-color theme_color_1 #{"" + $theme_color_1}; 14 | @define-color theme_color_2 #{"" + $theme_color_2}; 15 | @define-color theme_color_bg #{"" + $theme_color_bg}; 16 | 17 | /* treeview normal */ 18 | @define-color theme_color_tv_bg #{"" + $theme_color_tv_bg}; 19 | @define-color theme_color_tv_fg #{"" + $theme_color_tv_fg}; 20 | /* treeview highlight */ 21 | @define-color theme_color_tv_hlbg @theme_color_2; 22 | @define-color theme_color_tv_hlfg white; 23 | /* treeview hover */ 24 | @define-color theme_color_tv_hobg #{"" + $theme_color_tv_hobg}; 25 | @define-color theme_color_tv_hofg #{"" + $theme_color_tv_hofg}; 26 | /* graph colors */ 27 | @define-color theme_color_graph_bg #254866; 28 | @define-color theme_color_graph_fg #ffffff; 29 | @define-color theme_color_graph_bar_bg #3c5b77; 30 | @define-color theme_color_graph_bar_fg #c0dcff; 31 | @define-color theme_color_graph_line_bg #92a4b3; 32 | @define-color theme_color_graph_line_fg #002645; 33 | @define-color theme_color_graph_map_land #3c5b77; 34 | @define-color theme_color_graph_map_marker1 #ffc20f; 35 | @define-color theme_color_graph_map_marker2 @theme_color_2; 36 | @define-color theme_color_graph_map_water #c0dcff; 37 | @define-color theme_color_graph_pie_high #c0dcff; 38 | @define-color theme_color_graph_pie_low #3c5b77; 39 | -------------------------------------------------------------------------------- /data/client/king_phisher/style/_common.scss: -------------------------------------------------------------------------------- 1 | $transition: 200ms ease-out; 2 | 3 | @function gtkalpha($c, $a) { 4 | @return unquote("alpha(#{$c}, #{$a})"); 5 | } 6 | 7 | /* background mixins */ 8 | @mixin bg-opaque() { 9 | background-color: $theme_color_bg; 10 | background-image: none; 11 | color: $theme_color_fg; 12 | } 13 | 14 | /* border mixins */ 15 | @mixin bo-opaque() { 16 | border: 1px solid; 17 | border-color: $theme_color_bg; 18 | border-radius: 3px; 19 | &:disabled { 20 | border-color: white; 21 | } 22 | } 23 | 24 | /* button mixins */ 25 | @mixin btn-text() { 26 | background-image: none; 27 | border: 1px solid; 28 | border-color: transparent; 29 | border-radius: 3px; 30 | padding: 2px 2px 4px; 31 | transition: $transition; 32 | &:hover { 33 | @include bo-opaque(); 34 | background-color: gtkalpha($theme_color_0, 0.8); 35 | color: $theme_color_1; 36 | padding: 2px 2px 4px; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /data/king-phisher-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/data/king-phisher-logo.png -------------------------------------------------------------------------------- /data/king_phisher/schemas/json/king-phisher.security.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": {}, 4 | "id": "king-phisher.security", 5 | "properties": { 6 | "keys": { 7 | "id": "/properties/keys", 8 | "items": { 9 | "id": "/properties/keys/items", 10 | "properties": { 11 | "id": { 12 | "id": "/properties/keys/items/properties/id", 13 | "type": "string" 14 | }, 15 | "verifying-key": { 16 | "id": "/properties/keys/items/properties/verifying-key", 17 | "properties": { 18 | "data": { 19 | "id": "/properties/keys/items/properties/verifying-key/properties/encoding", 20 | "type": "string" 21 | }, 22 | "data": { 23 | "id": "/properties/keys/items/properties/verifying-key/properties/data", 24 | "type": "string" 25 | }, 26 | "type": { 27 | "id": "/properties/keys/items/properties/verifying-key/properties/type", 28 | "type": "string" 29 | } 30 | }, 31 | "required": [ 32 | "data", 33 | "type" 34 | ], 35 | "type": "object" 36 | } 37 | }, 38 | "required": [ 39 | "verifying-key", 40 | "id" 41 | ], 42 | "type": "object" 43 | }, 44 | "minItems": 1, 45 | "type": "array" 46 | } 47 | }, 48 | "required": [ 49 | "keys" 50 | ], 51 | "type": "object" 52 | } 53 | -------------------------------------------------------------------------------- /data/king_phisher/schemas/json/king-phisher.security.key.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "additionalProperties": false, 4 | "definitions": {}, 5 | "id": "king-phisher.security.key", 6 | "properties": { 7 | "id": { 8 | "id": "/properties/id", 9 | "type": "string" 10 | }, 11 | "signing-key": { 12 | "additionalProperties": false, 13 | "id": "/properties/signing-key", 14 | "properties": { 15 | "data": { 16 | "id": "/properties/signing-key/properties/data", 17 | "type": "string" 18 | }, 19 | "encoding": { 20 | "id": "/properties/signing-key/properties/encoding", 21 | "type": "string" 22 | }, 23 | "type": { 24 | "id": "/properties/signing-key/properties/type", 25 | "type": "string" 26 | } 27 | }, 28 | "required": [ 29 | "data", 30 | "type" 31 | ], 32 | "type": "object" 33 | }, 34 | "verifying-key": { 35 | "additionalProperties": false, 36 | "id": "/properties/verifying-key", 37 | "properties": { 38 | "data": { 39 | "id": "/properties/verifying-key/properties/data", 40 | "type": "string" 41 | }, 42 | "encoding": { 43 | "id": "/properties/verifying-key/properties/encoding", 44 | "type": "string" 45 | }, 46 | "type": { 47 | "id": "/properties/verifying-key/properties/type", 48 | "type": "string" 49 | } 50 | }, 51 | "required": [ 52 | "data", 53 | "type" 54 | ], 55 | "type": "object" 56 | } 57 | }, 58 | "required": [ 59 | "id" 60 | ], 61 | "type": "object" 62 | } -------------------------------------------------------------------------------- /data/king_phisher/schemas/json/king-phisher.template.site.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": {}, 4 | "id": "king-phisher.template.site.metadata", 5 | "properties": { 6 | "authors": { 7 | "id": "/properties/authors", 8 | "items": { 9 | "id": "/properties/authors/items", 10 | "type": "string" 11 | }, 12 | "minItems": 1, 13 | "type": "array" 14 | }, 15 | "classifiers": { 16 | "id": "/properties/classifiers", 17 | "items": { 18 | "id": "/properties/classifiers/items", 19 | "type": "string" 20 | }, 21 | "minItems": 1, 22 | "type": "array" 23 | }, 24 | "description": { 25 | "id": "/properties/description", 26 | "type": "string" 27 | }, 28 | "homepage": { 29 | "id": "/properties/homepage", 30 | "type": "string" 31 | }, 32 | "pages": { 33 | "id": "/properties/pages", 34 | "items": { 35 | "id": "/properties/pages/items", 36 | "type": "string" 37 | }, 38 | "minItems": 1, 39 | "type": "array" 40 | }, 41 | "reference_urls": { 42 | "id": "/properties/reference_urls", 43 | "items": { 44 | "id": "/properties/reference_urls/items", 45 | "type": "string" 46 | }, 47 | "minItems": 1, 48 | "type": "array" 49 | }, 50 | "title": { 51 | "id": "/properties/title", 52 | "type": "string" 53 | }, 54 | "version": { 55 | "id": "/properties/version", 56 | "type": "string" 57 | } 58 | }, 59 | "required": [ 60 | "authors", 61 | "description", 62 | "pages", 63 | "title", 64 | "version" 65 | ], 66 | "type": "object" 67 | } 68 | -------------------------------------------------------------------------------- /data/king_phisher/security.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": [ 3 | { 4 | "id": "github.com/Nib0x62s", 5 | "verifying-key": { 6 | "data": "AM1SXQrNRBhnQDPRcpFBOo25ewChSLiZdzsZ/j79DNHFySQHB7GAeRdIdbe/ahegWEVSbnkJnuUcVBAlBJ2aO/iEAWFGOMULYyR2gIII9GWqa/es6DOCG6yZSsLGpeTI17+jc/T4t4NLkyhO7qQkunj5DBphdvzb5zi9ignqJqQDwN6E", 7 | "type": "secp521r1" 8 | } 9 | }, 10 | { 11 | "id": "github.com/wolfthefallen", 12 | "verifying-key": { 13 | "data": "AeFgSLT7Rk0iK954S4/ejCWH2/gN0E8Y2hdchKESYKVbn2CbeZTHVEKCts5B7KsOa/7s6bTK7BVwQMBmVCBCZJvdALNgmyglIfxfgTHf19vVq/Wq2SxYwxwZOE/nxAQxwbd2mVURlE4Dglcq6Ij12sqoLQTcov8S3t9NODmxo/Krud6b", 14 | "type": "secp521r1" 15 | } 16 | }, 17 | { 18 | "id": "github.com/zeroSteiner", 19 | "verifying-key": { 20 | "data": "ADcVhmRWMoPyyqE+gv9a7l/+d+BzXcjqid+QkAAMlHBCvnJLatHfHK4aRo4lqwr4nV2hcQSJ4U4ss4sKc2GoIE7jADzJEstGPkuzN7uRZ1Q3odo002hw0OpW9mUBiUqeMYI+aBcH2qpov0pjRJjNW4KJtSxIqF0eXDavz38aMztjmQDB", 21 | "type": "secp521r1" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /data/msf/README.md: -------------------------------------------------------------------------------- 1 | # SMS Plugin 2 | The [SMS](sms) plugin uses King Phisher's [REST API](rest-api-docs) to send SMS 3 | messages when a new [Metasploit](metasploit) session is received. King Phisher's 4 | REST API is accessible externally which allows running the SMS plugin within 5 | Metasploit, on a system other than the King Phisher server. The system running 6 | Metasploit only needs to be able to make a HTTP GET request to the King Phisher 7 | server. 8 | 9 | ## King Phisher Configuration 10 | Edit King Phisher's `server_config.yml` file, under the `rest_api` set the 11 | `enabled` value to `true`. 12 | 13 | Change the `token` value from `null` to a secret string that will be used to 14 | access the King Phisher server's REST API remotely. Running this one-liner in 15 | Linux will return a randomly generated 32 character string which can be used. 16 | 17 | ```cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1``` 18 | 19 | Save the server configuration file and restart the King Phisher server. 20 | 21 | ## Metasploit Configuration and Usage 22 | Add the [sms.rb](sms) file to your Metasploit `~/.msf4/plugins` directory. 23 | 24 | If this is the first time using the SMS plugin, you will need to set four values 25 | which will be saved in `~/.msf4/sms.yaml`. On future use, these settings will 26 | automatically be loaded and do not need to be set again. Additionally you can 27 | see descriptions of the SMS plugin commands by running `help` in msfconsole. 28 | 29 | * Start Metasploit and load the SMS plugin. 30 | 31 | `load sms` 32 | 33 | * Set the domain name of your King Phisher server. 34 | 35 | `sms_set_server king-phisher.com` 36 | 37 | * Set the King Phisher server's REST API token. 38 | 39 | `sms_set_token 0123456789abcdefABCDEF` 40 | 41 | * Set the cellphone number where you would like to receive SMS messages. 42 | 43 | `sms_set_number 0123456789` 44 | 45 | * Set your cell phone carrier. Currently King Phisher supports AT&T, Boost, Sprint, T-Mobile, Verizon, Virgin Mobile. 46 | 47 | `sms_set_carrier Boost` 48 | 49 | * Before saving, review your plugin settings. 50 | 51 | `sms_show_params` 52 | 53 | * If everything looks good, save your settings. 54 | 55 | `sms_save` 56 | 57 | * Start the SMS plugin, which will wait for incoming sessions. 58 | 59 | `sms_start` 60 | 61 | * When finished, stop the SMS plugin. 62 | 63 | `sms_stop` 64 | 65 | [metasploit]: https://github.com/rapid7/metasploit-framework 66 | [rest-api-docs]: https://king-phisher.readthedocs.io/en/latest/server_api/rest_api.html?highlight=sms#get--_-api-sms-send 67 | [sms]: ./sms.rb 68 | -------------------------------------------------------------------------------- /data/pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | persistent=yes 3 | jobs=1 4 | unsafe-load-any-extension=no 5 | 6 | [MESSAGES CONTROL] 7 | confidence=UNDEFINED 8 | disable=R0204,C0201,C0411,C0413,C0302,C0330,E0203,E0611,F0401,R0201,R0801,R0902,R0911,R0912,R0913,R0915,W0201,W0212,W0221,W0232,W0401,W0614,W0703,W1202 9 | enable= 10 | 11 | [REPORTS]. 12 | output-format=colorized 13 | files-output=no 14 | reports=yes 15 | msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" 16 | 17 | [LOGGING] 18 | logging-modules=logging 19 | 20 | [BASIC] 21 | bad-functions=input 22 | good-names=i,j,k,ex,Run,_ 23 | bad-names=foo,baz,toto,tutu,tata 24 | function-rgx=[a-z_][a-z0-9_]{2,30}$ 25 | function-name-hint=[a-z_][a-z0-9_]{2,30}$ 26 | variable-rgx=[a-z_][a-z0-9_]{2,30}$ 27 | variable-name-hint=[a-z_][a-z0-9_]{2,30}$ 28 | const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 29 | const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 30 | attr-rgx=[a-z_][a-z0-9_]{2,30}$ 31 | attr-name-hint=[a-z_][a-z0-9_]{2,30}$ 32 | argument-rgx=[a-z_][a-z0-9_]{2,30}$ 33 | argument-name-hint=[a-z_][a-z0-9_]{2,30}$ 34 | class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 35 | class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 36 | inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ 37 | inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ 38 | class-rgx=[A-Z_][a-zA-Z0-9]+$ 39 | class-name-hint=[A-Z_][a-zA-Z0-9]+$ 40 | module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 41 | module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 42 | method-rgx=(([a-z_][a-z0-9_]{2,40})|(assert[a-zA-Z0-9]{2,40})|(do_[a-zA-Z0-9_]{2,40}))$ 43 | method-name-hint=(([a-z_][a-z0-9_]{2,40})|(assert[a-zA-Z0-9]{2,40})|(do_[a-zA-Z0-9_]{2,40}))$ 44 | max-line-length=200 45 | 46 | [FORMAT] 47 | ignore-long-lines=^\s*(# )??$ 48 | single-line-if-stmt=no 49 | no-space-check=trailing-comma,dict-separator 50 | indent-string=\t 51 | indent-after-paren=4 52 | expected-line-ending-format=LF 53 | 54 | [VARIABLES] 55 | init-import=no 56 | callbacks=cb_,_cb,signal_ 57 | 58 | [SIMILARITIES] 59 | min-similarity-lines=4 60 | ignore-comments=yes 61 | ignore-docstrings=yes 62 | ignore-imports=no 63 | 64 | [TYPECHECK] 65 | ignore-mixin-members=yes 66 | generated-members=REQUEST,acl_users,aq_parent 67 | 68 | [MISCELLANEOUS] 69 | notes=FIXME,XXX,TODO 70 | 71 | [DESIGN] 72 | max-args=6 73 | ignored-argument-names=_.* 74 | max-locals=15 75 | max-returns=6 76 | max-branches=12 77 | max-statements=50 78 | max-parents=7 79 | max-attributes=7 80 | min-public-methods=0 81 | max-public-methods=25 82 | 83 | [CLASSES] 84 | defining-attr-methods=__init__,__new__,setUp 85 | valid-classmethod-first-arg=cls 86 | valid-metaclass-classmethod-first-arg=mcs 87 | exclude-protected=_asdict,_fields,_replace,_source,_make 88 | 89 | [EXCEPTIONS] 90 | overgeneral-exceptions=Exception 91 | -------------------------------------------------------------------------------- /data/server/king_phisher/GeoLite2-City.mmdb: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:a253d9cd68fe17b00087da24375f31f07cd4bb3852dc5fe3afe37b8f59e5abd0 3 | size 61615395 4 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic.ini: -------------------------------------------------------------------------------- 1 | # A generic, single database configuration. 2 | 3 | [alembic] 4 | # path to migration scripts 5 | script_location = alembic 6 | 7 | # template used to generate migration files 8 | # file_template = %%(rev)s_%%(slug)s 9 | 10 | # max length of characters to apply to the 11 | # "slug" field 12 | #truncate_slug_length = 40 13 | 14 | # set to 'true' to run the environment during 15 | # the 'revision' command, regardless of autogenerate 16 | # revision_environment = false 17 | 18 | # set to 'true' to allow .pyc and .pyo files without 19 | # a source .py file to be detected as revisions in the 20 | # versions/ directory 21 | # sourceless = false 22 | 23 | # sqlalchemy.url is ignored, instead the user must provide the value on the 24 | # command line via either: 25 | # -x database=driver://user:pass@localhost/dbname 26 | # -x config=/path/to/server/config/file 27 | # sqlalchemy.url = driver://user:pass@localhost/dbname 28 | 29 | # Logging configuration 30 | [loggers] 31 | keys = root,sqlalchemy,alembic 32 | 33 | [handlers] 34 | keys = console 35 | 36 | [formatters] 37 | keys = generic 38 | 39 | [logger_root] 40 | level = WARN 41 | handlers = console 42 | qualname = 43 | 44 | [logger_sqlalchemy] 45 | level = WARN 46 | handlers = 47 | qualname = sqlalchemy.engine 48 | 49 | [logger_alembic] 50 | level = INFO 51 | handlers = 52 | qualname = alembic 53 | 54 | [handler_console] 55 | class = StreamHandler 56 | args = (sys.stderr,) 57 | level = NOTSET 58 | formatter = generic 59 | 60 | [formatter_generic] 61 | format = %(levelname)-5.5s [%(name)s] %(message)s 62 | datefmt = %H:%M:%S 63 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = ${repr(up_revision)} 11 | down_revision = ${repr(down_revision)} 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | import sqlalchemy 20 | ${imports if imports else ""} 21 | 22 | def upgrade(): 23 | ${upgrades if upgrades else "pass"} 24 | 25 | def downgrade(): 26 | ${downgrades if downgrades else "pass"} 27 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/versions/7c315088952_schema_v4.py: -------------------------------------------------------------------------------- 1 | """Schema v4 2 | 3 | Revision ID: 7c315088952 4 | Revises: 24a4a626ff7c 5 | Create Date: 2015-07-20 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = '7c315088952' 11 | down_revision = '24a4a626ff7c' 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | import sqlalchemy 20 | 21 | 22 | def upgrade(): 23 | op.add_column('campaigns', sqlalchemy.Column('description', sqlalchemy.String)) 24 | op.add_column('messages', sqlalchemy.Column('opener_ip', sqlalchemy.String)) 25 | op.add_column('messages', sqlalchemy.Column('opener_user_agent', sqlalchemy.String)) 26 | 27 | db_manager.Session.remove() 28 | db_manager.Session.configure(bind=op.get_bind()) 29 | session = db_manager.Session() 30 | db_manager.set_meta_data('schema_version', 4, session=session) 31 | session.commit() 32 | 33 | def downgrade(): 34 | op.drop_column('campaigns', 'description') 35 | op.drop_column('messages', 'opener_ip') 36 | op.drop_column('messages', 'opener_user_agent') 37 | 38 | db_manager.Session.remove() 39 | db_manager.Session.configure(bind=op.get_bind()) 40 | session = db_manager.Session() 41 | db_manager.set_meta_data('schema_version', 3, session=session) 42 | session.commit() 43 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/versions/83e4121b299_schema_v5.py: -------------------------------------------------------------------------------- 1 | """Schema v5 2 | 3 | Revision ID: 83e4121b299 4 | Revises: 7c315088952 5 | Create Date: 2015-08-21 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = '83e4121b299' 11 | down_revision = '7c315088952' 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | import sqlalchemy 20 | 21 | 22 | def upgrade(): 23 | op.drop_column('messages', 'company_name') 24 | 25 | db_manager.Session.remove() 26 | db_manager.Session.configure(bind=op.get_bind()) 27 | session = db_manager.Session() 28 | db_manager.set_meta_data('schema_version', 5, session=session) 29 | session.commit() 30 | 31 | def downgrade(): 32 | op.add_column('messages', sqlalchemy.Column('company_name', sqlalchemy.String)) 33 | 34 | db_manager.Session.remove() 35 | db_manager.Session.configure(bind=op.get_bind()) 36 | session = db_manager.Session() 37 | db_manager.set_meta_data('schema_version', 4, session=session) 38 | session.commit() 39 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/versions/a695de64338_schema_v6.py: -------------------------------------------------------------------------------- 1 | """Schema v6 2 | 3 | Revision ID: a695de64338 4 | Revises: 83e4121b299 5 | Create Date: 2015-09-28 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = 'a695de64338' 11 | down_revision = '83e4121b299' 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | import sqlalchemy 20 | 21 | 22 | def upgrade(): 23 | op.create_table( 24 | 'authenticated_sessions', 25 | sqlalchemy.Column('id', sqlalchemy.String, primary_key=True), 26 | sqlalchemy.Column('created', sqlalchemy.Integer, nullable=False), 27 | sqlalchemy.Column('last_seen', sqlalchemy.Integer, nullable=False), 28 | sqlalchemy.Column('user_id', sqlalchemy.String, sqlalchemy.ForeignKey('users.id'), nullable=False) 29 | ) 30 | 31 | db_manager.Session.remove() 32 | db_manager.Session.configure(bind=op.get_bind()) 33 | session = db_manager.Session() 34 | db_manager.set_meta_data('schema_version', 6, session=session) 35 | session.commit() 36 | 37 | def downgrade(): 38 | op.drop_table('authenticated_sessions') 39 | 40 | db_manager.Session.remove() 41 | db_manager.Session.configure(bind=op.get_bind()) 42 | session = db_manager.Session() 43 | db_manager.set_meta_data('schema_version', 5, session=session) 44 | session.commit() 45 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/versions/b76eab0a059_schema_v7.py: -------------------------------------------------------------------------------- 1 | """Schema v7 2 | 3 | Revision ID: b76eab0a059 4 | Revises: a695de64338 5 | Create Date: 2016-12-07 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = 'b76eab0a059' 11 | down_revision = 'a695de64338' 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | import sqlalchemy 20 | 21 | 22 | def upgrade(): 23 | op.create_table( 24 | 'storage_data', 25 | sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True), 26 | sqlalchemy.Column('created', sqlalchemy.DateTime), 27 | sqlalchemy.Column('namespace', sqlalchemy.String), 28 | sqlalchemy.Column('key', sqlalchemy.String, nullable=False), 29 | sqlalchemy.Column('value', sqlalchemy.Binary) 30 | ) 31 | 32 | db_manager.Session.remove() 33 | db_manager.Session.configure(bind=op.get_bind()) 34 | session = db_manager.Session() 35 | db_manager.set_meta_data('schema_version', 7, session=session) 36 | session.commit() 37 | 38 | def downgrade(): 39 | op.drop_table('storage_data') 40 | 41 | db_manager.Session.remove() 42 | db_manager.Session.configure(bind=op.get_bind()) 43 | session = db_manager.Session() 44 | db_manager.set_meta_data('schema_version', 6, session=session) 45 | session.commit() 46 | -------------------------------------------------------------------------------- /data/server/king_phisher/alembic/versions/c9a8d520a26_schema_v9.py: -------------------------------------------------------------------------------- 1 | """Schema v9 2 | 3 | Revision ID: b8443afcb9e 4 | Revises: b76eab0a059 5 | Create Date: 2018-10-25 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = 'c9a8d520a26' 11 | down_revision = 'b8443afcb9e' 12 | 13 | import os 14 | import sys 15 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5))) 16 | 17 | from alembic import op 18 | from king_phisher.server.database import manager as db_manager 19 | from king_phisher.server.database import schema_migration as db_schema_migration 20 | import sqlalchemy 21 | 22 | def upgrade(): 23 | op.add_column('campaigns', sqlalchemy.Column('credential_regex_username', sqlalchemy.String)) 24 | op.add_column('campaigns', sqlalchemy.Column('credential_regex_password', sqlalchemy.String)) 25 | op.add_column('campaigns', sqlalchemy.Column('credential_regex_mfa_token', sqlalchemy.String)) 26 | 27 | op.add_column('credentials', sqlalchemy.Column('mfa_token', sqlalchemy.String)) 28 | op.add_column('credentials', sqlalchemy.Column('regex_validated', sqlalchemy.Boolean)) 29 | 30 | op.add_column('users', sqlalchemy.Column('access_level', sqlalchemy.Integer)) 31 | op.execute('UPDATE users SET access_level = 1000') 32 | op.alter_column('users', 'access_level', nullable=False) 33 | 34 | # adjust the schema version metadata 35 | db_manager.Session.remove() 36 | db_manager.Session.configure(bind=op.get_bind()) 37 | session = db_manager.Session() 38 | db_manager.set_metadata('schema_version', 9, session=session) 39 | session.commit() 40 | 41 | def downgrade(): 42 | db_schema_migration.drop_columns('users', ('access_level',)) 43 | db_schema_migration.drop_columns('credentials', ('regex_validated', 'mfa_token')) 44 | db_schema_migration.drop_columns('campaigns', ('credential_regex_mfa_token', 'credential_regex_password', 'credential_regex_username')) 45 | 46 | # adjust the schema version metadata 47 | db_manager.Session.remove() 48 | db_manager.Session.configure(bind=op.get_bind()) 49 | session = db_manager.Session() 50 | db_manager.set_metadata('schema_version', 8, session=session) 51 | session.commit() 52 | -------------------------------------------------------------------------------- /data/server/king_phisher/javascript_hook.js: -------------------------------------------------------------------------------- 1 | /* http://stackoverflow.com/questions/950087 */ 2 | function loadScript(url, callback) { 3 | var head = document.getElementsByTagName('head')[0]; 4 | var script = document.createElement('script'); 5 | script.type = 'text/javascript'; 6 | script.src = url; 7 | if (callback !== undefined) { 8 | script.onreadystatechange = callback; 9 | script.onload = callback; 10 | } 11 | head.appendChild(script); 12 | } 13 | -------------------------------------------------------------------------------- /data/server/king_phisher/pages/error_404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Page Not Found 5 | 8 | 9 | 10 | 11 |
12 | Error 404: Page Not Found 13 |
14 |
15 |
16 | Sorry, the page you were looking for doesn't exist. 17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /data/server/king_phisher/youtube.js: -------------------------------------------------------------------------------- 1 | /* 2 | * This javascript file uses the YouTube iframe API to start a video and enable 3 | * an input element once it has ended. 4 | */ 5 | var tag = document.createElement('script'); 6 | tag.src = "https://www.youtube.com/iframe_api"; 7 | var firstScriptTag = document.getElementsByTagName('script')[0]; 8 | firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 9 | 10 | var player; 11 | function onYouTubeIframeAPIReady() { 12 | var trainedInput = document.getElementById("trained-input"); 13 | if (trainedInput) { 14 | trainedInput.disabled = true; 15 | } 16 | player = new YT.Player('ytplayer', { 17 | events: { 18 | 'onReady': onPlayerReady, 19 | 'onStateChange': onPlayerStateChange 20 | } 21 | }); 22 | } 23 | 24 | function onPlayerReady(event) { 25 | event.target.setVolume(100); 26 | } 27 | 28 | function onPlayerStateChange(event) { 29 | if (event.data == YT.PlayerState.ENDED) { 30 | var trainedInput = document.getElementById("trained-input"); 31 | if (trainedInput) { 32 | trainedInput.disabled = false; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /data/server/service_files/king-phisher.conf: -------------------------------------------------------------------------------- 1 | # KingPhisherServer upstart config file 2 | # This file goes in /etc/init/ 3 | 4 | description "King-Phisher Server" 5 | 6 | start on runlevel [2345] 7 | stop on runlevel [!2345] 8 | 9 | # Installed Together In /opt/king-phisher 10 | exec /usr/bin/python3 /opt/king-phisher/KingPhisherServer -f /opt/king-phisher/server_config.yml 11 | -------------------------------------------------------------------------------- /data/server/service_files/king-phisher.service: -------------------------------------------------------------------------------- 1 | # KingPhisherServer systemd config file 2 | # This file goes in /lib/systemd/system/ 3 | 4 | [Unit] 5 | Description=King Phisher Server 6 | After=syslog.target network.target auditd.service 7 | 8 | [Service] 9 | Type=forking 10 | PIDFile=/var/run/king-phisher.pid 11 | WorkingDirectory=/opt/king-phisher 12 | # Installed Together In /opt/king-phisher 13 | ExecStart=/usr/bin/python3 /opt/king-phisher/KingPhisherServer /opt/king-phisher/server_config.yml 14 | ExecStop=/bin/kill -INT $MAINPID 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /data/zsh/_KingPhisher: -------------------------------------------------------------------------------- 1 | #compdef KingPhisher 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2013-2017, SecureState LLC 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the project nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for KingPhisher. 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Spencer McIntyre 38 | # 39 | # ------------------------------------------------------------------------------ 40 | 41 | _arguments \ 42 | "--logger[specify the root logger]:logger" \ 43 | "--no-plugins[disable all plugins]" \ 44 | "--no-style[disable interface styling]" \ 45 | {-L,--log}"[set the logging level]:loglvl:(DEBUG INFO WARNING ERROR CRITICAL)" \ 46 | {-c,--config}"[specify a configuration file to use]:config file" \ 47 | {-h,--help}"[show help text]" \ 48 | {-v,--version}"[show version information]" 49 | -------------------------------------------------------------------------------- /data/zsh/_KingPhisherServer: -------------------------------------------------------------------------------- 1 | #compdef KingPhisherServer 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2013-2017, SecureState LLC 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the project nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for KingPhisherServer. 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Spencer McIntyre 38 | # 39 | # ------------------------------------------------------------------------------ 40 | 41 | _arguments \ 42 | "1::config_file:_files" \ 43 | "--verify-config[verify the configuration and exit]" \ 44 | {-L,--log}"[set the logging level]:loglvl:(DEBUG INFO WARNING ERROR CRITICAL)" \ 45 | {-f,--foreground}"[run in the foreground (do not fork)]" \ 46 | {-h,--help}"[show help text]" \ 47 | {-v,--version}"[show version information]" 48 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # due to Pipenv only supporting the production and development package groups, 2 | # this file must be maintained seperately and can not be simply generated with 3 | # pipenv lock -r > docs/requirements.txt 4 | 5 | -i https://pypi.org/simple 6 | advancedhttpserver==2.2.0 7 | alembic==1.2.0 8 | blinker==1.4 9 | boltons==19.1.0 10 | cryptography==2.7.0 11 | dnspython==1.16.0 12 | ecdsa==0.13.3 13 | email-validator==1.0.4 14 | geoip2==2.9.0 15 | geojson==2.5.0 16 | graphene-sqlalchemy==2.1.2 17 | graphene==2.1.8 18 | graphql-relay==2.0.0 19 | icalendar==4.0.3 20 | ipaddress==1.0.22 21 | jinja2==2.11.3 22 | jsonschema==2.6.0 23 | markdown==2.6.11 24 | markupsafe==1.1.1 25 | matplotlib==2.2.4 26 | msgpack-python==0.5.6 27 | paramiko==2.6.0 28 | pluginbase==1.0.0 29 | psycopg2==2.8.3 30 | py-gfm==0.1.4 31 | pyotp==2.3.0 32 | python-dateutil==2.8.0 33 | python-pam==1.8.4 34 | pytz==2019.2 35 | pyyaml==5.4 36 | requests-file==1.4.3 37 | requests==2.22.0 38 | rule-engine==1.1.0 39 | six==1.12.0 40 | smoke-zephyr==1.4.1 41 | sqlalchemy==1.3.8 42 | termcolor==1.1.0 43 | tzlocal==2.0.0 44 | websocket-client==0.49.0 45 | xlsxwriter==1.2.1 46 | 47 | # additional sphinx-specific requirements 48 | sphinxcontrib-httpdomain>=1.5.0 49 | -------------------------------------------------------------------------------- /docs/source/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | /* override table width restrictions */ 2 | @media screen and (min-width: 767px) { 3 | 4 | .wy-table-responsive table td { 5 | /* !important prevents the common CSS stylesheets from overriding 6 | this as on RTD they are loaded after this stylesheet */ 7 | white-space: normal !important; 8 | } 9 | 10 | .wy-table-responsive { 11 | overflow: visible !important; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /docs/source/client/index.rst: -------------------------------------------------------------------------------- 1 | The King Phisher Client 2 | ======================= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :titlesonly: 7 | 8 | configuration.rst 9 | completion_data.rst 10 | gobject_signals.rst 11 | key_shortcuts.rst 12 | -------------------------------------------------------------------------------- /docs/source/client/key_shortcuts.rst: -------------------------------------------------------------------------------- 1 | Keyboard Shortcuts 2 | ================== 3 | 4 | The following keyboard shortcuts are available for use within the client GUI. 5 | 6 | +--------------------------------+---------------------------------+ 7 | | Key Combination | Action Description | 8 | +================================+=================================+ 9 | | ``Ctrl`` + ``O`` | Open a campaign | 10 | +--------------------------------+---------------------------------+ 11 | | ``Ctrl`` + ``Q`` | Exit the client | 12 | +--------------------------------+---------------------------------+ 13 | | ``Ctrl`` + ``F1`` | Open an RPC terminal | 14 | +--------------------------------+---------------------------------+ 15 | | ``Ctrl`` + ``F2`` | Open the SFTP client | 16 | +--------------------------------+---------------------------------+ 17 | | ``Ctrl`` + ``Shift`` + ``F1`` | Clear the RPC cache | 18 | +--------------------------------+---------------------------------+ 19 | | ``Ctrl`` + ``Shift`` + ``F2`` | Write the configuration to disk | 20 | +--------------------------------+---------------------------------+ 21 | | ``Ctrl`` + ``Shift`` + ``F12`` | Reload the style css file | 22 | +--------------------------------+---------------------------------+ 23 | -------------------------------------------------------------------------------- /docs/source/development/architecture.dot: -------------------------------------------------------------------------------- 1 | // diagram overview of the king phisher architecture 2 | digraph { 3 | graph [pad="0.5", nodesep="1", ranksep="1"]; 4 | label="King Phisher Connection Diagram"; 5 | labelloc="t"; 6 | 7 | {rank=same; KingPhisherClient; SMTPServer} 8 | {rank=same; Database; PhishingTargets} 9 | 10 | Database 11 | KingPhisherClient [label="King Phisher Client"] 12 | KingPhisherServer [label="King Phisher Server"] 13 | PhishingTargets [label="Phishing Targets"] 14 | RPC [color=white; shape=box; style=filled; label="Remote Procedure Call"] 15 | SMTPServer [label="SMTP Server"] 16 | WebSocket [color=white; shape=box; style=filled] 17 | 18 | subgraph cluster_SSHTunnel { 19 | color = lightgray; 20 | label = "SSH Tunnel"; 21 | style = filled; 22 | RPC WebSocket; 23 | } 24 | 25 | KingPhisherClient -> SMTPServer 26 | KingPhisherClient -> WebSocket [arrowhead=none] 27 | WebSocket -> KingPhisherServer 28 | KingPhisherClient -> RPC [arrowhead=none] 29 | KingPhisherServer -> Database 30 | PhishingTargets -> KingPhisherServer 31 | RPC -> KingPhisherServer 32 | } 33 | -------------------------------------------------------------------------------- /docs/source/development/environment_vars.rst: -------------------------------------------------------------------------------- 1 | Environment Variables 2 | ===================== 3 | 4 | The following environment variables can be set to change normal operation. None 5 | of them are required to be set under normal circumstances. 6 | 7 | +--------------------------------+----------------------------------------------------+ 8 | | Variable Name | Variable Description | 9 | +================================+====================================================+ 10 | | **General Purpose** | 11 | +--------------------------------+----------------------------------------------------+ 12 | | ``KING_PHISHER_DATA_PATH`` | Paths to search for data files | 13 | +--------------------------------+----------------------------------------------------+ 14 | | ``KING_PHISHER_DEV_KEY`` | Path to a development key | 15 | +--------------------------------+----------------------------------------------------+ 16 | | ``KING_PHISHER_GLADE_FILE`` | Name of the client Glade UI data file | 17 | +--------------------------------+----------------------------------------------------+ 18 | | **Testing Specific** | 19 | +--------------------------------+----------------------------------------------------+ 20 | | ``KING_PHISHER_TEST_GEOIP_DB`` | The GeoIP database used for unit tests | 21 | +--------------------------------+----------------------------------------------------+ 22 | | ``KING_PHISHER_TEST_OFFLINE`` | Skip unit tests which require a network connection | 23 | +--------------------------------+----------------------------------------------------+ 24 | -------------------------------------------------------------------------------- /docs/source/development/index.rst: -------------------------------------------------------------------------------- 1 | Development References 2 | ====================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :titlesonly: 7 | 8 | architecture_overview.rst 9 | modules.rst 10 | environment_vars.rst 11 | style_guide.rst 12 | classifiers.rst 13 | release_steps.rst 14 | versions_reference.rst 15 | windows_build.rst 16 | -------------------------------------------------------------------------------- /docs/source/development/modules.rst: -------------------------------------------------------------------------------- 1 | Modules 2 | ======= 3 | 4 | The project's code base is split among multiple Python modules under the primary 5 | :py:mod:`king_phisher` package. Code which is not specific to either the client 6 | or server code bases is directly in the root of the :py:mod:`king_phisher` 7 | package with code that is specific to either the client or server being under 8 | either the :py:mod:`king_phisher.client` sub-package or 9 | :py:mod:`king_phisher.server` sub-package respectively. 10 | 11 | Special Modules 12 | --------------- 13 | 14 | Some modules have special designations to identify them as having particular 15 | qualities. 16 | 17 | .. _clean-room-modules: 18 | 19 | Clean Room Modules 20 | ^^^^^^^^^^^^^^^^^^ 21 | 22 | Modules that qualify for the "Clean Room" classification are suitable for use 23 | during the early phases of the application's initialization. They may also be 24 | used for general purposes. 25 | 26 | * Modules must not import any code which is not either included in the Python 27 | standard library or packaged with King Phisher. For example, :py:mod:`os`, 28 | :py:mod:`sys`, and :py:mod:`king_phisher.startup` may be imported while 29 | :py:mod:`advancedhttpserver`, :py:mod:`jinja2`, and :py:mod:`smoke_zephyr` may 30 | not. 31 | * Modules may only import other King Phisher modules which also have the "Clean 32 | Room" classification. 33 | 34 | Modules with this designation have the following comment banner included in 35 | their source file just below the standard splat. 36 | 37 | .. code-block:: none 38 | 39 | ################################################################################ 40 | # 41 | # CLEAN ROOM MODULE 42 | # 43 | # This module is classified as a "Clean Room" module and is subject to 44 | # restrictions on what it may import. 45 | # 46 | # See: https://king-phisher.readthedocs.io/en/latest/development/modules.html#clean-room-modules 47 | # 48 | ################################################################################ 49 | -------------------------------------------------------------------------------- /docs/source/development/release_steps.rst: -------------------------------------------------------------------------------- 1 | Release Steps 2 | ============= 3 | 4 | This document contains the steps that are followed for each point version 5 | release of King Phisher. 6 | 7 | Pre Release Steps 8 | ----------------- 9 | 10 | #. Test and fix any issues with the Windows MSI build 11 | #. Ensure unit tests pass with Python 3.4+ 12 | #. Remove the version label 13 | #. Create the final Windows MSI build 14 | #. Update the change log 15 | 16 | Release Steps 17 | ------------- 18 | 19 | #. Create a final signed commit on the dev branch and push it to GitHub 20 | #. Merge dev into master and push master to GitHub 21 | #. Create and push a signed tag of the release commit 22 | #. Create a new release on GitHub 23 | 24 | #. Upload the final Windows build 25 | #. Insert the changes from the change log 26 | #. Insert the MD5, SHA1 and SHA512 hashes of the Windows build 27 | 28 | #. Publicize the release 29 | 30 | Post Release Steps 31 | ------------------ 32 | 33 | #. Open a new issue with the Kali bug tracker notifying them of the release 34 | #. Increment the version number on the dev branch and reset the version label 35 | #. Update the Python packages list in Pipfile 36 | 37 | #. List the outdated packages with: ``pipenv update --outdated`` 38 | #. Update each one with: ``pipenv install PACKAGE==VERSION`` 39 | #. Manually synchronize ``docs/requirements.txt`` 40 | -------------------------------------------------------------------------------- /docs/source/development/signals.dot: -------------------------------------------------------------------------------- 1 | // diagram overview of a signal emission example 2 | digraph { 3 | graph [pad="0.5", nodesep="1", ranksep="1"]; 4 | label="King Phisher Signal Emission Diagram"; 5 | labelloc="t"; 6 | rankdir=LR; 7 | 8 | SQLAlchemy 9 | ServerCore 10 | WebSocketServer 11 | WebSocketClient 12 | ClientCore 13 | 14 | subgraph cluster_Client { 15 | color = lightgray; 16 | label = "Client"; 17 | style = filled; 18 | WebSocketClient ClientCore; 19 | } 20 | 21 | subgraph cluster_Server { 22 | color = lightgray; 23 | label = "Server"; 24 | style = filled; 25 | SQLAlchemy ServerCore WebSocketServer 26 | } 27 | 28 | SQLAlchemy -> ServerCore 29 | ServerCore -> WebSocketServer 30 | WebSocketServer -> WebSocketClient [constraint=false; label="Transmission over the network"] 31 | WebSocketClient -> ClientCore 32 | } 33 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. logo file located in data/ 2 | .. image:: ../../data/king-phisher-logo.png 3 | :align: center 4 | 5 | King Phisher Documentation 6 | ========================== 7 | 8 | King Phisher is an open source Phishing Campaign Toolkit. This is its technical 9 | documentation intended for use by contributors. The source code is available on 10 | the `GitHub homepage`_. Additionally documentation intended for use by users can 11 | be found in the King Phisher `GitHub wiki`_. 12 | 13 | The :ref:`architecture-overview` development reference is available to help 14 | new users understand the basic project components and how they interact. 15 | 16 | .. _GitHub Homepage: https://github.com/securestate/king-phisher 17 | 18 | .. _GitHub Wiki: https://github.com/securestate/king-phisher/wiki 19 | 20 | .. _technical-docs: 21 | 22 | .. toctree:: 23 | :caption: Technical Documentation 24 | :numbered: 25 | :maxdepth: 1 26 | 27 | king_phisher/index.rst 28 | client/index.rst 29 | server/index.rst 30 | plugins/index.rst 31 | development/index.rst 32 | change_log.rst 33 | 34 | Indices and tables 35 | ================== 36 | 37 | * :ref:`genindex` 38 | * :ref:`modindex` 39 | * :ref:`search` 40 | -------------------------------------------------------------------------------- /docs/source/king_phisher/archive.rst: -------------------------------------------------------------------------------- 1 | :mod:`archive` 2 | ============== 3 | 4 | .. module:: king_phisher.archive 5 | :synopsis: 6 | 7 | This module provides a generic means to combine data and files into a single 8 | archive file. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: is_archive 14 | 15 | .. autofunction:: patch_zipfile 16 | 17 | Classes 18 | ------- 19 | 20 | .. autoclass:: ArchiveFile 21 | :members: 22 | :special-members: __init__ 23 | :undoc-members: 24 | -------------------------------------------------------------------------------- /docs/source/king_phisher/catalog.rst: -------------------------------------------------------------------------------- 1 | :mod:`catalog` 2 | ============== 3 | 4 | .. module:: king_phisher.catalog 5 | :synopsis: 6 | 7 | This module provides functionality for processing and working with data 8 | published on the available add ons for the application. 9 | 10 | Overview 11 | -------- 12 | 13 | The classes within this module are primarily for organizing the large amount of 14 | data describing published add ons. This information is broken down into the 15 | various objects in a hierarchy where the parent contain zero or more children 16 | objects. In this sense the hierarchy is a tree data structure where the nodes 17 | are different data types such as catalogs, repositories, collections etc. 18 | 19 | The hierarchy of these objects is as follows in order of parent to children: 20 | 21 | * :py:class:`.CatalogManager` 22 | * :py:class:`.Catalog` 23 | * :py:class:`.Repository` 24 | * :py:class:`.Collection` 25 | * :py:class:`.CollectionItemFile` 26 | 27 | Data 28 | ---- 29 | 30 | .. autodata:: COLLECTION_TYPES 31 | :annotation: 32 | 33 | Functions 34 | --------- 35 | 36 | .. autofunction:: sign_item_files 37 | 38 | Classes 39 | ------- 40 | 41 | .. autoclass:: Catalog 42 | :show-inheritance: 43 | :members: 44 | :inherited-members: 45 | :special-members: __init__ 46 | 47 | .. autoclass:: CatalogManager 48 | :show-inheritance: 49 | :members: 50 | :inherited-members: 51 | :special-members: __init__ 52 | 53 | .. autoclass:: Collection 54 | :show-inheritance: 55 | :members: 56 | :special-members: __init__ 57 | 58 | .. autoclass:: CollectionItemFile 59 | :members: 60 | :special-members: __init__ 61 | 62 | .. autoclass:: Repository 63 | :show-inheritance: 64 | :members: 65 | :inherited-members: 66 | :special-members: __init__ 67 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/application.rst: -------------------------------------------------------------------------------- 1 | :mod:`application` 2 | ================== 3 | 4 | .. module:: king_phisher.client.application 5 | :synopsis: 6 | 7 | This module provides the top level GTK application object representing the 8 | client application. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: GTK3_DEFAULT_THEME 14 | 15 | .. autodata:: USER_DATA_PATH 16 | 17 | Classes 18 | ------- 19 | 20 | .. autoclass:: ServerUser 21 | :show-inheritance: 22 | 23 | .. autoclass:: KingPhisherClientApplication 24 | :show-inheritance: 25 | :members: 26 | :special-members: __init__ 27 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/assistants/campaign.rst: -------------------------------------------------------------------------------- 1 | :mod:`campaign` 2 | =============== 3 | 4 | .. module:: king_phisher.client.assistants.campaign 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: CampaignAssistant 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/assistants/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`assistants` 2 | ================= 3 | 4 | .. module:: king_phisher.client.assistants 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | campaign.rst 11 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/client_rpc.rst: -------------------------------------------------------------------------------- 1 | :mod:`client_rpc` 2 | ================= 3 | 4 | .. module:: king_phisher.client.client_rpc 5 | :synopsis: 6 | 7 | This module facilitates communication with the server application over the RPC 8 | interface. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: king_phisher.client.client_rpc.UNRESOLVED 14 | 15 | Functions 16 | --------- 17 | 18 | .. autofunction:: king_phisher.client.client_rpc.vte_child_routine 19 | 20 | Classes 21 | ------- 22 | 23 | .. autoclass:: king_phisher.client.client_rpc.KingPhisherRPCClient 24 | :show-inheritance: 25 | :members: 26 | :undoc-members: 27 | 28 | .. autoclass:: king_phisher.client.client_rpc.RemoteRow 29 | :show-inheritance: 30 | :members: 31 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/about.rst: -------------------------------------------------------------------------------- 1 | :mod:`about` 2 | ============ 3 | 4 | .. module:: king_phisher.client.dialogs.about 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: AboutDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/campaign_selection.rst: -------------------------------------------------------------------------------- 1 | :mod:`campaign_selection` 2 | ========================= 3 | 4 | .. module:: king_phisher.client.dialogs.campaign_selection 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: CampaignSelectionDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/clone_page.rst: -------------------------------------------------------------------------------- 1 | :mod:`clone_page` 2 | ================= 3 | 4 | .. module:: king_phisher.client.dialogs.clone_page 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: ClonePageDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/company_editor.rst: -------------------------------------------------------------------------------- 1 | :mod:`company_editor` 2 | ===================== 3 | 4 | .. module:: king_phisher.client.dialogs.company_editor 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: CompanyEditorDialog 11 | :show-inheritance: 12 | :members: 13 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/configuration.rst: -------------------------------------------------------------------------------- 1 | :mod:`configuration` 2 | ==================== 3 | 4 | .. module:: king_phisher.client.dialogs.configuration 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: ConfigurationDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/entry.rst: -------------------------------------------------------------------------------- 1 | :mod:`entry` 2 | ==================== 3 | 4 | .. module:: king_phisher.client.dialogs.entry 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: TextEntryDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/exception.rst: -------------------------------------------------------------------------------- 1 | :mod:`exception` 2 | ================ 3 | 4 | .. module:: king_phisher.client.dialogs.exception 5 | :synopsis: 6 | 7 | Functions 8 | --------- 9 | 10 | .. autofunction:: format_exception_details 11 | 12 | .. autofunction:: format_exception_name 13 | 14 | Classes 15 | ------- 16 | 17 | .. autoclass:: ExceptionDialog 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`dialogs` 2 | ============== 3 | 4 | .. module:: king_phisher.client.dialogs 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | about.rst 11 | campaign_selection.rst 12 | clone_page.rst 13 | company_editor.rst 14 | configuration.rst 15 | entry.rst 16 | exception.rst 17 | login.rst 18 | ssh_host_key.rst 19 | tag_editor.rst 20 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/login.rst: -------------------------------------------------------------------------------- 1 | :mod:`login` 2 | ============ 3 | 4 | .. module:: king_phisher.client.dialogs.login 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: LoginDialogBase 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | 15 | .. autoclass:: LoginDialog 16 | :show-inheritance: 17 | :members: 18 | :special-members: __init__ 19 | 20 | .. autoclass:: SMTPLoginDialog 21 | :show-inheritance: 22 | :members: 23 | 24 | .. autoclass:: SSHLoginDialog 25 | :show-inheritance: 26 | :members: 27 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/ssh_host_key.rst: -------------------------------------------------------------------------------- 1 | :mod:`ssh_host_key` 2 | =================== 3 | 4 | .. module:: king_phisher.client.dialogs.ssh_host_key 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: BaseHostKeyDialog 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | 15 | .. autoclass:: HostKeyAcceptDialog 16 | :show-inheritance: 17 | :members: 18 | :special-members: __init__ 19 | 20 | .. autoclass:: HostKeyWarnDialog 21 | :show-inheritance: 22 | :members: 23 | :special-members: __init__ 24 | 25 | .. autoclass:: MissingHostKeyPolicy 26 | :show-inheritance: 27 | :members: 28 | :special-members: __init__ 29 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/dialogs/tag_editor.rst: -------------------------------------------------------------------------------- 1 | :mod:`tag_editor` 2 | ================= 3 | 4 | .. module:: king_phisher.client.dialogs.tag_editor 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: TagEditorDialog 11 | :show-inheritance: 12 | :members: 13 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/export.rst: -------------------------------------------------------------------------------- 1 | :mod:`export` 2 | ============= 3 | 4 | .. module:: king_phisher.client.export 5 | :synopsis: 6 | 7 | This module provides functionality for exporting information from the client 8 | application into a variety of formats. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: campaign_credentials_to_msf_txt 14 | 15 | .. autofunction:: campaign_to_xml 16 | 17 | .. autofunction:: campaign_visits_to_geojson 18 | 19 | .. autofunction:: convert_value 20 | 21 | .. autofunction:: message_data_from_kpm 22 | 23 | .. autofunction:: message_data_to_kpm 24 | 25 | .. autofunction:: liststore_export 26 | 27 | .. autofunction:: liststore_to_csv 28 | 29 | .. autofunction:: liststore_to_xlsx_worksheet 30 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/graphs.rst: -------------------------------------------------------------------------------- 1 | :mod:`graphs` 2 | ============= 3 | 4 | .. module:: king_phisher.client.graphs 5 | :synopsis: 6 | 7 | This module provides the functionality to support the client application's 8 | graphing capabilities. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: has_matplotlib 14 | 15 | .. autodata:: has_matplotlib_basemap 16 | 17 | Functions 18 | --------- 19 | 20 | .. autofunction:: export_graph_provider 21 | 22 | .. autofunction:: get_graph 23 | 24 | .. autofunction:: get_graphs 25 | 26 | Classes 27 | ------- 28 | 29 | .. autoclass:: GraphBase 30 | :show-inheritance: 31 | :members: 32 | :special-members: __init__ 33 | 34 | .. autoclass:: CampaignGraph 35 | :show-inheritance: 36 | :members: 37 | :special-members: __init__ 38 | 39 | .. autoclass:: CampaignGraphMessageResults 40 | :show-inheritance: 41 | :members: 42 | :special-members: __init__ 43 | :undoc-members: 44 | 45 | .. autoclass:: CampaignGraphOverview 46 | :show-inheritance: 47 | :members: 48 | :special-members: __init__ 49 | :undoc-members: 50 | 51 | .. autoclass:: CampaignGraphPasswordComplexityPie 52 | :show-inheritance: 53 | :members: 54 | :special-members: __init__ 55 | :undoc-members: 56 | 57 | .. autoclass:: CampaignGraphVisitorInfo 58 | :show-inheritance: 59 | :members: 60 | :special-members: __init__ 61 | :undoc-members: 62 | 63 | .. autoclass:: CampaignGraphVisitorInfoPie 64 | :show-inheritance: 65 | :members: 66 | :special-members: __init__ 67 | :undoc-members: 68 | 69 | .. autoclass:: CampaignGraphVisitsMap 70 | :show-inheritance: 71 | :members: 72 | :special-members: __init__ 73 | :undoc-members: 74 | 75 | .. autoclass:: CampaignGraphVisitsMapUSA 76 | :show-inheritance: 77 | :members: 78 | :special-members: __init__ 79 | :undoc-members: 80 | 81 | .. autoclass:: CampaignGraphVisitsMapWorld 82 | :show-inheritance: 83 | :members: 84 | :special-members: __init__ 85 | :undoc-members: 86 | 87 | .. autoclass:: CampaignGraphVisitsTimeline 88 | :show-inheritance: 89 | :members: 90 | :special-members: __init__ 91 | :undoc-members: 92 | 93 | .. autoclass:: CampaignGraphComparison 94 | :show-inheritance: 95 | :members: 96 | :special-members: __init__ 97 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`client` 2 | ============= 3 | 4 | .. module:: king_phisher.client 5 | 6 | This package contains all packages and modules specific to the client 7 | application. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :titlesonly: 12 | 13 | assistants/index.rst 14 | 15 | dialogs/index.rst 16 | 17 | tabs/index.rst 18 | 19 | widget/index.rst 20 | 21 | windows/index.rst 22 | 23 | application.rst 24 | client_rpc.rst 25 | export.rst 26 | graphs.rst 27 | gui_utilities.rst 28 | mailer.rst 29 | plugins.rst 30 | server_events.rst 31 | web_cloner.rst 32 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/mailer.rst: -------------------------------------------------------------------------------- 1 | :mod:`mailer` 2 | ============= 3 | 4 | .. module:: king_phisher.client.mailer 5 | :synopsis: 6 | 7 | This module provides the functionality used to create and sending messages from 8 | the client application. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: MIME_TEXT_PLAIN 14 | 15 | Functions 16 | --------- 17 | 18 | .. autofunction:: count_targets_file 19 | 20 | .. autofunction:: get_invite_start_from_config 21 | 22 | .. autofunction:: guess_smtp_server_address 23 | 24 | .. autofunction:: render_message_template 25 | 26 | .. autofunction:: rfc2282_timestamp 27 | 28 | Classes 29 | ------- 30 | 31 | .. autoclass:: MailSenderThread 32 | :show-inheritance: 33 | :members: 34 | :special-members: __init__ 35 | 36 | .. autoclass:: MessageAttachments 37 | 38 | .. autoclass:: MessageTarget 39 | :show-inheritance: 40 | :members: 41 | :special-members: __init__ 42 | 43 | .. autoclass:: MessageTargetPlaceholder 44 | :show-inheritance: 45 | :members: 46 | :special-members: __init__ 47 | 48 | .. autoclass:: TopMIMEMultipart 49 | :show-inheritance: 50 | :members: 51 | :special-members: __init__ 52 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/plugins.rst: -------------------------------------------------------------------------------- 1 | :mod:`plugins` 2 | ============== 3 | 4 | .. module:: king_phisher.client.plugins 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: CatalogCacheManager 11 | :show-inheritance: 12 | :members: 13 | :inherited-members: 14 | :special-members: __init__ 15 | 16 | .. autoclass:: ClientCatalogManager 17 | :show-inheritance: 18 | :members: 19 | :inherited-members: 20 | :special-members: __init__ 21 | 22 | .. autoclass:: ClientOptionBoolean 23 | :show-inheritance: 24 | :members: 25 | :inherited-members: 26 | :special-members: __init__ 27 | 28 | .. autoclass:: ClientOptionEnum 29 | :show-inheritance: 30 | :members: 31 | :inherited-members: 32 | :special-members: __init__ 33 | 34 | .. autoclass:: ClientOptionInteger 35 | :show-inheritance: 36 | :members: 37 | :inherited-members: 38 | :special-members: __init__ 39 | 40 | .. autoclass:: ClientOptionMixin 41 | :show-inheritance: 42 | :members: 43 | :inherited-members: 44 | :special-members: __init__ 45 | 46 | .. autoclass:: ClientOptionPath 47 | :show-inheritance: 48 | :members: 49 | :inherited-members: 50 | :special-members: __init__ 51 | 52 | .. autoclass:: ClientOptionPort 53 | :show-inheritance: 54 | :members: 55 | :inherited-members: 56 | :special-members: __init__ 57 | 58 | .. autoclass:: ClientOptionString 59 | :show-inheritance: 60 | :members: 61 | :inherited-members: 62 | :special-members: __init__ 63 | 64 | .. autoclass:: ClientPlugin 65 | :show-inheritance: 66 | :members: 67 | 68 | .. autoclass:: ClientPluginMailerAttachment 69 | :show-inheritance: 70 | :members: 71 | :special-members: __init__ 72 | 73 | .. autoclass:: ClientPluginManager 74 | :show-inheritance: 75 | :members: 76 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/server_events.rst: -------------------------------------------------------------------------------- 1 | :mod:`server_events` 2 | ==================== 3 | 4 | .. module:: king_phisher.client.server_events 5 | :synopsis: 6 | 7 | This module provides functionality to allow the client application to subscribe 8 | to events which are published by the server. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: event_type_filter 14 | 15 | Classes 16 | ------- 17 | 18 | .. autoclass:: ServerEventSubscriber 19 | :show-inheritance: 20 | :members: 21 | :inherited-members: 22 | :special-members: __init__ 23 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/tabs/campaign.rst: -------------------------------------------------------------------------------- 1 | :mod:`campaign` 2 | =============== 3 | 4 | .. module:: king_phisher.client.tabs.campaign 5 | :synopsis: 6 | 7 | This module provides the contents of the tab representing the campaign 8 | information in client's graphical interface. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: CampaignViewCredentialsTab 14 | :show-inheritance: 15 | :members: 16 | 17 | .. autoclass:: CampaignViewDashboardTab 18 | :show-inheritance: 19 | :members: 20 | 21 | .. autoclass:: CampaignViewDeaddropTab 22 | :show-inheritance: 23 | :members: 24 | 25 | .. autoclass:: CampaignViewGenericTab 26 | :show-inheritance: 27 | :members: 28 | 29 | .. autoclass:: CampaignViewGenericTableTab 30 | :show-inheritance: 31 | :members: 32 | 33 | .. autoclass:: CampaignViewMessagesTab 34 | :show-inheritance: 35 | :members: 36 | 37 | .. autoclass:: CampaignViewTab 38 | :show-inheritance: 39 | :members: 40 | :special-members: __init__ 41 | 42 | .. autoclass:: CampaignViewVisitsTab 43 | :show-inheritance: 44 | :members: 45 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/tabs/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`tabs` 2 | =========== 3 | 4 | .. module:: king_phisher.client.tabs 5 | 6 | This package contains modules for providing the content of the top level tabs 7 | used by the main application window. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :titlesonly: 12 | 13 | campaign.rst 14 | mail.rst 15 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/tabs/mail.rst: -------------------------------------------------------------------------------- 1 | :mod:`mail` 2 | =========== 3 | 4 | .. module:: king_phisher.client.tabs.mail 5 | :synopsis: 6 | 7 | This module provides the contents of the tab used to create and send messages 8 | as part of a campaign. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: test_webserver_url 14 | 15 | Classes 16 | ------- 17 | 18 | .. autoclass:: MailSenderConfigurationTab 19 | :show-inheritance: 20 | :members: 21 | 22 | .. autoclass:: MailSenderEditTab 23 | :show-inheritance: 24 | :members: 25 | 26 | .. autoclass:: MailSenderPreviewTab 27 | :show-inheritance: 28 | :members: 29 | :special-members: __init__ 30 | :undoc-members: 31 | 32 | .. autoclass:: MailSenderSendTab 33 | :show-inheritance: 34 | :members: 35 | 36 | .. autoclass:: MailSenderTab 37 | :show-inheritance: 38 | :members: 39 | :special-members: __init__ 40 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/web_cloner.rst: -------------------------------------------------------------------------------- 1 | :mod:`web_cloner` 2 | ================= 3 | 4 | .. module:: king_phisher.client.web_cloner 5 | :synopsis: 6 | 7 | This module contains the functionality used by the client to clone web pages. 8 | 9 | Classes 10 | ------- 11 | 12 | .. autoclass:: ClonedResourceDetails 13 | :members: 14 | 15 | .. autoclass:: WebPageCloner 16 | :show-inheritance: 17 | :members: 18 | :special-members: __init__ 19 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/widget/completion_providers.rst: -------------------------------------------------------------------------------- 1 | :mod:`completion_providers` 2 | =========================== 3 | 4 | .. module:: king_phisher.client.widget.completion_providers 5 | :synopsis: 6 | 7 | This module contains classes for custom auto completion for GtkSourceCompletion. 8 | It provides support to recognize special characters and suggests syntax 9 | completion. 10 | 11 | Functions 12 | --------- 13 | 14 | .. autofunction:: get_proposal_terms 15 | 16 | Classes 17 | ------- 18 | 19 | .. autoclass:: CustomCompletionProviderBase 20 | :show-inheritance: 21 | :members: 22 | :special-members: __init__ 23 | 24 | .. autoclass:: HTMLCompletionProvider 25 | :show-inheritance: 26 | :members: 27 | :special-members: __init__ 28 | 29 | .. autoclass:: JinjaCompletionProvider 30 | :show-inheritance: 31 | :members: 32 | :special-members: __init__ 33 | 34 | .. autoclass:: JinjaEmailCompletionProvider 35 | :show-inheritance: 36 | :members: 37 | :special-members: __init__ 38 | 39 | .. autoclass:: JinjaPageCompletionProvider 40 | :show-inheritance: 41 | :members: 42 | :special-members: 43 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/widget/extras.rst: -------------------------------------------------------------------------------- 1 | :mod:`extras` 2 | ============= 3 | 4 | .. module:: king_phisher.client.widget.extras 5 | :synopsis: 6 | 7 | This module contains miscellaneous extra GTK widgets. 8 | 9 | Classes 10 | ------- 11 | 12 | Cell Renderers 13 | ^^^^^^^^^^^^^^ 14 | 15 | .. autoclass:: CellRendererPythonText 16 | :show-inheritance: 17 | :members: 18 | 19 | .. autoclass:: CellRendererBytes 20 | :show-inheritance: 21 | 22 | .. autoclass:: CellRendererDatetime 23 | :show-inheritance: 24 | 25 | .. autoclass:: CellRendererInteger 26 | :show-inheritance: 27 | 28 | Column Definitions 29 | ^^^^^^^^^^^^^^^^^^ 30 | 31 | .. autoclass:: ColumnDefinitionBase 32 | :show-inheritance: 33 | :members: 34 | :special-members: __init__ 35 | 36 | .. autoclass:: ColumnDefinitionBytes 37 | :show-inheritance: 38 | 39 | .. autoclass:: ColumnDefinitionDatetime 40 | :show-inheritance: 41 | 42 | .. autoclass:: ColumnDefinitionInteger 43 | :show-inheritance: 44 | 45 | .. autoclass:: ColumnDefinitionString 46 | :show-inheritance: 47 | 48 | Miscellaneous 49 | ^^^^^^^^^^^^^ 50 | .. autoclass:: FileChooserDialog 51 | :show-inheritance: 52 | :members: 53 | :special-members: __init__ 54 | :undoc-members: 55 | 56 | .. autoclass:: MultilineEntry 57 | :show-inheritance: 58 | :members: 59 | :special-members: __init__ 60 | 61 | .. autoclass:: WebKitHTMLView 62 | :show-inheritance: 63 | :members: 64 | :special-members: __init__ 65 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/widget/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`widget` 2 | ============= 3 | 4 | .. module:: king_phisher.client.widget 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | extras.rst 11 | managers.rst 12 | resources.rst 13 | completion_providers.rst 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/widget/managers.rst: -------------------------------------------------------------------------------- 1 | :mod:`managers` 2 | =============== 3 | 4 | .. module:: king_phisher.client.widget.managers 5 | :synopsis: 6 | 7 | This module contains classes used for high level management of some GTK widgets. 8 | 9 | Classes 10 | ------- 11 | 12 | .. autoclass:: ButtonGroupManager 13 | :show-inheritance: 14 | :members: 15 | :special-members: __init__ 16 | 17 | .. autoclass:: MenuManager 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | 22 | .. autoclass:: RadioButtonGroupManager 23 | :show-inheritance: 24 | :members: 25 | :special-members: __init__ 26 | 27 | .. autoclass:: TimeSelectorButtonManager 28 | :show-inheritance: 29 | :members: 30 | :special-members: __init__ 31 | 32 | .. py:attribute:: time 33 | 34 | .. autoclass:: ToggleButtonGroupManager 35 | :show-inheritance: 36 | :members: 37 | 38 | .. autoclass:: TreeViewManager 39 | :show-inheritance: 40 | :members: 41 | :special-members: __init__ 42 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/widget/resources.rst: -------------------------------------------------------------------------------- 1 | :mod:`resources` 2 | ================ 3 | 4 | .. module:: king_phisher.client.widget.resources 5 | :synopsis: 6 | 7 | This module contains resources useful to GTK widgets. 8 | 9 | Data 10 | ---- 11 | 12 | .. autodata:: font_desc_italic 13 | :annotation: 14 | 15 | .. autodata:: renderer_text_desc 16 | :annotation: 17 | 18 | Classes 19 | ------- 20 | 21 | .. autoclass:: CompanyEditorGrid 22 | :show-inheritance: 23 | :members: 24 | :special-members: __init__ 25 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/campaign_import.rst: -------------------------------------------------------------------------------- 1 | :mod:`campaign_import` 2 | ====================== 3 | 4 | .. module:: king_phisher.client.windows.campaign_import 5 | :synopsis: 6 | 7 | This module provides the window through which the user can import King Phisher 8 | campaigns from xml files previously exported with the 9 | :py:mod:`~client.export` module. 10 | 11 | Classes 12 | ------- 13 | 14 | .. autoclass:: ImportCampaignWindow 15 | :show-inheritance: 16 | :members: 17 | :special-members: __init__ 18 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/compare_campaigns.rst: -------------------------------------------------------------------------------- 1 | :mod:`compare_campaigns` 2 | ======================== 3 | 4 | .. module:: king_phisher.client.windows.compare_campaigns 5 | :synopsis: 6 | 7 | This module provides the window through which the user can compare campaigns 8 | across multiple data points in graph format 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: CampaignCompWindow 14 | :show-inheritance: 15 | :members: 16 | :special-members: __init__ 17 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/html.rst: -------------------------------------------------------------------------------- 1 | :mod:`html` 2 | =========== 3 | 4 | .. module:: king_phisher.client.windows.html 5 | :synopsis: 6 | 7 | This module provides a window which shows HTML content. 8 | 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: HTMLWindow 14 | :show-inheritance: 15 | :members: 16 | :special-members: __init__ 17 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`windows` 2 | ============== 3 | 4 | .. module:: king_phisher.client.windows 5 | 6 | This package contains modules for providing GTK Window objects used by the 7 | client application. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :titlesonly: 12 | 13 | campaign_import.rst 14 | compare_campaigns.rst 15 | html.rst 16 | main.rst 17 | plugin_manager.rst 18 | rpc_terminal.rst 19 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/main.rst: -------------------------------------------------------------------------------- 1 | :mod:`main` 2 | =========== 3 | 4 | .. module:: king_phisher.client.windows.main 5 | :synopsis: 6 | 7 | This module provides the main window used by the client application. 8 | 9 | Classes 10 | ------- 11 | 12 | .. autoclass:: MainAppWindow 13 | :show-inheritance: 14 | :members: 15 | :special-members: __init__ 16 | 17 | .. autoclass:: MainMenuBar 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/plugin_manager.rst: -------------------------------------------------------------------------------- 1 | :mod:`plugin_manager` 2 | ===================== 3 | 4 | .. module:: king_phisher.client.windows.plugin_manager 5 | :synopsis: 6 | 7 | This module provides the window through which the user can enable and disable 8 | plugins. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: PluginDocumentationWindow 14 | :show-inheritance: 15 | :members: 16 | :special-members: __init__ 17 | 18 | .. autoclass:: PluginManagerWindow 19 | :show-inheritance: 20 | :members: 21 | :special-members: __init__ 22 | -------------------------------------------------------------------------------- /docs/source/king_phisher/client/windows/rpc_terminal.rst: -------------------------------------------------------------------------------- 1 | :mod:`rpc_terminal` 2 | =================== 3 | 4 | .. module:: king_phisher.client.windows.rpc_terminal 5 | :synopsis: 6 | 7 | This module provides the RPC Terminal window used by the client application to 8 | give the user raw access to the RPC interface. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: has_vte 14 | 15 | Classes 16 | ------- 17 | 18 | .. autoclass:: RPCTerminal 19 | :show-inheritance: 20 | :members: 21 | :special-members: __init__ 22 | -------------------------------------------------------------------------------- /docs/source/king_phisher/color.rst: -------------------------------------------------------------------------------- 1 | :mod:`color` 2 | ============ 3 | 4 | .. module:: king_phisher.color 5 | :synopsis: 6 | 7 | This module provides functions for converting and using colors for arbitrary 8 | purposes including terminal output. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: convert_hex_to_tuple 14 | 15 | .. autofunction:: convert_tuple_to_hex 16 | 17 | .. autofunction:: get_scale 18 | 19 | .. autofunction:: print_error 20 | 21 | .. autofunction:: print_good 22 | 23 | .. autofunction:: print_status 24 | 25 | Classes 26 | ------- 27 | 28 | .. autoclass:: ColoredLogFormatter 29 | :members: 30 | :undoc-members: 31 | -------------------------------------------------------------------------------- /docs/source/king_phisher/constants.rst: -------------------------------------------------------------------------------- 1 | :mod:`constants` 2 | ================ 3 | 4 | .. module:: king_phisher.constants 5 | :synopsis: 6 | 7 | This module keeps collections of related constants organized for use in other 8 | modules. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: DEFAULT_LOG_LEVEL 14 | 15 | Sentinel Values 16 | ^^^^^^^^^^^^^^^ 17 | 18 | Sentinel values are used as place holders where ``None`` may be valid and have a 19 | different meaning. 20 | 21 | .. autodata:: AUTOMATIC 22 | 23 | A sentinel value to indicate that a feature or value is determined 24 | automatically. 25 | 26 | .. autodata:: DISABLED 27 | 28 | A sentinel value to indicate that a feature or value is disabled. 29 | 30 | Classes 31 | ------- 32 | 33 | .. autoclass:: ConstantGroup 34 | :members: 35 | :undoc-members: 36 | 37 | .. autoclass:: ConnectionErrorReason 38 | .. autoattribute:: ConnectionErrorReason.ERROR_AUTHENTICATION_FAILED 39 | .. autoattribute:: ConnectionErrorReason.ERROR_CONNECTION 40 | .. autoattribute:: ConnectionErrorReason.ERROR_INCOMPATIBLE_VERSIONS 41 | .. autoattribute:: ConnectionErrorReason.ERROR_INVALID_CREDENTIALS 42 | .. autoattribute:: ConnectionErrorReason.ERROR_INVALID_OTP 43 | .. autoattribute:: ConnectionErrorReason.ERROR_PORT_FORWARD 44 | .. autoattribute:: ConnectionErrorReason.ERROR_UNKNOWN 45 | .. autoattribute:: ConnectionErrorReason.SUCCESS 46 | 47 | .. autoclass:: OSArch 48 | .. autoattribute:: OSArch.PPC 49 | .. autoattribute:: OSArch.X86 50 | .. autoattribute:: OSArch.X86_64 51 | 52 | .. autoclass:: OSFamily 53 | .. autoattribute:: OSFamily.ANDROID 54 | .. autoattribute:: OSFamily.BLACKBERRY 55 | .. autoattribute:: OSFamily.IOS 56 | .. autoattribute:: OSFamily.LINUX 57 | .. autoattribute:: OSFamily.OSX 58 | .. autoattribute:: OSFamily.WINDOWS 59 | -------------------------------------------------------------------------------- /docs/source/king_phisher/errors.rst: -------------------------------------------------------------------------------- 1 | :mod:`errors` 2 | ============= 3 | 4 | .. module:: king_phisher.errors 5 | :synopsis: 6 | 7 | This module provides the custom exceptions that are used throughout the package. 8 | 9 | Exceptions 10 | ---------- 11 | 12 | .. autoexception:: KingPhisherError 13 | :show-inheritance: 14 | 15 | .. autoexception:: KingPhisherAbortError 16 | :show-inheritance: 17 | :members: 18 | 19 | .. autoexception:: KingPhisherAbortRequestError 20 | :show-inheritance: 21 | :members: 22 | :special-members: __init__ 23 | 24 | .. autoexception:: KingPhisherDatabaseError 25 | :show-inheritance: 26 | 27 | .. autoexception:: KingPhisherDatabaseAuthenticationError 28 | :show-inheritance: 29 | 30 | .. autoexception:: KingPhisherGraphQLQueryError 31 | :show-inheritance: 32 | 33 | .. autoexception:: KingPhisherInputValidationError 34 | :show-inheritance: 35 | 36 | .. autoexception:: KingPhisherPermissionError 37 | :show-inheritance: 38 | 39 | .. autoexception:: KingPhisherPluginError 40 | :show-inheritance: 41 | :members: 42 | :special-members: __init__ 43 | 44 | .. autoexception:: KingPhisherResourceError 45 | :show-inheritance: 46 | 47 | .. autoexception:: KingPhisherTimeoutError 48 | :show-inheritance: 49 | -------------------------------------------------------------------------------- /docs/source/king_phisher/find.rst: -------------------------------------------------------------------------------- 1 | :mod:`find` 2 | =========== 3 | 4 | .. module:: king_phisher.find 5 | :synopsis: 6 | 7 | This module provides a means by which data files distributed with the 8 | application can be found at run time by searching a configurable set of 9 | directories. 10 | 11 | Data 12 | ---- 13 | 14 | .. autodata:: DATA_DIRECTORY_NAME 15 | 16 | .. autodata:: ENV_VAR 17 | 18 | Functions 19 | --------- 20 | 21 | .. autofunction:: data_path_append 22 | 23 | .. autofunction:: data_directory 24 | 25 | .. autofunction:: data_file 26 | 27 | .. autofunction:: init_data_path 28 | -------------------------------------------------------------------------------- /docs/source/king_phisher/geoip.rst: -------------------------------------------------------------------------------- 1 | :mod:`geoip` 2 | ============ 3 | 4 | .. module:: king_phisher.geoip 5 | :synopsis: 6 | 7 | This module uses GeoLite2 data created by MaxMind, available from 8 | `http://www.maxmind.com `_. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: DB_RESULT_FIELDS 14 | :annotation: 15 | 16 | Functions 17 | --------- 18 | 19 | .. autofunction:: download_geolite2_city_db 20 | 21 | .. autofunction:: init_database 22 | 23 | .. autofunction:: lookup 24 | 25 | Classes 26 | ------- 27 | 28 | .. autoclass:: Coordinates 29 | :members: 30 | 31 | .. autoclass:: GeoLocation 32 | :members: 33 | :special-members: __init__, __geo_interface__ 34 | :undoc-members: 35 | -------------------------------------------------------------------------------- /docs/source/king_phisher/ics.rst: -------------------------------------------------------------------------------- 1 | :mod:`ics` 2 | ========== 3 | 4 | .. module:: king_phisher.ics 5 | :synopsis: 6 | 7 | This module provides functionality for creating :rfc:`5545` compliant iCalendar 8 | invite files. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: DAY_ABBREVIATIONS 14 | :annotation: 15 | 16 | .. autodata:: zoneinfo_path 17 | :annotation: 18 | 19 | Functions 20 | --------- 21 | 22 | .. autofunction:: get_timedelta_for_offset 23 | 24 | .. autofunction:: get_tz_posix_env_var(tz_name) 25 | 26 | .. autofunction:: parse_tz_posix_env_var(posix_env_var) 27 | 28 | Classes 29 | ------- 30 | 31 | .. autoclass:: Calendar 32 | :members: 33 | :show-inheritance: 34 | :special-members: __init__ 35 | 36 | .. autoclass:: DurationAllDay 37 | :members: 38 | :show-inheritance: 39 | :special-members: __init__ 40 | 41 | .. autoclass:: Timezone 42 | :members: 43 | :show-inheritance: 44 | :special-members: __init__ 45 | 46 | .. autoclass:: TimezoneOffsetDetails 47 | :members: 48 | :show-inheritance: 49 | :special-members: __init__ 50 | -------------------------------------------------------------------------------- /docs/source/king_phisher/index.rst: -------------------------------------------------------------------------------- 1 | The King Phisher Package 2 | ======================== 3 | 4 | .. module:: king_phisher 5 | 6 | .. toctree:: 7 | :maxdepth: 3 8 | :titlesonly: 9 | 10 | client/index.rst 11 | 12 | server/index.rst 13 | 14 | archive.rst 15 | catalog.rst 16 | color.rst 17 | constants.rst 18 | errors.rst 19 | find.rst 20 | geoip.rst 21 | ics.rst 22 | ipaddress.rst 23 | its.rst 24 | plugins.rst 25 | security_keys.rst 26 | serializers.rst 27 | sms.rst 28 | smtp_server.rst 29 | spf.rst 30 | ssh_forward.rst 31 | startup.rst 32 | templates.rst 33 | testing.rst 34 | ua_parser.rst 35 | utilities.rst 36 | version.rst 37 | xor.rst 38 | -------------------------------------------------------------------------------- /docs/source/king_phisher/ipaddress.rst: -------------------------------------------------------------------------------- 1 | :mod:`ipaddress` 2 | ================ 3 | 4 | .. module:: king_phisher.ipaddress 5 | :synopsis: 6 | 7 | This module provides functionality for dealing with an external "ipaddress" 8 | module in a Python 2 backwards compatible way. In Python 2 all string address 9 | arguments are converted to unicode which removes the ability to specify 10 | addresses as packed binary strings. 11 | 12 | Functions 13 | --------- 14 | 15 | .. autofunction:: ip_address 16 | 17 | .. autofunction:: ip_network 18 | 19 | .. autofunction:: ip_interface 20 | 21 | .. autofunction:: is_loopback 22 | 23 | .. autofunction:: is_valid 24 | 25 | Classes 26 | ------- 27 | 28 | .. autoclass:: IPv4Address 29 | :members: 30 | 31 | .. autoclass:: IPv4Network 32 | :members: 33 | 34 | .. autoclass:: IPv6Address 35 | :members: 36 | 37 | .. autoclass:: IPv6Network 38 | :members: 39 | -------------------------------------------------------------------------------- /docs/source/king_phisher/its.rst: -------------------------------------------------------------------------------- 1 | :mod:`its` 2 | ========== 3 | 4 | .. module:: king_phisher.its 5 | :synopsis: 6 | 7 | This module contains variables regarding the runtime environment in a standard 8 | location. 9 | 10 | .. note:: 11 | This is a :ref:`"Clean Room" module ` and is suitable for 12 | use during initialization. 13 | 14 | Data 15 | ---- 16 | 17 | .. autodata:: frozen 18 | 19 | .. autodata:: mocked 20 | 21 | .. autodata:: on_linux 22 | 23 | .. autodata:: on_rtd 24 | 25 | .. autodata:: on_windows 26 | 27 | .. autodata:: py_v2 28 | 29 | .. autodata:: py_v3 30 | -------------------------------------------------------------------------------- /docs/source/king_phisher/plugins.rst: -------------------------------------------------------------------------------- 1 | :mod:`plugins` 2 | ============== 3 | 4 | .. module:: king_phisher.plugins 5 | :synopsis: 6 | 7 | This module provides the core functionality necessary to support user provided 8 | plugins. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: recursive_reload 14 | 15 | Classes 16 | ------- 17 | 18 | .. autoclass:: OptionBase 19 | :show-inheritance: 20 | :members: 21 | :special-members: __init__ 22 | 23 | .. autoclass:: OptionBoolean 24 | :show-inheritance: 25 | :members: 26 | :inherited-members: 27 | :special-members: __init__ 28 | 29 | .. autoclass:: OptionEnum 30 | :show-inheritance: 31 | :members: 32 | :inherited-members: 33 | :special-members: __init__ 34 | 35 | .. autoclass:: OptionInteger 36 | :show-inheritance: 37 | :members: 38 | :inherited-members: 39 | :special-members: __init__ 40 | 41 | .. autoclass:: OptionString 42 | :show-inheritance: 43 | :members: 44 | :inherited-members: 45 | :special-members: __init__ 46 | 47 | .. autoclass:: PluginBase 48 | :show-inheritance: 49 | :members: 50 | :special-members: __init__ 51 | 52 | .. autoclass:: PluginBaseMeta 53 | :show-inheritance: 54 | :members: 55 | :special-members: __init__ 56 | 57 | .. autoclass:: PluginManagerBase 58 | :show-inheritance: 59 | :members: 60 | :special-members: __init__ 61 | 62 | .. autoclass:: Requirements 63 | :show-inheritance: 64 | :members: 65 | :special-members: __init__ 66 | -------------------------------------------------------------------------------- /docs/source/king_phisher/security_keys.rst: -------------------------------------------------------------------------------- 1 | :mod:`security_keys` 2 | ==================== 3 | 4 | .. module:: king_phisher.security_keys 5 | :synopsis: 6 | 7 | This module provides functionality for working with security keys that are 8 | used for data integrity checks. Verification is performed using ECDSA keys. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: ecdsa_curves 14 | :annotation: 15 | 16 | Functions 17 | --------- 18 | 19 | .. autofunction:: openssl_decrypt_data 20 | 21 | .. autofunction:: openssl_derive_key_and_iv 22 | 23 | Classes 24 | ------- 25 | 26 | .. autoclass:: SecurityKeys 27 | :show-inheritance: 28 | :members: 29 | :inherited-members: 30 | :special-members: __init__ 31 | 32 | .. autoclass:: SigningKey 33 | :show-inheritance: 34 | :members: 35 | 36 | .. autoclass:: VerifyingKey 37 | :show-inheritance: 38 | :members: 39 | -------------------------------------------------------------------------------- /docs/source/king_phisher/serializers.rst: -------------------------------------------------------------------------------- 1 | :mod:`serializers` 2 | ================== 3 | 4 | .. module:: king_phisher.serializers 5 | :synopsis: 6 | 7 | This module provides a standardized interface for serializing objects using 8 | different formats. The Serializers provided by this module are organized by 9 | their format into different classes. The necessary methods for utilizing them 10 | are all ``classmethod``'s making it unnecessary to create an instance of any 11 | of them. 12 | 13 | Functions 14 | --------- 15 | 16 | .. autofunction:: from_elementtree_element 17 | 18 | .. autofunction:: to_elementtree_subelement 19 | 20 | Classes 21 | ------- 22 | 23 | .. autoclass:: JSON 24 | :show-inheritance: 25 | :members: 26 | 27 | .. autoclass:: MsgPack 28 | :show-inheritance: 29 | :members: 30 | 31 | .. autoclass:: Serializer 32 | :show-inheritance: 33 | :members: 34 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/aaa.rst: -------------------------------------------------------------------------------- 1 | :mod:`aaa` 2 | ========== 3 | 4 | .. module:: king_phisher.server.aaa 5 | :synopsis: 6 | 7 | This module provides the functionality authentication authorization and access 8 | to the server application. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: AuthenticatedSession 14 | :show-inheritance: 15 | :members: 16 | :special-members: __init__ 17 | :undoc-members: 18 | 19 | .. autoclass:: AuthenticatedSessionManager 20 | :show-inheritance: 21 | :members: 22 | :special-members: __init__ 23 | :undoc-members: 24 | 25 | .. autoclass:: CachedPassword 26 | :show-inheritance: 27 | :members: 28 | :special-members: __init__ 29 | :undoc-members: 30 | 31 | .. autoclass:: ForkedAuthenticator 32 | :show-inheritance: 33 | :members: 34 | :special-members: __init__ 35 | :undoc-members: 36 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/build.rst: -------------------------------------------------------------------------------- 1 | :mod:`build` 2 | ============ 3 | 4 | .. module:: king_phisher.server.build 5 | :synopsis: 6 | 7 | This module contains the functionality to build a new server instance from a 8 | configuration file. This intends to keep the error checking logic for 9 | potential configuration problems contained. 10 | 11 | Functions 12 | --------- 13 | 14 | .. autofunction:: get_bind_addresses 15 | 16 | .. autofunction:: get_ssl_hostnames 17 | 18 | .. autofunction:: server_from_config 19 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/configuration.rst: -------------------------------------------------------------------------------- 1 | :mod:`configuration` 2 | ==================== 3 | 4 | .. module:: king_phisher.server.configuration 5 | :synopsis: 6 | 7 | This module provides the functionality to load the server's configuration data. 8 | 9 | Functions 10 | --------- 11 | 12 | .. autofunction:: ex_load_config 13 | 14 | Classes 15 | ------- 16 | 17 | .. autoclass:: Configuration 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/database/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`database` 2 | =============== 3 | 4 | .. module:: king_phisher.server.database 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | manager.rst 11 | models.rst 12 | storage.rst 13 | validation.rst 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/database/manager.rst: -------------------------------------------------------------------------------- 1 | :mod:`manager` 2 | ============== 3 | 4 | .. module:: king_phisher.server.database.manager 5 | :synopsis: 6 | 7 | This module provides the functionality to manage the server application's 8 | database connection. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: clear_database 14 | 15 | .. autofunction:: export_database 16 | 17 | .. autofunction:: import_database 18 | 19 | .. autofunction:: normalize_connection_url 20 | 21 | .. autofunction:: get_metadata 22 | 23 | .. autofunction:: get_row_by_id 24 | 25 | .. autofunction:: init_alembic 26 | 27 | .. autofunction:: init_database 28 | 29 | .. autofunction:: init_database_postgresql 30 | 31 | .. autofunction:: set_metadata 32 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/database/models.rst: -------------------------------------------------------------------------------- 1 | :mod:`models` 2 | ============= 3 | 4 | .. module:: king_phisher.server.database.models 5 | :synopsis: 6 | 7 | This module provides the models for the data stored in the database as well as 8 | functionality for defining and managing the models themselves. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: database_tables 14 | :annotation: 15 | 16 | .. autodata:: SCHEMA_VERSION 17 | :annotation: 18 | 19 | Functions 20 | --------- 21 | 22 | .. autofunction:: current_timestamp 23 | 24 | .. autofunction:: get_tables_with_column_id 25 | 26 | .. autofunction:: register_table 27 | 28 | .. autofunction:: sql_null 29 | 30 | Classes 31 | ------- 32 | 33 | .. autoclass:: BaseRowCls 34 | :show-inheritance: 35 | :members: 36 | 37 | .. autoclass:: MetaTable 38 | :show-inheritance: 39 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/database/storage.rst: -------------------------------------------------------------------------------- 1 | :mod:`storage` 2 | ======================= 3 | 4 | .. module:: king_phisher.server.database.storage 5 | :synopsis: 6 | 7 | This module provides functionality to utilize the database for persistent 8 | storage. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: KeyValueStorage 14 | :members: 15 | :special-members: __init__ 16 | :undoc-members: 17 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/database/validation.rst: -------------------------------------------------------------------------------- 1 | :mod:`validation` 2 | ================= 3 | 4 | .. module:: king_phisher.server.database.validation 5 | :synopsis: 6 | 7 | This module provides the functionality to perform context-sensitive validation 8 | of database models. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: validate_credential 14 | 15 | .. autofunction:: validate_credential_fields 16 | 17 | Classes 18 | ------- 19 | 20 | .. autoclass:: CredentialCollection 21 | :show-inheritance: 22 | :members: 23 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/fs_utilities.rst: -------------------------------------------------------------------------------- 1 | :mod:`fs_utilities` 2 | =================== 3 | 4 | .. module:: king_phisher.server.fs_utilities 5 | :synopsis: 6 | 7 | This module collects various useful file system utility functions that are used throughout 8 | the application. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: access 14 | 15 | .. autofunction:: chown 16 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/graphql/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`graphql` 2 | ============== 3 | 4 | .. module:: king_phisher.server.graphql 5 | 6 | This package provides the `GraphQL `_ interface for 7 | querying information from the King Phisher server. This allows flexibility in 8 | how the client would like for the returned data to be formatted. This interface 9 | can be accessed directly by the server or through the RPC end point at 10 | :py:func:`~king_phisher.server.server_rpc.rpc_graphql`. 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :titlesonly: 15 | 16 | types/index.rst 17 | 18 | middleware.rst 19 | schema.rst 20 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/graphql/middleware.rst: -------------------------------------------------------------------------------- 1 | :mod:`middleware` 2 | ================= 3 | 4 | .. module:: king_phisher.server.graphql.middleware 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: AuthorizationMiddleware 11 | :show-inheritance: 12 | :members: 13 | 14 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/graphql/schema.rst: -------------------------------------------------------------------------------- 1 | :mod:`schema` 2 | ============= 3 | 4 | .. module:: king_phisher.server.graphql.schema 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: Query 11 | :show-inheritance: 12 | 13 | .. autoclass:: Schema 14 | :show-inheritance: 15 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/graphql/types/database.rst: -------------------------------------------------------------------------------- 1 | :mod:`database` 2 | =============== 3 | 4 | .. module:: king_phisher.server.graphql.types.database 5 | :synopsis: 6 | 7 | Functions 8 | --------- 9 | 10 | .. autofunction:: sa_get_relationship 11 | 12 | .. autofunction:: sa_object_resolver 13 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/graphql/types/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`types` 2 | ============ 3 | 4 | .. module:: king_phisher.server.graphql.types 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | :titlesonly: 9 | 10 | database.rst 11 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/index.rst: -------------------------------------------------------------------------------- 1 | :mod:`server` 2 | ============= 3 | 4 | .. module:: king_phisher.server 5 | 6 | This package contains all packages and modules specific to the server 7 | application. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :titlesonly: 12 | 13 | database/index.rst 14 | graphql/index.rst 15 | 16 | aaa.rst 17 | build.rst 18 | configuration.rst 19 | fs_utilities.rst 20 | letsencrypt.rst 21 | plugins.rst 22 | pylibc.rst 23 | rest_api.rst 24 | server.rst 25 | server_rpc.rst 26 | signals.rst 27 | template_extras.rst 28 | web_sockets.rst 29 | web_tools.rst 30 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/letsencrypt.rst: -------------------------------------------------------------------------------- 1 | :mod:`letsencrypt` 2 | ================== 3 | 4 | .. module:: king_phisher.server.letsencrypt 5 | :synopsis: 6 | 7 | This module provides the functionality related to managing SSL certificates with 8 | Let's Encrypt. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: LETS_ENCRYPT_DEFAULT_DATA_PATH 14 | :annotation: 15 | 16 | Functions 17 | --------- 18 | 19 | .. autofunction:: certbot_issue 20 | 21 | .. autofunction:: get_certbot_bin_path 22 | 23 | .. autofunction:: get_sni_hostname_config 24 | 25 | .. autofunction:: get_sni_hostnames 26 | 27 | Classes 28 | ------- 29 | 30 | .. autoclass:: SNIHostnameConfiguration 31 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/plugins.rst: -------------------------------------------------------------------------------- 1 | :mod:`plugins` 2 | ============== 3 | 4 | .. module:: king_phisher.server.plugins 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: ServerPlugin 11 | :show-inheritance: 12 | :members: 13 | 14 | .. autoclass:: ServerPluginManager 15 | :show-inheritance: 16 | :members: 17 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/pylibc.rst: -------------------------------------------------------------------------------- 1 | :mod:`pylibc` 2 | ============= 3 | 4 | .. module:: king_phisher.server.pylibc 5 | :synopsis: 6 | 7 | This module provides a wrapped interface for Linux's libc. Most of this 8 | functionality is duplicated in Python's own :py:mod:`grp` and :py:mod:`pwd` 9 | modules. This implementation however, using :py:mod:`ctypes` to directly 10 | interface with libc is necessary to avoid dead-lock issues when authenticating 11 | non-local users such as would be found in an environment using an LDAP server. 12 | 13 | Functions 14 | --------- 15 | 16 | .. autofunction:: getgrnam 17 | 18 | .. autofunction:: getgrouplist 19 | 20 | .. autofunction:: getpwnam 21 | 22 | .. autofunction:: getpwuid -------------------------------------------------------------------------------- /docs/source/king_phisher/server/rest_api.rst: -------------------------------------------------------------------------------- 1 | :mod:`rest_api` 2 | =============== 3 | 4 | .. module:: king_phisher.server.rest_api 5 | :synopsis: 6 | 7 | This module provides the functionality exposed by the server application's REST 8 | API. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: REST_API_BASE 14 | :annotation: 15 | 16 | Functions 17 | --------- 18 | 19 | .. autofunction:: generate_token 20 | 21 | .. autofunction:: rest_handler 22 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/server.rst: -------------------------------------------------------------------------------- 1 | :mod:`server` 2 | ============= 3 | 4 | .. module:: king_phisher.server.server 5 | :synopsis: 6 | 7 | This module contains the functionality that provides the application's low-level 8 | HTTP server logic. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: KingPhisherRequestHandler 14 | :show-inheritance: 15 | :members: 16 | 17 | .. autoclass:: KingPhisherServer 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | :undoc-members: 22 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/server_rpc.rst: -------------------------------------------------------------------------------- 1 | :mod:`server_rpc` 2 | ================= 3 | 4 | .. module:: king_phisher.server.server_rpc 5 | :synopsis: 6 | 7 | This module provides the RPC server functionality that is used by the client 8 | to communicate with the server application. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: CONFIG_READABLE 14 | :annotation: 15 | 16 | .. autodata:: CONFIG_WRITEABLE 17 | :annotation: 18 | 19 | .. autodata:: RPC_AUTH_HEADER 20 | 21 | .. autodata:: VIEW_ROW_COUNT 22 | 23 | Functions 24 | --------- 25 | 26 | .. autofunction:: register_rpc 27 | 28 | .. autofunction:: rpc_campaign_alerts_is_subscribed 29 | 30 | .. autofunction:: rpc_campaign_alerts_subscribe 31 | 32 | .. autofunction:: rpc_campaign_alerts_unsubscribe 33 | 34 | .. autofunction:: rpc_campaign_landing_page_new 35 | 36 | .. autofunction:: rpc_campaign_message_new 37 | 38 | .. autofunction:: rpc_campaign_new 39 | 40 | .. autofunction:: rpc_campaign_stats 41 | 42 | .. autofunction:: rpc_config_get 43 | 44 | .. autofunction:: rpc_config_set 45 | 46 | .. autofunction:: rpc_events_is_subscribed 47 | 48 | .. autofunction:: rpc_events_subscribe 49 | 50 | .. autofunction:: rpc_events_unsubscribe 51 | 52 | .. autofunction:: rpc_database_count_rows 53 | 54 | .. autofunction:: rpc_database_delete_row_by_id 55 | 56 | .. autofunction:: rpc_database_delete_rows_by_id 57 | 58 | .. autofunction:: rpc_database_get_row_by_id 59 | 60 | .. autofunction:: rpc_database_insert_row 61 | 62 | .. autofunction:: rpc_database_set_row_value 63 | 64 | .. autofunction:: rpc_database_view_rows 65 | 66 | .. autofunction:: rpc_geoip_lookup 67 | 68 | .. autofunction:: rpc_geoip_lookup_multi 69 | 70 | .. autofunction:: rpc_graphql 71 | 72 | .. autofunction:: rpc_hostnames_add 73 | 74 | .. autofunction:: rpc_hostnames_get 75 | 76 | .. autofunction:: rpc_login 77 | 78 | .. autofunction:: rpc_logout 79 | 80 | .. autofunction:: rpc_ping 81 | 82 | .. autofunction:: rpc_plugins_list 83 | 84 | .. autofunction:: rpc_shutdown 85 | 86 | .. autofunction:: rpc_ssl_letsencrypt_issue 87 | 88 | .. autofunction:: rpc_ssl_letsencrypt_certbot_version 89 | 90 | .. autofunction:: rpc_ssl_sni_hostnames_get 91 | 92 | .. autofunction:: rpc_ssl_sni_hostnames_load 93 | 94 | .. autofunction:: rpc_ssl_sni_hostnames_unload 95 | 96 | .. autofunction:: rpc_ssl_status 97 | 98 | .. autofunction:: rpc_version 99 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/signals.rst: -------------------------------------------------------------------------------- 1 | :mod:`signals` 2 | ============== 3 | 4 | .. module:: king_phisher.server.signals 5 | :synopsis: 6 | 7 | This module contains the signals which are used by the server to dispatch 8 | events. Additional signal details regarding how these signals are used is 9 | available in the :ref:`server-signals-label` documentation. 10 | 11 | Functions 12 | --------- 13 | 14 | .. autofunction:: send_safe 15 | 16 | Signals 17 | ------- 18 | 19 | .. autodata:: campaign_alert 20 | :annotation: 21 | 22 | .. autodata:: credentials_received 23 | :annotation: 24 | 25 | .. autodata:: db_initialized 26 | :annotation: 27 | 28 | .. autodata:: db_session_deleted 29 | :annotation: 30 | 31 | .. autodata:: db_session_inserted 32 | :annotation: 33 | 34 | .. autodata:: db_session_updated 35 | :annotation: 36 | 37 | .. autodata:: db_table_delete 38 | :annotation: 39 | 40 | .. autodata:: db_table_insert 41 | :annotation: 42 | 43 | .. autodata:: db_table_update 44 | :annotation: 45 | 46 | .. autodata:: email_opened 47 | :annotation: 48 | 49 | .. autodata:: request_handle 50 | :annotation: 51 | 52 | .. autodata:: request_received 53 | :annotation: 54 | 55 | .. autodata:: response_sent 56 | :annotation: 57 | 58 | .. autodata:: rpc_method_call 59 | :annotation: 60 | 61 | .. autodata:: rpc_method_called 62 | :annotation: 63 | 64 | .. autodata:: rpc_user_logged_in 65 | :annotation: 66 | 67 | .. autodata:: rpc_user_logged_out 68 | :annotation: 69 | 70 | .. autodata:: server_initialized 71 | :annotation: 72 | 73 | .. autodata:: visit_received 74 | :annotation: 75 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/template_extras.rst: -------------------------------------------------------------------------------- 1 | :mod:`template_extras` 2 | ====================== 3 | 4 | .. module:: king_phisher.server.template_extras 5 | :synopsis: 6 | 7 | This module provides functionality for Jinja functions used to generate server 8 | page content. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: functions 14 | :annotation: 15 | 16 | Functions 17 | --------- 18 | 19 | .. autofunction:: embed_youtube_video 20 | 21 | .. autofunction:: export_function 22 | 23 | .. autofunction:: make_csrf_page 24 | 25 | .. autofunction:: make_redirect_page 26 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/web_sockets.rst: -------------------------------------------------------------------------------- 1 | :mod:`web_sockets` 2 | ================== 3 | 4 | .. module:: king_phisher.server.web_sockets 5 | :synopsis: 6 | 7 | Classes 8 | ------- 9 | 10 | .. autoclass:: Event 11 | :show-inheritance: 12 | :members: 13 | :special-members: __init__ 14 | 15 | .. autoclass:: EventSocket 16 | :show-inheritance: 17 | :members: 18 | :special-members: __init__ 19 | 20 | .. autoclass:: WebSocketsManager 21 | :show-inheritance: 22 | :members: 23 | :special-members: __init__ 24 | :undoc-members: 25 | -------------------------------------------------------------------------------- /docs/source/king_phisher/server/web_tools.rst: -------------------------------------------------------------------------------- 1 | :mod:`web_tools` 2 | ================== 3 | 4 | .. module:: king_phisher.server.web_tools 5 | :synopsis: 6 | 7 | This module contains various functions related to the web-serving configuration 8 | of the server. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: get_hostnames 14 | 15 | .. autofunction:: get_vhost_directories 16 | -------------------------------------------------------------------------------- /docs/source/king_phisher/sms.rst: -------------------------------------------------------------------------------- 1 | :mod:`sms` 2 | ========== 3 | 4 | .. module:: king_phisher.sms 5 | :synopsis: 6 | 7 | This module provides functionality for sending free SMS messages by emailing a 8 | carriers SMS gateway. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: CARRIERS 14 | :annotation: 15 | 16 | .. autodata:: DEFAULT_FROM_ADDRESS 17 | :annotation: 18 | 19 | Functions 20 | --------- 21 | 22 | .. autofunction:: get_smtp_servers(domain) 23 | 24 | .. autofunction:: lookup_carrier_gateway 25 | 26 | .. autofunction:: send_sms 27 | -------------------------------------------------------------------------------- /docs/source/king_phisher/smtp_server.rst: -------------------------------------------------------------------------------- 1 | :mod:`smtp_server` 2 | ================== 3 | 4 | .. module:: king_phisher.smtp_server 5 | :synopsis: 6 | 7 | This module provides a SMTP server that can be used for debugging purposes. 8 | 9 | Classes 10 | ------- 11 | 12 | .. autoclass:: BaseSMTPServer 13 | :show-inheritance: 14 | :members: serve_forever 15 | :special-members: __init__ 16 | -------------------------------------------------------------------------------- /docs/source/king_phisher/spf.rst: -------------------------------------------------------------------------------- 1 | :mod:`spf` 2 | ========== 3 | 4 | .. module:: king_phisher.spf 5 | :synopsis: 6 | 7 | This module provides functionality for checking published Sender Policy 8 | Framework (SPF) records. SPF is defined in :rfc:`7208`. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: DEFAULT_DNS_TIMEOUT 14 | 15 | .. autodata:: MACRO_REGEX 16 | :annotation: 17 | 18 | .. autodata:: MAX_QUERIES 19 | 20 | .. autodata:: MAX_QUERIES_VOID 21 | 22 | .. autodata:: QUALIFIERS 23 | :annotation: 24 | 25 | Functions 26 | --------- 27 | 28 | .. autofunction:: check_host 29 | 30 | .. autofunction:: validate_record 31 | 32 | Classes 33 | ------- 34 | 35 | .. autoclass:: SenderPolicyFramework 36 | :members: 37 | :special-members: __init__ 38 | :undoc-members: 39 | 40 | .. autoclass:: SPFDirective 41 | :special-members: __init__ 42 | :undoc-members: 43 | 44 | .. autoclass:: SPFMatch 45 | :special-members: __init__ 46 | :undoc-members: 47 | 48 | .. autoclass:: SPFRecord 49 | :special-members: __init__ 50 | :undoc-members: 51 | 52 | Exceptions 53 | ---------- 54 | 55 | .. autoexception:: SPFError 56 | :members: 57 | :show-inheritance: 58 | :undoc-members: 59 | 60 | .. autoexception:: SPFTempError 61 | :members: 62 | :show-inheritance: 63 | :undoc-members: 64 | 65 | .. autoexception:: SPFTimeOutError 66 | :members: 67 | :show-inheritance: 68 | :undoc-members: 69 | 70 | .. autoexception:: SPFParseError 71 | :members: 72 | :show-inheritance: 73 | :undoc-members: 74 | 75 | .. autoexception:: SPFPermError 76 | :members: 77 | :show-inheritance: 78 | :undoc-members: 79 | -------------------------------------------------------------------------------- /docs/source/king_phisher/ssh_forward.rst: -------------------------------------------------------------------------------- 1 | :mod:`ssh_forward` 2 | ================== 3 | 4 | .. module:: king_phisher.ssh_forward 5 | :synopsis: 6 | 7 | This module provides functionality for forwarding network services over SSH. 8 | 9 | Classes 10 | ------- 11 | 12 | .. autoclass:: SSHTCPForwarder 13 | :show-inheritance: 14 | :members: 15 | :special-members: __init__ 16 | 17 | Exceptions 18 | ---------- 19 | 20 | .. autoclass:: KingPhisherSSHKeyError 21 | :show-inheritance: 22 | :members: 23 | :undoc-members: 24 | -------------------------------------------------------------------------------- /docs/source/king_phisher/startup.rst: -------------------------------------------------------------------------------- 1 | :mod:`startup` 2 | ============== 3 | 4 | .. module:: king_phisher.startup 5 | :synopsis: 6 | 7 | This module provides generic functions for the early initialization of the 8 | project's environment. This is primarily used for the management of external 9 | dependencies. 10 | 11 | .. note:: 12 | This is a :ref:`"Clean Room" module ` and is suitable for 13 | use during initialization. 14 | 15 | Functions 16 | --------- 17 | 18 | .. autofunction:: argp_add_client 19 | 20 | .. autofunction:: argp_add_default_args 21 | 22 | .. autofunction:: argp_add_server 23 | 24 | .. autofunction:: pipenv_entry 25 | 26 | .. autofunction:: run_process 27 | 28 | .. autofunction:: start_process 29 | 30 | .. autofunction:: which 31 | 32 | Classes 33 | ------- 34 | 35 | .. autoclass:: ProcessResults 36 | -------------------------------------------------------------------------------- /docs/source/king_phisher/templates.rst: -------------------------------------------------------------------------------- 1 | :mod:`templates` 2 | ================ 3 | 4 | .. module:: king_phisher.templates 5 | :synopsis: 6 | 7 | This module provides base classes for the Jinja2 environments used throughout 8 | the application. 9 | 10 | Classes 11 | ------- 12 | 13 | .. autoclass:: FindFileSystemLoader 14 | :show-inheritance: 15 | :members: 16 | 17 | .. autoclass:: TemplateEnvironmentBase 18 | :show-inheritance: 19 | :members: 20 | :special-members: __init__ 21 | :undoc-members: 22 | 23 | .. autoclass:: MessageTemplateEnvironment 24 | :show-inheritance: 25 | :members: 26 | :undoc-members: 27 | -------------------------------------------------------------------------------- /docs/source/king_phisher/testing.rst: -------------------------------------------------------------------------------- 1 | :mod:`testing` 2 | ============== 3 | 4 | .. module:: king_phisher.testing 5 | :synopsis: 6 | 7 | This module provides supporting functionality for the included application unit 8 | tests. 9 | 10 | Data 11 | ---- 12 | 13 | .. autodata:: TEST_MESSAGE_TEMPLATE 14 | :annotation: 15 | 16 | .. autodata:: TEST_MESSAGE_TEMPLATE_INLINE_IMAGE 17 | :annotation: 18 | 19 | Classes 20 | ------- 21 | 22 | .. autoclass:: KingPhisherTestCase 23 | :show-inheritance: 24 | :members: 25 | 26 | .. autoclass:: KingPhisherServerTestCase 27 | :show-inheritance: 28 | :members: 29 | -------------------------------------------------------------------------------- /docs/source/king_phisher/ua_parser.rst: -------------------------------------------------------------------------------- 1 | :mod:`ua_parser` 2 | ================ 3 | 4 | .. module:: king_phisher.ua_parser 5 | :synopsis: 6 | 7 | This module provides functionality for parsing browser user agents to extract 8 | information from them. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: parse_user_agent 14 | 15 | Classes 16 | ------- 17 | 18 | .. autoclass:: UserAgent 19 | :members: 20 | -------------------------------------------------------------------------------- /docs/source/king_phisher/utilities.rst: -------------------------------------------------------------------------------- 1 | :mod:`utilities` 2 | ================ 3 | 4 | .. module:: king_phisher.utilities 5 | :synopsis: 6 | 7 | This module collects various useful utility functions that are used throughout 8 | the application. 9 | 10 | Functions 11 | --------- 12 | 13 | .. autofunction:: argp_add_args 14 | 15 | .. autofunction:: assert_arg_type 16 | 17 | .. autofunction:: configure_stream_logger 18 | 19 | .. autofunction:: datetime_local_to_utc 20 | 21 | .. autofunction:: datetime_utc_to_local 22 | 23 | .. autofunction:: format_datetime 24 | 25 | .. autofunction:: is_valid_email_address 26 | 27 | .. autofunction:: make_message_uid 28 | 29 | .. autofunction:: make_webrelpath 30 | 31 | .. autofunction:: make_visit_uid 32 | 33 | .. autofunction:: nonempty_string 34 | 35 | .. autofunction:: open_uri 36 | 37 | .. autofunction:: parse_datetime 38 | 39 | .. autofunction:: password_is_complex 40 | 41 | .. autofunction:: random_string 42 | 43 | .. autofunction:: random_string_lower_numeric 44 | 45 | .. autofunction:: switch 46 | 47 | .. autofunction:: validate_json_schema 48 | 49 | Classes 50 | ------- 51 | 52 | .. autoclass:: Event 53 | :show-inheritance: 54 | :members: 55 | 56 | .. autoclass:: FreezableDict 57 | :show-inheritance: 58 | :members: 59 | 60 | .. autoclass:: PrefixLoggerAdapter 61 | :show-inheritance: 62 | :members: 63 | :special-members: __init__ 64 | 65 | .. autoclass:: Mock 66 | :show-inheritance: 67 | 68 | .. autoclass:: Thread -------------------------------------------------------------------------------- /docs/source/king_phisher/version.rst: -------------------------------------------------------------------------------- 1 | :mod:`version` 2 | ============== 3 | 4 | .. module:: king_phisher.version 5 | :synopsis: 6 | 7 | This module collects all import version information for the application. This 8 | is the authoritative source for the applications version information and should 9 | be used anywhere the version is required. 10 | 11 | .. note:: 12 | This is a :ref:`"Clean Room" module ` and is suitable for 13 | use during initialization. 14 | 15 | Data 16 | ---- 17 | 18 | .. autodata:: distutils_version 19 | 20 | .. autodata:: revision 21 | 22 | .. autodata:: rpc_api_version 23 | 24 | .. autodata:: version 25 | 26 | .. autodata:: version_info 27 | 28 | .. autodata:: version_label 29 | 30 | Functions 31 | --------- 32 | 33 | .. autofunction:: get_revision 34 | -------------------------------------------------------------------------------- /docs/source/king_phisher/xor.rst: -------------------------------------------------------------------------------- 1 | :mod:`xor` 2 | ========== 3 | 4 | .. module:: king_phisher.xor 5 | :synopsis: 6 | 7 | This module provides basic support for XOR encoding and decoding operations. 8 | 9 | Functions 10 | --------- 11 | 12 | .. autofunction:: xor_decode 13 | 14 | .. autofunction:: xor_encode 15 | -------------------------------------------------------------------------------- /docs/source/plugins/index.rst: -------------------------------------------------------------------------------- 1 | Plugins 2 | ======= 3 | 4 | Starting with version :release:`1.3.0` King Phisher includes a plugin system. 5 | Both client and server plugins are supported with the common functionality for 6 | the two being provided by the :py:mod:`plugins` module and then extended by 7 | the irrespective implementations in :py:mod:`king_phisher.client.plugins` and 8 | :py:mod:`king_phisher.server.plugins`. 9 | 10 | King Phisher supports loading plugins to allow the user to add additional 11 | features out side of what is supported by the main-stream application. These 12 | plugins are implemented as Python modules which define a ``Plugin`` class that 13 | is the respective plugins entry point as well as the host for various pieces of 14 | metadata in the form of class-attributes. 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | :titlesonly: 19 | 20 | compatibility.rst 21 | client.rst 22 | server.rst 23 | -------------------------------------------------------------------------------- /docs/source/server/database/database_relationships.dot: -------------------------------------------------------------------------------- 1 | // diagram of database table relationships 2 | digraph { 3 | AlertSubscription 4 | AuthenticatedSession 5 | Campaign 6 | CampaignType 7 | Company 8 | CompanyDepartment 9 | Credential 10 | DeaddropConnection 11 | DeaddropDeployment 12 | Industry 13 | LandingPage 14 | StorageData 15 | Message 16 | User 17 | Visit 18 | 19 | // style=dashed for foreign key constraints which are nullable 20 | Campaign -> AlertSubscription 21 | Campaign -> Credential 22 | Campaign -> DeaddropDeployment 23 | Campaign -> DeaddropConnection 24 | Campaign -> LandingPage 25 | Campaign -> Message 26 | Campaign -> Visit 27 | CampaignType -> Campaign [style=dashed] 28 | Company -> Campaign [style=dashed] 29 | CompanyDepartment -> Message [style=dashed] 30 | DeaddropDeployment -> DeaddropConnection 31 | Industry -> Company [style=dashed] 32 | LandingPage -> Visit [style=dashed] 33 | Message -> Credential 34 | Message -> Visit 35 | User -> AlertSubscription 36 | User -> AuthenticatedSession 37 | User -> Campaign 38 | Visit -> Credential 39 | } 40 | -------------------------------------------------------------------------------- /docs/source/server/database/index.rst: -------------------------------------------------------------------------------- 1 | Database 2 | ======== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :titlesonly: 7 | 8 | overview.rst 9 | schema.rst 10 | -------------------------------------------------------------------------------- /docs/source/server/graphql/index.rst: -------------------------------------------------------------------------------- 1 | GraphQL 2 | ======= 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | :titlesonly: 7 | 8 | overview.rst 9 | schema.rst 10 | example_queries.rst 11 | -------------------------------------------------------------------------------- /docs/source/server/index.rst: -------------------------------------------------------------------------------- 1 | The King Phisher Server 2 | ======================= 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :titlesonly: 7 | 8 | database/index.rst 9 | graphql/index.rst 10 | 11 | published_events.rst 12 | rest_api.rst 13 | rpc_api.rst 14 | signals.rst 15 | -------------------------------------------------------------------------------- /docs/source/server/published_events.rst: -------------------------------------------------------------------------------- 1 | .. _server-published-events-label: 2 | 3 | Published Events 4 | ================ 5 | 6 | Overview 7 | -------- 8 | 9 | Certain signals used by the server can be forwarded to clients via event 10 | subscriptions. In order to take advantage of this functionality the client 11 | opens a web socket to the server, and configures it's subscriptions using 12 | the available :ref:`rpc-api-event-api-label` functions. When a server signal is 13 | emitted the corresponding information is then forwarded to the subscribed 14 | clients over their open websocket. 15 | 16 | .. _server-published-events-database-label: 17 | 18 | Database Events 19 | --------------- 20 | 21 | Database events can be subscribed to using the *event_id* of ``db-TABLE_NAME``. 22 | Each of these events have the following sub-event types for each of the 23 | database operations. 24 | 25 | * ``deleted`` 26 | * ``inserted`` 27 | * ``updated`` 28 | 29 | These events are emitted by the respective ``db_session_*`` 30 | :ref:`server-signals-database-label`. These signals are converted to events and 31 | organized by table (e.g. messages) instead of operation (e.g. inserted) because 32 | events are configured to send specific attributes. Not all attributes are 33 | available on all tables, however for one table the available attributes will 34 | always be available for all operations. 35 | -------------------------------------------------------------------------------- /king_phisher/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from . import version 34 | 35 | __version__ = version.version.split('-', 1)[0] 36 | -------------------------------------------------------------------------------- /king_phisher/client/assistants/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/client/assistants/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from .campaign import * 34 | -------------------------------------------------------------------------------- /king_phisher/client/dialogs/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/client/dialogs/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from .about import * 34 | from .campaign_selection import * 35 | from .clone_page import * 36 | from .company_editor import * 37 | from .configuration import * 38 | from .entry import * 39 | from .exception import * 40 | from .login import * 41 | from .ssh_host_key import * 42 | from .tag_editor import * 43 | -------------------------------------------------------------------------------- /king_phisher/client/dialogs/about.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/client/dialogs/about.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from king_phisher import find 34 | from king_phisher import utilities 35 | from king_phisher import version 36 | from king_phisher.client import gui_utilities 37 | 38 | from gi.repository import GdkPixbuf 39 | 40 | __all__ = ('AboutDialog',) 41 | 42 | class AboutDialog(gui_utilities.GladeGObject): 43 | """ 44 | Display a :py:class:`Gtk.AboutDialog` with information regarding the King 45 | Phisher client. 46 | """ 47 | top_gobject = 'dialog' 48 | def __init__(self, *args, **kwargs): 49 | super(AboutDialog, self).__init__(*args, **kwargs) 50 | logo_file_path = find.data_file('king-phisher-icon.svg') 51 | if logo_file_path: 52 | logo_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(logo_file_path, 128, 128) 53 | self.dialog.set_property('logo', logo_pixbuf) 54 | self.dialog.set_property('version', version.version) 55 | self.dialog.connect('activate-link', lambda _, url: utilities.open_uri(url)) 56 | 57 | def interact(self): 58 | self.dialog.show_all() 59 | self.dialog.run() 60 | self.dialog.destroy() 61 | -------------------------------------------------------------------------------- /king_phisher/client/tabs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/client/tabs/__init__.py -------------------------------------------------------------------------------- /king_phisher/client/widget/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/client/widget/__init__.py -------------------------------------------------------------------------------- /king_phisher/client/windows/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/client/windows/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from .main import * 34 | from .rpc_terminal import * 35 | -------------------------------------------------------------------------------- /king_phisher/client/windows/html.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/client/windows/html.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from king_phisher.client import gui_utilities 34 | from king_phisher.client.widget import extras 35 | 36 | __all__ = ('HTMLWindow',) 37 | 38 | class HTMLWindow(gui_utilities.GladeGObject): 39 | """ 40 | This basic window contains a :py:class:`~.extras.WebKitHTMLView` widget for 41 | rendering and displaying HTML content. 42 | """ 43 | dependencies = gui_utilities.GladeDependencies(name='HTMLWindow') 44 | top_gobject = 'window' 45 | def __init__(self, application): 46 | super(HTMLWindow, self).__init__(application) 47 | self.webview = extras.WebKitHTMLView() 48 | """The :py:class:`~.extras.WebKitHTMLView` widget instance.""" 49 | self.webview.show() 50 | self.window.add(self.webview) 51 | -------------------------------------------------------------------------------- /king_phisher/server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/server/__init__.py -------------------------------------------------------------------------------- /king_phisher/server/database/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/server/database/__init__.py -------------------------------------------------------------------------------- /king_phisher/server/database/schema_migration.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/server/database/schema_migration.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import alembic.op 34 | 35 | def drop_columns(table, columns): 36 | for name in columns: 37 | alembic.op.drop_column(table, name) 38 | 39 | def rename_columns(table, columns): 40 | for old_name, new_name in columns: 41 | alembic.op.alter_column(table, old_name, new_column_name=new_name) 42 | -------------------------------------------------------------------------------- /king_phisher/server/graphql/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/server/graphql/__init__.py -------------------------------------------------------------------------------- /king_phisher/server/graphql/types/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/server/graphql/types/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from __future__ import absolute_import 34 | 35 | from .database import * 36 | from .misc import * 37 | from .ssl import * 38 | from .templates import * 39 | -------------------------------------------------------------------------------- /king_phisher/smtp_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # king_phisher/smtp_server.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import asyncore 34 | import logging 35 | import smtpd 36 | 37 | class BaseSMTPServer(smtpd.SMTPServer, object): 38 | """ 39 | An SMTP server useful for debugging. Messages handled by this server 40 | are not forwarded anywhere. 41 | """ 42 | def __init__(self, localaddr, remoteaddr=None): 43 | """ 44 | :param tuple localaddr: The local address to bind to. 45 | :param tuple remoteaddr: The remote address to use as an upstream SMTP relayer. 46 | """ 47 | self.logger = logging.getLogger('KingPhisher.SMTPD') 48 | super(BaseSMTPServer, self).__init__(localaddr, remoteaddr) 49 | self.logger.info("smtp server listening on {0}:{1}".format(localaddr[0], localaddr[1])) 50 | 51 | def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): 52 | self.logger.info("received message from {0} ({1}) to {2}".format(mailfrom, peer[0], ', '.join(rcpttos))) 53 | 54 | def serve_forever(self): 55 | """ 56 | Process requests until :py:meth:`BaseSMTPServer.shutdown` is called. 57 | """ 58 | asyncore.loop() 59 | 60 | def shutdown(self): 61 | raise NotImplementedError() 62 | -------------------------------------------------------------------------------- /king_phisher/sphinxext/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rsmusllp/king-phisher/1bbc1bf122a18085b1ea4af20c9af10cc4cf899e/king_phisher/sphinxext/__init__.py -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | # readthedocs.yml 2 | # https://king-phisher.readthedocs.io/en/latest/ 3 | 4 | build: 5 | image: latest 6 | 7 | python: 8 | version: 3.6 9 | 10 | requirements_file: docs/requirements.txt 11 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import logging 34 | logging.getLogger('KingPhisher').addHandler(logging.NullHandler()) 35 | logging.getLogger('').setLevel(logging.CRITICAL) 36 | logging.captureWarnings(True) 37 | 38 | from .client import * 39 | from .server import * 40 | 41 | from .color import ColorConversionTests 42 | from .find import FindTests 43 | from .find import JSONSchemaDataTests 44 | from .geoip import GeoIPTests 45 | from .geoip import GeoIPRPCTests 46 | from .ics import ICSTests 47 | from .ipaddress import IPAddressTests 48 | from .pipfile import PipfileLockTests 49 | from .plugins import PluginRequirementsTests 50 | from .security_keys import SecurityKeysTests 51 | from .security_keys import SigningKeyTests 52 | from .serializers import ElementTreeTests 53 | from .serializers import JSONSerializerTests 54 | from .serializers import MsgPackSerializerTests 55 | from .sms import SMSTests 56 | from .spf import SPFTests 57 | from .templates import TemplatesTests 58 | from .ua_parser import UserAgentParserTests 59 | from .utilities import UtilitiesTests 60 | from .version import VersionTests 61 | from .xor import XORTests 62 | -------------------------------------------------------------------------------- /tests/client/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import logging 34 | logging.getLogger('KingPhisher').addHandler(logging.NullHandler()) 35 | logging.getLogger('').setLevel(logging.CRITICAL) 36 | 37 | from .widget import * 38 | 39 | from .application import ClientApplicationTests 40 | from .client_rpc import ClientRPCRemoteRowTests 41 | from .dialogs import ClientDialogTests 42 | from .export import ClientExportTests 43 | from .graphs import ClientGraphsTests 44 | from .gtk_builder import ClientGtkBuilderLint 45 | from .gui_utilities import ClientGUIUtilityTests 46 | from .mailer import ClientMailerTests 47 | from .server_events import ServerEventSubscriberTests 48 | -------------------------------------------------------------------------------- /tests/client/application.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/application.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import os 34 | import json 35 | import unittest 36 | 37 | from king_phisher import find 38 | from king_phisher import testing 39 | from king_phisher.client import application 40 | 41 | class ClientApplicationTests(testing.KingPhisherTestCase): 42 | def test_client_main_window_initialize(self): 43 | find.data_path_append('data/client') 44 | application.KingPhisherClientApplication() 45 | 46 | def test_user_paths(self): 47 | app = application.KingPhisherClientApplication() 48 | for user_path in (app.user_data_path, app.user_library_path): 49 | self.assertIsNotNone(user_path) 50 | self.assertIsNotEmpty(user_path) 51 | self.assertTrue(os.path.isdir(user_path)) 52 | self.assertTrue(os.access(user_path, os.R_OK | os.W_OK)) 53 | self.assertEqual(user_path, os.path.abspath(user_path)) 54 | 55 | def test_client_template_config(self): 56 | find.data_path_append('data/client') 57 | config_h = open(find.data_file('client_config.json')) 58 | try: 59 | json.load(config_h) 60 | except Exception: 61 | self.fail("failed to parse the client JSON configuration file") 62 | finally: 63 | config_h.close() 64 | 65 | if __name__ == '__main__': 66 | unittest.main() 67 | -------------------------------------------------------------------------------- /tests/client/dialogs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/dialogs.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import testing 36 | from king_phisher.client import dialogs 37 | from king_phisher.client import gui_utilities 38 | 39 | class ClientDialogTests(testing.KingPhisherTestCase): 40 | def test_client_dialog_classes(self): 41 | dialog_names = list(dialog for dialog in dir(dialogs) if dialog.endswith('Dialog')) 42 | self.assertGreater(len(dialog_names), 0, msg='failed to identify any dialog objects') 43 | for dialog_name in dialog_names: 44 | dialog_obj = getattr(dialogs, dialog_name) 45 | msg = "{0} is not a subclass of GladeGObject".format(dialog_name) 46 | self.assertIsSubclass(dialog_obj, gui_utilities.GladeGObject, msg=msg) 47 | msg = "{0}.top_gobject is not 'dialog'".format(dialog_name) 48 | self.assertEqual(getattr(dialog_obj, 'top_gobject', None), 'dialog', msg=msg) 49 | msg = "{0} has no 'interact' method".format(dialog_name) 50 | self.assertHasAttribute(dialog_obj, 'interact', msg=msg) 51 | 52 | if __name__ == '__main__': 53 | unittest.main() 54 | -------------------------------------------------------------------------------- /tests/client/export.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/export.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import testing 36 | from king_phisher.client.export import * 37 | from king_phisher.client.export import message_template_from_kpm 38 | from king_phisher.client.export import message_template_to_kpm 39 | 40 | class ClientExportTests(testing.KingPhisherTestCase): 41 | def test_value_conversions(self): 42 | self.assertEqual(convert_value('campaigns', 'reject_after_credentials', False), 'False') 43 | self.assertEqual(convert_value('campaigns', 'reject_after_credentials', True), 'True') 44 | self.assertIsNone(convert_value('messages', 'opened', None)) 45 | 46 | def test_message_template_kpm(self): 47 | # test to_kpm first 48 | template, files = message_template_to_kpm(testing.TEST_MESSAGE_TEMPLATE) 49 | self.assertIn("""{{ inline_image(\'image.png\') }}""", template) 50 | msg = 'The inline image path was not returned in the list of files' 51 | self.assertEqual(len(files), 1, msg=msg) 52 | self.assertIn(testing.TEST_MESSAGE_TEMPLATE_INLINE_IMAGE, files, msg=msg) 53 | 54 | # then feed the results into from_kpm 55 | template = message_template_from_kpm(template, files) 56 | self.assertEqual(template, testing.TEST_MESSAGE_TEMPLATE) 57 | 58 | if __name__ == '__main__': 59 | unittest.main() 60 | -------------------------------------------------------------------------------- /tests/client/graphs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/graphs.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import testing 36 | from king_phisher.client import graphs 37 | 38 | class ClientGraphsTests(testing.KingPhisherTestCase): 39 | def test_graph_classes(self): 40 | for graph in graphs.get_graphs(): 41 | self.assertIsInstance(graph, str) 42 | self.assertIsSubclass(graphs.get_graph(graph), graphs.CampaignGraph) 43 | 44 | def test_graphs_found(self): 45 | self.assertGreaterEqual(len(graphs.get_graphs()), 6) 46 | 47 | if __name__ == '__main__': 48 | unittest.main() 49 | -------------------------------------------------------------------------------- /tests/client/gtk_builder.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/gtk_builder_lint.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | import xml.etree.ElementTree as ElementTree 35 | 36 | from king_phisher import find 37 | from king_phisher import testing 38 | 39 | GOBJECT_TOP_REGEX = r'^[A-Z][a-zA-Z0-9]+$' 40 | 41 | class ClientGtkBuilderLint(testing.KingPhisherTestCase): 42 | def setUp(self): 43 | find.data_path_append('data/client') 44 | builder_xml = find.data_file('king-phisher-client.ui') 45 | self.xml_tree = ElementTree.parse(builder_xml) 46 | self.xml_root = self.xml_tree.getroot() 47 | 48 | def test_object_ids_are_valid(self): 49 | for child in self.xml_root: 50 | if child.tag != 'object': 51 | continue 52 | gobject_id = child.attrib['id'] 53 | self.assertRegex(gobject_id, GOBJECT_TOP_REGEX, "invalid gobject id '{0}'".format(gobject_id)) 54 | 55 | if __name__ == '__main__': 56 | unittest.main() 57 | -------------------------------------------------------------------------------- /tests/client/widget/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/client/widget/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import logging 34 | logging.getLogger('KingPhisher').addHandler(logging.NullHandler()) 35 | logging.getLogger('').setLevel(logging.CRITICAL) 36 | 37 | from .completion_providers import ClientJinjaComletionProviderTests 38 | from .managers import ClientTreeViewManagerTests 39 | -------------------------------------------------------------------------------- /tests/find.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/find.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import json 34 | import os 35 | import unittest 36 | 37 | from king_phisher import find 38 | from king_phisher import testing 39 | 40 | class FindTests(testing.KingPhisherTestCase): 41 | def setUp(self): 42 | find.init_data_path() 43 | 44 | def test_find_data_file(self): 45 | self.assertIsNotNone(find.data_file('security.json')) 46 | 47 | def test_find_data_directory(self): 48 | self.assertIsNotNone(find.data_directory('schemas')) 49 | 50 | class JSONSchemaDataTests(testing.KingPhisherTestCase): 51 | def test_json_schema_directories(self): 52 | find.init_data_path() 53 | 54 | directory = find.data_directory(os.path.join('schemas', 'json')) 55 | self.assertIsNotNone(directory) 56 | for schema_file in os.listdir(directory): 57 | self.assertTrue(schema_file.endswith('.json')) 58 | schema_file = os.path.join(directory, schema_file) 59 | with open(schema_file, 'r') as file_h: 60 | schema_data = json.load(file_h) 61 | 62 | self.assertIsInstance(schema_data, dict) 63 | self.assertEqual(schema_data.get('$schema'), 'http://json-schema.org/draft-04/schema#') 64 | self.assertEqual(schema_data.get('id'), os.path.basename(schema_file)[:-5]) 65 | 66 | if __name__ == '__main__': 67 | unittest.main() 68 | -------------------------------------------------------------------------------- /tests/ipaddress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/utilities.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import ipaddress 36 | from king_phisher import testing 37 | 38 | class IPAddressTests(testing.KingPhisherTestCase): 39 | def test_is_valid_ip_address(self): 40 | valid_ips = [ 41 | '127.0.0.1', 42 | '10.0.0.1', 43 | '200.100.0.1', 44 | 'fe80::1', 45 | '::1' 46 | ] 47 | invalid_ips = [ 48 | 'localhost', 49 | 'www.google.com', 50 | '' 51 | ] 52 | for address in valid_ips: 53 | self.assertTrue(ipaddress.is_valid(address)) 54 | for address in invalid_ips: 55 | self.assertFalse(ipaddress.is_valid(address)) 56 | 57 | if __name__ == '__main__': 58 | unittest.main() 59 | -------------------------------------------------------------------------------- /tests/pipfile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/pipfile.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import json 34 | import os 35 | import unittest 36 | 37 | from king_phisher import testing 38 | 39 | class PipfileLockTests(testing.KingPhisherTestCase): 40 | pipfile_lock_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'Pipfile.lock')) 41 | def test_blacklisted_packages_are_not_present(self): 42 | with open(self.pipfile_lock_path, 'r') as file_h: 43 | pipfile_lock = json.load(file_h) 44 | meta = pipfile_lock.get('_meta', {}) 45 | self.assertEqual(meta.get('pipfile-spec'), 6, msg="incompatible specification version, this test must be reviewed") 46 | packages = pipfile_lock.get('default', {}) 47 | self.assertIsNotEmpty(packages) 48 | # a list of packages to blacklist from the default group 49 | blacklisted_package_names = ( 50 | 'alabaster', 51 | 'sphinx', 52 | 'sphinx-rtd-theme', 53 | 'sphinxcontrib-websupport' 54 | ) 55 | for package_name in blacklisted_package_names: 56 | message = "blacklisted package '{}' found in the Pipfile.lock default group".format(package_name) 57 | self.assertNotIn(package_name, packages, msg=message) 58 | 59 | if __name__ == '__main__': 60 | unittest.main() 61 | -------------------------------------------------------------------------------- /tests/server/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/server/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import logging 34 | logging.getLogger('KingPhisher').addHandler(logging.NullHandler()) 35 | logging.getLogger('').setLevel(logging.CRITICAL) 36 | 37 | from .aaa import ServerAuthenticatedSessionManagerTests 38 | from .aaa import ServerAuthenticationTests 39 | from .aaa import ServerCachedPasswordTests 40 | from .configuration import ServerConfigurationTests 41 | from .database import * 42 | from .graphql import ServerGraphQLTests 43 | from .graphql import ServerGraphQLDatabaseTests 44 | from .letsencrypt import ServerSNIHostnameTests 45 | from .rest_api import ServerRESTAPITests 46 | from .server import CampaignWorkflowTests 47 | from .server import ServerTests 48 | from .server_rpc import ServerRPCTests 49 | from .template_extras import TemplateExtraTests 50 | from .web_tools import ServerWebToolsTests 51 | -------------------------------------------------------------------------------- /tests/server/database/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/server/database/__init__.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | 34 | import logging 35 | logging.getLogger('KingPhisher').addHandler(logging.NullHandler()) 36 | logging.getLogger('').setLevel(logging.CRITICAL) 37 | 38 | from .manager import * 39 | from .models import * 40 | from .storage import * 41 | from .validation import * 42 | -------------------------------------------------------------------------------- /tests/server/rest_api.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/server/rest_api.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import json 34 | import unittest 35 | 36 | from king_phisher.server import rest_api 37 | from king_phisher.testing import KingPhisherServerTestCase 38 | 39 | class ServerRESTAPITests(KingPhisherServerTestCase): 40 | def test_rest_api_token(self): 41 | response = self.http_request('/' + rest_api.REST_API_BASE + 'geoip/lookup', include_id=False) 42 | self.assertHTTPStatus(response, 401) 43 | response = self.http_request('/' + rest_api.REST_API_BASE + 'geoip/lookup?token=fake', include_id=False) 44 | self.assertHTTPStatus(response, 401) 45 | 46 | def test_rest_api_geoip_lookup(self): 47 | resource = '/' + rest_api.REST_API_BASE + 'geoip/lookup' 48 | resource += '?token=' + self.config.get('server.rest_api.token') 49 | resource += '&ip=8.8.8.8' 50 | response = self.http_request(resource, include_id=False) 51 | self.assertHTTPStatus(response, 200) 52 | self.assertEqual(response.getheader('Content-Type'), 'application/json') 53 | response = response.read() 54 | if not isinstance(response, str): 55 | response = response.decode('utf-8') 56 | response = json.loads(response) 57 | self.assertIn('result', response) 58 | self.assertIsInstance(response['result'], dict) 59 | 60 | if __name__ == '__main__': 61 | unittest.main() 62 | -------------------------------------------------------------------------------- /tests/server/template_extras.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/server/template_extras.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from king_phisher.testing import KingPhisherServerTestCase 34 | from king_phisher.server import template_extras 35 | 36 | class TemplateExtraTests(KingPhisherServerTestCase): 37 | def test_tempate_functions_are_callable(self): 38 | for name, function in template_extras.functions.items(): 39 | self.assertIsInstance(name, str) 40 | self.assertTrue(callable(function), msg="function '{}' is not callable".format(getattr(function, '__name__', repr(function)))) 41 | 42 | def test_template_functions_exporting(self): 43 | self.assertIsInstance(template_extras.functions, dict) 44 | self.assertNotIn('new_function', template_extras.functions) 45 | 46 | @template_extras.export_function 47 | def new_function(foo): 48 | return foo 49 | self.assertIn('new_function', template_extras.functions) 50 | self.assertIs(template_extras.functions.pop('new_function'), new_function) 51 | -------------------------------------------------------------------------------- /tests/server/web_tools.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/server/web_tools.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | from king_phisher import find 34 | from king_phisher.testing import KingPhisherTestCase 35 | from king_phisher.server import web_tools 36 | from king_phisher.server import configuration 37 | from king_phisher.utilities import random_string 38 | 39 | class ServerWebToolsTests(KingPhisherTestCase): 40 | def setUp(self): 41 | self.config = configuration.Configuration.from_file(find.data_file('server_config.yml')) 42 | 43 | def test_get_hostnames(self): 44 | new_hostname = random_string(16) 45 | config_hostnames = self.config.get_if_exists('server.hostnames', []) 46 | config_hostnames.append(new_hostname) 47 | self.config.set('server.hostnames', config_hostnames) 48 | hostnames = web_tools.get_hostnames(self.config) 49 | self.assertIsInstance(hostnames, tuple) 50 | self.assertIn(new_hostname, hostnames) 51 | 52 | def test_get_vhost_directories(self): 53 | self.config.set('server.vhost_directories', True) 54 | directories = web_tools.get_vhost_directories(self.config) 55 | self.assertIsInstance(directories, tuple) 56 | 57 | def test_get_vhost_directories_is_none_when_vhosts_is_disabled(self): 58 | self.config.set('server.vhost_directories', False) 59 | self.assertIsNone(web_tools.get_vhost_directories(self.config)) 60 | -------------------------------------------------------------------------------- /tests/sms.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/sms.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import testing 36 | from king_phisher.sms import get_smtp_servers, lookup_carrier_gateway 37 | from king_phisher.utilities import random_string 38 | 39 | class SMSTests(testing.KingPhisherTestCase): 40 | def test_lookup_carrier_gateway(self): 41 | rstring = random_string(16) 42 | self.assertIsNone(lookup_carrier_gateway(rstring)) 43 | self.assertEqual(lookup_carrier_gateway('att'), 'txt.att.net') 44 | self.assertEqual(lookup_carrier_gateway('aTt'), 'txt.att.net') 45 | self.assertEqual(lookup_carrier_gateway('AT&T'), 'txt.att.net') 46 | 47 | @testing.skip_if_offline 48 | def test_major_carrier_smtp_server_resolution(self): 49 | major_carriers = ['att', 'sprint', 'verizon'] 50 | for carrier_name in major_carriers: 51 | gateway = lookup_carrier_gateway(carrier_name) 52 | self.assertIsInstance(gateway, str) 53 | smtp_servers = get_smtp_servers(gateway) 54 | self.assertGreater(len(smtp_servers), 0) 55 | 56 | if __name__ == '__main__': 57 | unittest.main() 58 | -------------------------------------------------------------------------------- /tests/xor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tests/xor.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import unittest 34 | 35 | from king_phisher import testing 36 | from king_phisher.utilities import random_string 37 | from king_phisher.xor import * 38 | 39 | class XORTests(testing.KingPhisherTestCase): 40 | def test_xor_encode(self): 41 | plain_string = random_string(16) 42 | encoded_string = xor_encode(plain_string) 43 | self.assertNotEqual(plain_string, encoded_string) 44 | 45 | def test_xor_decode(self): 46 | encoding = 'utf-8' 47 | plain_string = random_string(16) 48 | encoded_string = xor_encode(plain_string, encoding=encoding) 49 | self.assertNotEqual(plain_string, encoded_string) 50 | decoded_string = xor_decode(encoded_string, encoding=encoding) 51 | self.assertEqual(plain_string.encode(encoding), decoded_string) 52 | 53 | if __name__ == '__main__': 54 | unittest.main() 55 | -------------------------------------------------------------------------------- /tools/development/build_msi.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal 3 | 4 | :Variables 5 | set start=%time% 6 | 7 | :: make the entry point for the King Phisher client build 8 | copy king_phisher\client\__main__.py .\KingPhisher 9 | if %ERRORLEVEL% NEQ 0 ( 10 | echo Failed to copy client entry point 11 | echo Error level: %ERRORLEVEL% 12 | exit /b %ERRORLEVEL% 13 | ) 14 | 15 | :: perform the build 16 | python tools\development\cx_freeze.py build 17 | if %ERRORLEVEL% NEQ 0 ( 18 | echo Failed to build the King Phisher exe 19 | echo Error level: %ERRORLEVEL% 20 | exit /b %ERRORLEVEL% 21 | ) 22 | python tools\development\cx_freeze.py bdist_msi 23 | if %ERRORLEVEL% NEQ 0 ( 24 | echo Failed to build the King Phisher msi package 25 | echo Error level: %ERRORLEVEL% 26 | exit /b %ERRORLEVEL% 27 | ) 28 | 29 | :: build complete, calculate the time elapsed 30 | set end=%time% 31 | set options="tokens=1-4 delims=:." 32 | for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100 33 | for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100 34 | 35 | set /a hours=%end_h%-%start_h% 36 | set /a mins=%end_m%-%start_m% 37 | set /a secs=%end_s%-%start_s% 38 | set /a ms=%end_ms%-%start_ms% 39 | if %hours% lss 0 set /a hours = 24%hours% 40 | if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins% 41 | if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs% 42 | if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms% 43 | if 1%ms% lss 100 set ms=0%ms% 44 | 45 | :: mission accomplished 46 | set /a totalsecs = %hours%*3600 + %mins%*60 + %secs% 47 | echo build completed in %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total) 48 | 49 | echo the generated exe is located in the build/ directory 50 | echo the generated msi is located in the dist/ directory 51 | -------------------------------------------------------------------------------- /tools/development/test_runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # tools/development/test_runner.py 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of the project nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | # 32 | 33 | import os 34 | import sys 35 | import unittest 36 | 37 | sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) 38 | 39 | from tests import * 40 | 41 | if __name__ == '__main__': 42 | unittest.main() 43 | -------------------------------------------------------------------------------- /tools/mac_client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian 2 | LABEL maintainer "Alex Cline " 3 | 4 | RUN apt-get update && apt-get install -y \ 5 | build-essential \ 6 | libssl-dev \ 7 | libffi-dev \ 8 | python-dev \ 9 | dirmngr \ 10 | gnupg \ 11 | libgl1-mesa-dri \ 12 | libgl1-mesa-glx \ 13 | git \ 14 | ca-certificates \ 15 | --no-install-recommends \ 16 | && rm -rf /var/lib/apt/lists/* 17 | 18 | WORKDIR /opt 19 | RUN git clone https://github.com/securestate/king-phisher.git 20 | 21 | WORKDIR /opt/king-phisher 22 | RUN tools/install.sh --skip-server 23 | 24 | ENTRYPOINT ["/opt/king-phisher/KingPhisher"] -------------------------------------------------------------------------------- /tools/mac_client/README.md: -------------------------------------------------------------------------------- 1 | # King-Phisher Client on Mac 2 | 3 | The only two requirements for running the King-Phisher client on a Mac are [Docker for Mac](https://docs.docker.com/docker-for-mac/install/#download-docker-for-mac) and [XQuartz](https://www.xquartz.org/). Docker for Mac runs the Linux container the King-Phisher client is installed into, and XQuartz which provides the X11 display for the King-Phisher client to render to. 4 | 5 | ## Install and configure XQuartz 6 | 7 | 1. Install XQuartz for Mac: 8 | `brew install cask xquartz` or https://www.xquartz.org/ 9 | 2. Start xquartz from Applications > Utilities 10 | 3. Configure network connections so docker containers can connect to the X11 server 11 | XQuartz Menu > Preferences > Security > [✓] Allow connections from network clients 12 | 13 | ## Install Docker for Mac 14 | 15 | 1. Install docker for Mac: 16 | https://docs.docker.com/docker-for-mac/install/#download-docker-for-mac 17 | 18 | ## Build and run king-phisher docker container 19 | In Terminal.app, run 20 | 1. Whitelist your machine's IP address to connect to the X11 server 21 | ``` 22 | ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') 23 | xhost + $ip 24 | ``` 25 | 2. Build the docker image. This will probably take 20+ minutes 26 | ``` 27 | docker build -t king-phisher . 28 | ``` 29 | 3. Run the docker container. The mounted volumes are for connecting to the X11 display and saving the King-Phisher preferences to your home directory and a shared volume for importing and exporting. 30 | ``` 31 | docker run -d -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.config:/root/.config -v ~/Documents/king-phisher:/root/Documents king-phisher 32 | ``` 33 | 34 | _Note: You can remove the `-d` from the docker command above to see King-Phisher logs for troubleshooting._ 35 | 36 | ## Troubleshooting 37 | ### King-Phisher won't start and shows an error about not being able to connect to DISPLAY 38 | Make sure that XQuartz is running, and your external IP is authorized to connect. You should see similar to the following when running xhost in a terminal: 39 | ``` 40 | $ xhost 41 | access control enabled, only authorized clients can connect 42 | INET:[YOUR.EXTERNAL.IP.HERE] 43 | ``` 44 | You can test that XQuartz is working by running `xcalc` from the terminal using the external display connection. 45 | ``` 46 | DISPLAY=$ip:0 xcalc 47 | ``` 48 | 49 | ### XQuartz is closed but the app icon is still present in the Dock 50 | This is a bug in the Dock and Finder services in Mac OS. To fix run the following in a terminal: 51 | ``` 52 | sudo killall Finder 53 | sudo killall Dock 54 | ``` 55 | --------------------------------------------------------------------------------