Giter VIP home page Giter VIP logo

telegram-bot-cli's Introduction

The bot

This is a command line tool I use when I want to get notified, on Telegram (on my phone), that something has finished running (on my laptop). For instance, let's say I'm in an engagement scanning assets and waiting for my nmap scan to finish, I can now receive a text message on Telegram from my bot.

Usage

Usage: telegram-bot-cli.py [options]

Options:
  -h, --help                          show this help message and exit
  -j JOB, --job=JOB                   select a job name (required)
  -d DETAILS, --details=DETAILS       add details to the job (50 characters max)
  -u USERNAME, --username=USERNAME    your username if you want the bot to highlight you

Quick start

First of all, clone this git : git clone https://github.com/ShutdownRepo/telegram-bot-cli If you already know your bot token and the group ID in which you want to get notified, add those in the sample-config.py file and rename it config.py. If you don't know these information, follow these steps "Full instructions".

Once the config file is setup, install the requirements and test the script

pip3 install --user -r requirements.txt
echo "Testing" | python3 telegram-bot-cli.py --job testing

If you love aliases like I do, you can something like alias telegram-bot-cli='python3 /PATH/TO/telegram-bot-cli/telegram-bot-cli.py -u username'

Full instructions

Create a bot and find the token

  1. Open a Telegram client
  2. Start a conversation with @BotFather
  3. Send the following command : /newbot`
  4. Send the name of your bot (anything you want)
  5. Send the username of your bot (must be unique, and end with 'bot')
  6. The bot is created and the token to access the HTTP API is sent to you

Create a group, add the bot and find the group ID

  1. Create the group your want the bot to send messages to
  2. Add the bot to the group with its username (@unique_username_bot)
  3. Send the following message in the group : /my_id @unique_username_bot
  4. Go to https://api.telegram.org/bot<bot_token>/getUpdates and replace <bot_token> with yours
  5. In the JSON array, find the message/chat/id negative integer composed of 9 figures, this is your group ID

Now that you have the bot, the token, the group and the group ID, follow the instructions in "Quick start"

TODO

  • find a way to trigger this cli bot by grepping something in commands output. For instance, let's say I want to get notified when my ntlmrelayx has successfully relayed authentication during an engagement, I would grep on "SUCCESS"
  • any ideas?

telegram-bot-cli's People

Contributors

shutdownrepo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.