Skip to content

A Discord bot implementation of Troy Hunt's haveibeenpwned.com service.

Notifications You must be signed in to change notification settings

plasticuproject/pwnedBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python 3.7 CodeQL Quality Gate Status Security Rating

pwnedBot

A Heroku hosted Discord bot implementation of Troy Hunt's haveibeenpwned.com service,
a free resource for anyone to quickly assess if they may have been put
at risk due to an online account of their's having been compromised or
"pwned" in a data breach, using the hibpwned python library.

Prerequisites

Head over to DiscordApp and create a new app.
Record your Client_ID. On the left, click Bot, and then Add Bot.
Once you are done setting up your bot, save your Client_ID, Token, and Client Secret in a safe place.

Making calls to the haveibeenpwned API requires a key. You can purchase a HIBP-API-KEY here.

Create a Heroku account and install the Heroku CLI Tool. Follow the directions and run the command heroku login -i to authenticate your account.
If git is not already installed on your local host, install it.

Heroku Deployment

Create a fork of this repository, then clone it to your local host with the git clone command.
Navigate into the project's root directory and run heroku create. Take note of the name it assigns the app.
Run heroku git:remote -a <app name> to add a remote to your local repository.

Set the environment variables that the application will use with the heroku config:set command, setting the following variables:

heroku config:set HIBP_API_KEY=<your HIBP-API-KEY>
heroku config:set APP_NAME=<a unique app name for haveibeenpwned to recognize your app/bot>
heroku config:set DISCORD_TOKEN=<your discord bot TOKEN>
heroku config:set DISCORD_CLIENT_ID=<your discord CLIENT_ID>
heroku config:set BOT_PREFIX=<a prefix for your bot commands>

To deploy, push the code to your Heroku account with the command git push heroku master
To start the bot, issue the command heroku ps:scale worker=1

Development

Requirements

  • git >= 2.17.1
  • Python >= 3.6.9
  • python3-pip >= 20.0.2
    • hibpwned >= 1.1.1
    • Pillow >= 7.1.1
    • discord.py >= 1.3.3

Follow the steps above to deploy your application.
Log into your Heroku account, choose your app, and under Deploy click Connect to Github and follow the
directions to link your account, choose the repository, and set up automatic deployment on the master branch.
Now when you push changes to your Github project, they will automatically be deployed on your Heroku container.

Usage

To add bot to server add your Client_ID to this URL and visit in browser:
https://discordapp.com/oauth2/authorize?client_id= <Client_ID> &scope=bot
When bot is active in server type "(prefix)help" for a list of commands.

HELP BREACH_NAME PASSWORD SEARCH PASTES PASTE_ID

License

All data sourced from https://haveibeenpwned.com
Visit https://haveibeenpwned.com/API/v3 to read the Acceptable Use Policy
for rules regarding acceptable usage of this API.

This work is licensed under a Creative Commons Attribution 4.0 International License.
CCv4
plasticuproject