Installation
This guide will walk you through the process of installing Cyber Bot on your system. Follow these steps to set up the bot and prepare it for operation.
Prerequisites
Before you begin, ensure you have the following:
- Node.js - Version 16.x or higher is recommended
- npm - Usually comes with Node.js
- Git - For cloning the repository
- Telegram Bot Token - Created through BotFather
- Mistral AI API Key - Obtained from Mistral AI
- Optional: MySQL Database - For message logging (optional feature)
Installation Steps
1. Clone the Repository
git clone git@github.com:kOaDT/cyber-bot.git
cd cyber-bot
2. Create Tracking Files
These files are used to track which content has already been processed to avoid duplicates:
mkdir -p assets
touch assets/processedNotes.json # GithubNotes tracking
touch assets/processedArticles.json # News tracking
touch assets/processedShorts.json # Shorts tracking
touch assets/processedDD.json # Darknet Diaries Podcast tracking
touch assets/processedSnyk.json # Snyk Podcast tracking
touch assets/processedYt.json # YouTube tracking
touch assets/processedReddit.json # Reddit post tracking
touch assets/processedCTF.json # CTF tracking
touch assets/processedSecurityNow.json # Security Now Podcast tracking
touch assets/processedCyberShow.json # The Cyber Show Podcast tracking
3. Install Dependencies
npm install
4. Configure Environment
Create a .env
file in the root directory with your configuration:
# GitHub Settings
GITHUB_SECRET=your_github_token
GITHUB_USERNAME=your_github_username
GITHUB_REPO=your_repo_name
# Optional
EXCLUDED_GITHUB_FILES=file1.md,file2.md
# Telegram Settings
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
CHAT_ID=your_chat_id
# Optional Topic IDs for message organization
TELEGRAM_TOPIC_THM=12345
TELEGRAM_TOPIC_NEWS=12346
TELEGRAM_TOPIC_YOUTUBE=12347
TELEGRAM_TOPIC_PODCAST=12348
TELEGRAM_TOPIC_GITHUB=12349
TELEGRAM_TOPIC_REDDIT=12350
TELEGRAM_TOPIC_CVE=12351
# Mistral AI Settings
MISTRAL_API_KEY=your_mistral_api_key
# Optional, comma-separated
AUTHORIZED_LANGUAGES=en,fr
# AssemblyAI - Text-to-Speech
ASSEMBLYAI_API_KEY=your_assemblyai_api_key
# YouTube Settings
YOUTUBE_API_KEY=your_youtube_api_key
# Reddit
REDDIT_SUBREDDITS=cybersecurity,netsec,hacking
REDDIT_DAYS_LOOKBACK=7
REDDIT_CLIENT_ID=your_reddit_client_id
REDDIT_CLIENT_SECRET=your_reddit_client_secret
# CVE
CVSS_SEVERITY_THRESHOLD=7.0 # Default >= 7.0
HOURS_DELAY=24 # Default 24 hours
TECHNOLOGIES_OF_INTEREST=windows,linux,apache,nginx
# Optional Database Settings
MYSQL_HOST=localhost
MYSQL_USER=db_user
MYSQL_PASSWORD=db_password
MYSQL_DATABASE=cyber_bot
I_WANT_TO_SAVE_MESSAGES_IN_DB=true
Obtaining API Keys
Telegram Bot Token
- Open Telegram and search for @BotFather
- Start a chat with BotFather and send the command
/newbot
- Follow the instructions to name your bot and choose a username (must end in 'bot')
- Once created, BotFather will provide you with a token
- Copy this token to your
.env
file asTELEGRAM_BOT_TOKEN
Mistral AI API Key
- Visit Mistral AI's website
- Sign up for an account or log in
- Navigate to your account settings or API section
- Generate a new API key
- Copy this key to your
.env
file asMISTRAL_API_KEY
YouTube API Key
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the YouTube Data API v3
- Go to the Credentials section and create an API key
- Copy this key to your
.env
file asYOUTUBE_API_KEY
Reddit API Credentials
- Visit Reddit's app preferences
- Scroll down and click "create app" or "create another app"
- Fill in the required fields (name, app type, redirect URI)
- For app type, select "script"
- For redirect URI, you can use
http://localhost:8000
- After creating the app, note the client ID and client secret
- Copy these values to your
.env
file asREDDIT_CLIENT_ID
andREDDIT_CLIENT_SECRET
Verifying Installation
After completing the installation steps, you can verify that everything is working by running a simple test:
npm run cron -- -c sendTHM
This command will test the TryHackMe reminder functionality. If it runs without errors and you receive a message in your Telegram chat, the installation was successful.