""" Plugin for providing a command to display the list of available commands and their descriptions. """ import logging import simplematrixbotlib as botlib async def handle_command(room, message, bot, prefix, config): """ Function to handle the !help command. Args: room (Room): The Matrix room where the command was invoked. message (RoomMessage): The message object containing the command. bot (MatrixBot): The Matrix bot instance. prefix (str): The command prefix. config (dict): The bot's configuration. Returns: None """ match = botlib.MessageMatch(room, message, bot, prefix) if match.is_not_from_this_bot() and match.prefix() and match.command("help"): logging.info("Fetching command help documentation") commands_message = """
🍄 Funguy Bot Commands 🍄

📖 !help

Displays comprehensive help documentation for all available commands with usage examples.

🔌 !plugins

Lists all loaded plugins along with their descriptions in alphabetical order.

🃏 !fortune

Returns a random fortune message. Executes the `/usr/games/fortune` utility and sends the output as a message to the chat room.

!date

Displays the current date and time. Fetches the current date and time using Python's `datetime` module and sends it in a formatted message with proper ordinal suffixes to the chat room.

💻 !proxy

Retrieves a tested/working random SOCKS5 proxy. Fetches a list of SOCKS5 proxies from public sources, tests their availability, and sends the first working proxy with latency information to the chat room. Caches working proxies for faster access.

📶 !isup [domain/ip]

Checks if the specified domain or IP address is reachable. Performs DNS resolution and checks HTTP/HTTPS service availability. Reports successful DNS resolution and service status.

!karma [user]

Retrieves the karma points for the specified user. Retrieves the karma points for the specified user from a SQLite database and sends them as a message to the chat room.

!karma [user] up

Increases the karma points for the specified user by 1. Increases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room. Users cannot modify their own karma.

!karma [user] down

Decreases the karma points for the specified user by 1. Decreases the karma points for the specified user by 1 in the database and sends the updated points as a message to the chat room. Users cannot modify their own karma.

🌧️ !weather [location]

Fetches current weather information for any location using OpenWeatherMap API. Shows temperature (Celsius/Fahrenheit), conditions, humidity, wind speed, and weather emojis. Requires OPENWEATHER_API_KEY environment variable.

📖 !ud [term] [index]

Fetches definitions from Urban Dictionary. Use without arguments for random definition, or specify term and optional index number. Shows definition, example, author, votes, and permalink.

🔍 !dns [domain]

Performs comprehensive DNS reconnaissance on a domain. Queries multiple DNS record types including A, AAAA, MX, NS, TXT, CNAME, SOA, and SRV records. Validates domain format and provides formatted results.

💰 !btc

Fetches the current Bitcoin price in USD from bitcointicker.co API. Shows real-time BTC/USD price with proper formatting. Includes error handling for API timeouts and data parsing issues.

🌐 !whois <domain/ip>

Perform comprehensive WHOIS lookups for domains and IP addresses. Retrieves registrar information, registration dates, name servers, and contact details from WHOIS databases.

Usage:

Examples:

Output includes: Domain/IP information, registrar, WHOIS server, creation/expiration dates, name servers, and contact details.

🔍 !subdomains

Enumerate subdomains using SSL certificate transparency logs. Discovers associated subdomains by querying the CertSpotter API for SSL certificates issued for a domain.

Usage:

Features:

Examples:

Essential for reconnaissance and subdomain enumeration in penetration testing

📍 !geo [ip/domain]

Perform IP geolocation lookups with detailed geographic information. Resolves domains to IP addresses and provides location data including country, region, city, coordinates, and ISP information.

Usage:

Features:

Examples:

Information provided:

Essential for network reconnaissance and IP investigation

🔍 !shodan [command] [query]

Shodan.io integration for security reconnaissance and threat intelligence.

Commands:

Search Examples:

Common Filters: country, city, port, product, os, org, net, has_ssl, http.title

Requires SHODAN_KEY environment variable

🌐 !dnsdumpster [domain]

Comprehensive DNS reconnaissance and attack surface mapping using DNSDumpster.com API.

Commands:

Features:

Examples:

Requires DNSDUMPSTER_KEY environment variable
Rate Limit: 1 request per 2 seconds

💣 !exploitdb - Search Exploit Database
Description:
Search Exploit-DB for security vulnerabilities and exploits. Returns detailed information about exploits including EDB-ID, type, platform, author, and direct links to exploit code.

Usage:
!exploitdb <search_term> [max_results]

Parameters:
search_term (required) - Software name, CVE number, or vulnerability type
max_results (optional) - Number of results to return (1-10, default: 5)

Examples:
!exploitdb wordpress - Search for WordPress exploits
!exploitdb apache 3 - Get 3 Apache exploits
!exploitdb windows privilege escalation - Search for Windows privesc
!exploitdb CVE-2021-44228 - Search by CVE number
!exploitdb linux kernel 10 - Get 10 Linux kernel exploits
!exploitdb sql injection - Search for SQL injection exploits

Output Includes:
• Exploit title and description
• EDB-ID (Exploit Database ID)
• Exploit type (webapps, local, remote, etc.)
• Platform/OS (PHP, Linux, Windows, etc.)
• Author name
• Publication date
• Direct link to full exploit code

Notes:
• Searches the official Exploit-DB CSV database
• May take a few seconds on first use (downloads database)
• Falls back to search links if database unavailable

⚠️ Use responsibly and only on systems you have permission to test.
🛡️ !headers <url>

Comprehensive HTTP security header analysis with security scoring and recommendations.

Features:

Security Headers Analyzed:

Security Ratings:

Examples:

Provides enterprise-grade security analysis for penetration testers and developers

🔄 !hashid <hash>

Advanced hash type identification with confidence scoring and tool recommendations.

Features:

Supported Categories:

Tool Integration:

Examples:

Confidence Legend:

Essential for penetration testers, forensic analysts, and password cracking

🔐 !sslscan <domain[:port]>

Comprehensive SSL/TLS security scanning and analysis with vulnerability detection.

Features:

Security Checks:

Security Ratings:

Examples:

Essential for security teams, system administrators, and developers ensuring TLS compliance
Note: SSLv2/SSLv3 testing limited by Python security features

🎵 Last.fm Integration

Comprehensive Last.fm integration with 30+ commands for music analytics and social features.

Commands:

Features:

Examples:

Requirements:

  • Last.fm account at last.fm
  • LASTFM_API_KEY in .env file
  • YOUTUBE_API_KEY in .env file (for YouTube integration)
  • 📸 !sd [prompt]

    Generates images using self-hosted Stable Diffusion. Supports options: --steps, --cfg, --h, --w, --neg, --sampler. Uses queuing system to handle multiple requests. See available options using just '!sd'.

    📄 !text [prompt]

    Generates text using the Infermatic AI API. Supports multiple models, configurable parameters, and model listing. Uses queuing system for sequential processing.

    Usage:

    Configuration:

    Model Management:

    Examples:

    📰 !xkcd

    Fetches and displays a random XKCD comic. Downloads comic image and sends it directly to the chat room.

    🎬 YouTube Features

    Automatic preview when YouTube links are posted. Shows video info, description, and attempts to fetch lyrics. Also supports !yt [search terms] for direct YouTube searching.

    📘 !wp

    Fetches Wikipedia summaries and main images for search terms using MediaWiki APIs. No HTML scraping or BeautifulSoup required.
    Usage:
    !wp - Fetch Wikipedia summary for any search term
    !wp help - Show usage instructions

    Examples:
    !wp artificial intelligence
    !wp machine learning
    !wp python programming

    📘 !time

    Fetches current time information for locations using the TimeAPI.io service.
    Usage:
    !time - Get time for a location
    !time help - Show usage instructions

    Examples:
    !time London - Get time in London
    !time Tokyo - Get time in Tokyo
    !time New York - Get time in New York

    Supported locations: Major cities worldwide including New York, London, Tokyo, Sydney, Paris, Berlin, etc.

    📚 !arxiv [query]

    Search academic papers on arXiv.org. Categories include AI, ML, Security, Physics, Math, and more. No API key required.

    Commands:

    📰 !news [category/query]

    Fetch latest headlines from various news categories using GNews API. Requires GNEWS_API_KEY environment variable.

    Commands:

    • !news - Get top headlines (default)
    • !news top - Top headlines
    • !news world - World news
    • !news tech - Technology news
    • !news business - Business news
    • !news science - Science news
    • !news health - Health news
    • !news crypto - Cryptocurrency news
    • !news search - Search for specific news
    🔥 !hn [command]

    Fetch top stories from Hacker News using Firebase API. No API key required.

    Commands:

    • !hn - Show top 5 stories (default)
    • !hn top - Top stories
    • !hn new - Newest stories
    • !hn best - Best stories
    • !hn ask - Ask HN threads
    • !hn show - Show HN posts
    • !hn job - Job postings
    • !hn story - Get details of a specific story
    • !hn comments - Show comments for a story
    • !hn search - Search stories (via Algolia)
    !karma [user]

    Track karma points for users with leaderboards and statistics. Supports display names and Matrix IDs.

    Commands:

    • !karma - Show karma for a user
    • !karma++ - Give +1 karma to a user
    • !karma-- - Give -1 karma to a user
    • !karma top [n] - Show top karma entries
    • !karma bottom [n] - Show bottom karma entries
    • !karma rank - Show rank of user
    • !karma stats - Show overall statistics
    • !karma history - Show recent karma history
    • !++ - Shortcut for !karma++
    • !-- - Shortcut for !karma--
    • ++ - Inline karma (message contains ++)
    • -- - Inline karma (message contains --)

    Features:

    • Supports display names and Matrix IDs
    • Room-specific karma tracking
    • Rate limiting to prevent spam
    • Karma history tracking
    • Leaderboards and statistics
    🔥 !hn [command]

    Fetch top stories from Hacker News using Firebase API. No API key required.

    Commands:

    • !hn - Show top 5 stories (default)
    • !hn top - Top stories
    • !hn new - Newest stories
    • !hn best - Best stories
    • !hn ask - Ask HN threads
    • !hn show - Show HN posts
    • !hn job - Job postings
    • !hn story - Get details of a specific story
    • !hn comments - Show comments for a story
    • !hn search - Search stories (via Algolia)
    ⏱️ !cron [add|remove] [room_id] [cron_entry] [command]

    Schedule automated commands using cron syntax. Add or remove cron jobs for specific rooms and commands.

    🔧 Admin Commands

    !set [option] [value] - Set configuration options (admin_user, prefix)
    !get [option] - Get configuration values
    !saveconf - Save current configuration
    !loadconf - Load saved configuration
    !show - Display current configuration
    !reset - Reset configuration to defaults
    !load [plugin] - Load a plugin
    !unload [plugin] - Unload a plugin
    !reload - Reload all plugins
    !disable [plugin] [room_id] - Disable a plugin for specific room
    !enable [plugin] [room_id] - Enable a plugin for specific room
    !rehash - Reload configuration
    Note: Admin commands require admin_user privileges

    🌟 Funguy Bot Credits

    🧙‍♂️ Creator & Developer: HB is the author of 🍄Funguy Bot🍄. (@hashborgir:mozilla.org)
    🚀 Development Context: Created during recovery from two-level cervical spinal surgery (CDA Cervical Discectomy and Disc Arthroplasty)

    Join our Matrix Room: Self-hosting | Security | Sysadmin | Homelab | Programming

    """ await bot.api.send_markdown_message(room.room_id, commands_message) logging.info("Sent help documentation to the room")