Git Product home page Git Product logo

cibot's Introduction

CIBot

CounterIntelligence bot, based on Telegram API

Secure your system

You thought you'd get away without the necessary lecture?!?
Security is an active exercise, you need to:

  1. assess your threat landscape
  2. generate your custom policy
  3. apply it
  4. make sure it is constantly applied/monitor

Regarding #2 above, you may want to read a guide:

  1. How To Harden OpenSSH on Ubuntu 20.04: just an example, the article focuses on Ubuntu but it is applicable to other distros with minor, if any, modifications
  2. install Fail2Ban

OK, now you're good to go and read the rest :)

Pre-requisites

Telegram's Bot API allows users to create programs capable, for instance, of sending messages.
Telegram Bots are special accounts that do not require an additional phone number to set up. These accounts serve as an interface for code running somewhere on a remote server.
Get started by reading Bots: An introduction for developers or grab the nitty-gritty stuff by delving into Telegram Bot API.

Setup and first run

  1. Clone the repository and create a virtual environment
$ git clone https://github.com/carmelo0x99/CIBot.git

$ cd CIBot/

$ python3 -m venv .

$ source bin/activate

(CIBot) $ python3 -m pip install --upgrade pip setuptools wheel

(CIBot) $ python3 -m pip install requests
  1. Configure your own setup with the appropriate bot name, token and chat ID. The configuration file, cibot.json, looks like this
{"BOT": "<somename_bot>", "TOKEN": "<long string>", "CHATID": "<decimal number>"}

NOTE: details can be found on Bots: An introduction for developers

  1. Check A quick run of the main script would do:
$ ./cibot.py

If everything has been setup correctly, according to the instructions to be found on Telegram API pages, a ping should hit your mobile phone with an apt message.

Build Docker container

This part is optional but no README would be complete without the containerization section:

$ docker build -t <repository>/<image>:<tag> .

$ docker push <repository>/<image>:<tag>

$ docker run \
    --detach \
    --rm \
    --volume /var/log:/var/log:ro \
    --volume -v $PWD:/usr/local/bin \
    <repository>/<image>:<tag>

Run through crontab

At minute 59 every hour:

59 * * * *  (cd /path/to/CIBot; /usr/bin/docker run -d --rm -v /var/log:/var/log:ro -v $PWD:/usr/local/bin <repository>/<image>:<tag>)

What to do when alerts are being received

First and foremost, DON'T PANIC!!!
If you've secured your system (you have, right?), chances are that any attacks have been unsuccessful.
It won't hurt though to log into your system and:

  1. check the logs
  2. run a scan with Lynis or chkrootkit for instance
  3. verify that your security policies are still applied
  4. just for fun, check where the attackers came from

cibot's People

Contributors

carmelo0x63 avatar

Watchers

 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.