- Introduction
- Installation
- Configuration
- Usage
- Bot Reactions Glossary
- Troubleshooting and Support
- Frequently Asked Questions
- Contributing
- Support and Community
- Donations
- License
- Additional Resources
- Contact
This project integrates an AutoPcap plugin
with a Discord bot to automate the capture and analysis of .pcap
files.
The AutoPcap plugin enhances Pwngotchi's capabilities
by automating the upload of captured packets to Discord via a webhook.
Simultaneously, the Discord bot facilitates interaction with Discord servers,
specifically managing messages related to pcap files.
It extracts, decrypts, and analyzes these files,
offering a streamlined workflow for cybersecurity enthusiasts.
The primary aim of this project is to simplify the process of capturing, uploading, and analyzing network traffic for educational and cybersecurity purposes. By automating these tasks, users can focus more on analysis rather than manual processing.
- Ensure Pwngotchi is correctly set up and operational without any plugins initially.
- Familiarity with Pwngotchi's operation and configuration.
- Python 3.x installed.
- Access to the Discord Developer Portal.
- Basic knowledge of Discord bot development.
- A Linux environment for running the bot's code due to specific requirements in the cracking function.
- Kali Linux is recommended for ease of use and availability of necessary tools.
- Required Linux Packages:
airmon-ng
,tshark
,editcap
,pcapfix
.
- Clone the repository or download the plugin script.
- Place the
AutoPCAP.py
script in the/usr/local/share/pwngotchi/custom-plugins/
directory on your SD card. - Modify your Pwngotchi configuration file (
/etc/pwngotchi/config.toml
) to enable custom plugins by adding or updating the line:main.custom_plugins = "/usr/local/share/pwngotchi/custom-plugins/"
- Clone the repository or download the Discord bot script.
- Place the
Bot.py
script in a suitable location on your computer/SD card. - Configure the script to start automatically on boot with sudo permissions.
Create a config.json
file in the plugin's directory with the following structure:
{
"webhookUrl": "YOUR_DISCORD_WEBHOOK_URL_HERE"
}
Replace "YOUR_DISCORD_WEBHOOK_URL_HERE"
with your actual Discord webhook URL.
Discord Bot Creation
- Visit the Discord Developer Portal.
- Create a new application and add a bot to it.
- Make sure the bot has these permissions when creating it:
- View Channels
- Read Message History
- Send Messages
- Manage Messages (for clearing reactions)
- Add Reactions
- Attach Files
- Create Invites
- Make sure all the intents in the
intents
section are enabled, these are found in theoauth2
section. - Make sure the bot is added to the server you want to interact with.
- Navigate to the bot page and copy the bot token. This token will be used later.
Account Activation
- Activate your Discord account for developer mode to access channel IDs.
- Go to your account's settings and navigate to the "Advanced" tab.
- Enable "Developer Mode" and click "Save Changes".
- Go to your 2 channels in your server and copy the channel IDs of a channel where pcap files should be sent (by the webhook, for security reasons make it a public restricted channel where only mods can talk in it) and a channel where logs should be sent (For privacy reasons, this should be a private channel).
Configuration
- Update the
api.json
file with your bot's token, channel IDs, and other necessary configurations as per the instructions below. - Replace placeholders in the code with actual usernames and passwords as needed. Ensure to follow the format specified in the comments.
- The bot's behavior and settings are configurable through the
api.json
file located in the project directory. Here's what you need to know:- Token: Your bot's token obtained from the Discord Developer Portal.
- Channel IDs: Two channel IDs are required:
channel_id_(for_pcaps)
: The ID of the channel where pcap files should be sent.channel_id_(for_logs)
: The ID of the channel where logs should be sent.
- Webhooks Username: A list of usernames that the bot should respond to. Include
#0000
for webhook usernames. - Log Using Debug: A boolean value indicating whether to log using debug level, for production purposes set this to
false
.
Running the Bot
- Ensure you have Python installed on your system.
- Install required Python packages from the
requirements.txt
file using pip. - Run the bot in a Linux environment with sudo privileges for cracking purposes.
After installation and configuration,
the AutoPcap plugin will automatically capture .pcap
files and upload them to Discord
upon detecting handshakes. The plugin logs all activities, aiding in tracking progress and troubleshooting.
The plugin is able to upload pcap
files only if connected to the internet.
To do that follow this guide.
Ensure the bot is running in a Linux environment with sudo privileges. Users can interact with the bot by sending messages in the configured channels, triggering responses based on message content and settings.
The bot will generate many types of reactions to respond to various messages that include the pcaps uploaded. As part of its job, if an error occurs a reaction will be generated, and if a pcap has already been cracked, a different reaction will be generated. Here they are:-
The bot is not running in a linux environment.
The bot successfully cracked and uploaded the pcap file.
The bot failed to crack the pcap file.
An unknown return occurred in cracking process
An error with python occurred, cracking failed
An error occurred with discord, processing failed, usually relating to permissions, this is an exception for HTTP errors
An unknown exception was caught, an error that handles the discord bot, occurs if the error is not related to HTTP errors
The whole script failed without any handling, this is unexpected and shouldn't happen
The bot is handling the pcap currently, will later give it a different reaction
If you encounter any issues, check the following:
- Ensure your
config.json
file is correctly formatted and contains a valid Discord webhook URL. - Verify that Pwngotchi is configured to use custom plugins.
- Check the plugin logs for any error messages.
If you encounter any issues, check the following:
- Ensure your
api.json
file is correctly formatted and contains valid channel IDs. - Verify that the bot is properly configured.
- Check the bot logs for any error messages.
- Ensure the bot is running in a Linux environment with sudo privileges.
- Make sure the bot has proper permissions in the server.
Here are some common issues and solutions to help you get back on track:-
- Ensure the plugin is placed in the correct directory as specified in your Pwngotchi configuration file.
- Verify that the
config.toml
file has been correctly updated to include the path to custom plugins.
- Check your internet connection to ensure it's stable.
- Verify the webhook URL/token in your
config.json
file is correct and active. - Ensure the Discord channel associated with the webhook allows file uploads.
- If the log file grows too large, consider reducing the
max_size
parameter or implementing a log rotation mechanism.
- Ensure your
config.json
file is correctly formatted and contains a valid Discord webhook URL. - Verify that Pwngotchi is configured to use custom plugins.
- Currently, the plugin supports one webhook URL. Modifications can be made to support multiple URLs.
- Replace the existing
AutoPcap.py
script with the new version in the/usr/local/share/pwngotchi/custom-plugins/
directory. Restart Pwngotchi to apply changes.
- Customize the
on_handshake
function to filter.pcap
files based on criteria such as file size, SSID, or timestamp.
Contributions are encouraged! Fork the repository, make changes, and submit pull requests. Contributions to improve functionality, security, and usability are welcomed.
We would appreciate any contributions to the crack
function.
Join the Pwngotchi and Discord communities for support, discussions, and feature requests. Active forums and Discord channels offer assistance.
Consider contributing to the project, sharing experiences, or supporting the developers through donations.
This project is licensed under the MIT License. See the LICENSE file for details.
- Pwngotchi Official Documentation: https://pwngotchi.net/
- Discord Developer Portal: https://discord.com/developers/docs
For inquiries, feedback, or contributions, please contact Shahm Najeeb using my email