Use Telegram bot as a Penetration Testing Framework
Tags: sofianehamlaoui, telegram, cybersecurity, penetrationtesting
Published: 2019-12-15 05:20:56

---
title: Use Telegram bot as a Penetration Testing Framework
published: true
date: 2019-12-15 05:20:56 UTC
tags: sofiane-hamlaoui,telegram,cyber-security,penetration-testing
canonical_url: 
---

### ✈️Use Telegram bot as a Penetration Testing Framework

- **_The idea ? :_**

_So I was checking out my browser bookmarks, then I noticed having a medium article about_ [**Telegram bot for Hacking & Pentesting**](https://medium.com/@arbazhussain/telegram-bot-for-hacking-pentesting-b7856db28ef) **.** _I checked the article and shared it on my_ [**Twitter account,**](https://twitter.com/S0fianeHamlaoui/status/1205414073837457408) _than I’ve seen that some CyberSec (or Interested by ) loved the bot idea.  
I made a_ [**_Penetration Testing Framework called Lockdoor_**](https://github.com/SofianeHamlaoui/Lockdoor-Framework)_, So why not making the same thing with my tool ?_

**Updates :** [**Arbaz Hussain**](https://medium.com/u/c66be62f5b6b)**’s tool isn’t working now ( 12/15/2019 )**

> Check it here : [https://github.com/arbazkiraak/hackbot](https://github.com/arbazkiraak/hackbot)

- **_How does that work ?_**

_So the idea is by running_ [**_Lockdoor Framework_**](https://github.com/SofianeHamlaoui/Lockdoor-Framework) _from any_ [**_Telegram_**](https://telegram.org/) _chat/messenger._

_Basically, it’s about running ( commands ) to run the tool from any Telegram chat, Of course before doing that you have first to configure & install the tool first, than configuring the bot and using it._

- **_Cool, Let’s do that !_**

**_1 — Configuring_**  **_& Installing Lockdoor Framework :_**

To do that, you can check the installation wiki of the tool :

[SofianeHamlaoui/Lockdoor-Framework](https://github.com/SofianeHamlaoui/Lockdoor-Framework/wiki/Installation)

- Or :

```
$: git clone [https://github.com/SofianeHamlaoui/Lockdoor-Framework.git](https://github.com/SofianeHamlaoui/Lockdoor-Framework.git) && cd Lockdoor-Framework 
$: chmod +x ./install.sh 
$: ./install.sh
```

**_2 — Configuring & Installing the Telegram bot_**

_For that I used A modified version of_ [**_shell bot,_**](https://github.com/botgram/shell-bot) _made by_ **_ _** [**_botgram_**](https://github.com/botgram) **_._**

- **_Configuring the bot_**

> [https://github.com/SofianeHamlaoui/lockdoor-bot](https://github.com/SofianeHamlaoui/lockdoor-bot)

![](https://cdn-images-1.medium.com/max/590/1*8TyElmoZCOT4mNKfIVJ9Ig.png)<figcaption>Starting a conversation with botfather</figcaption>

- Go to [**_https://web.telegram.org/_**](https://web.telegram.org/)
- _Start a conversation with our father_ [**_botfather_**](https://web.telegram.org/#/im?p=@BotFather)

![](https://cdn-images-1.medium.com/max/559/1*XKXvXtxHrpoLiInVWaGyYg.jpeg)<figcaption>Creating the Telegram bot</figcaption>

- type **_/newbot_** _to create a new bot_
- _give it a Name. ( A name for your Telegram Bot )_
- _give it a Username. ( A username for your Telegram bot_
- **_Copy and Save the API_**
- **_Configuring & Running the bot server_**

```
Requirements : 
- python
- [node-pty](https://github.com/Microsoft/node-pty#dependencies)
- Telegram 
- Happiness :D
```

- **_\* Installing_**

```
$: git clone [https://github.com/SofianeHamlaoui/Lockdoor-bot](https://github.com/SofianeHamlaoui/lockdoor-bot) && cd Lockdoor-bot
$: npm install
```

- **_\*Starting the server :_**

```
$: node server
```

_The first time you run it, it will ask you some questions and create the configuration file automatically:_ _config.json. You can also write it manually, see_ _config.example.json_

![](https://cdn-images-1.medium.com/max/1016/1*CsWiiAsjdKTSRz_EWHUakA.jpeg)<figcaption>Configuring the server</figcaption>

- _Using the API token you copied after creating the Telegram bot_
- _Use the link given by the bot (_ [_https://t.me_](https://t.me/XXXXXXXX)_/X/X/X/X/X/X/X/X/X/ ) and send a message to make your Telegram profile as bot’s owner )_
- **_\*Running the server :_**

```
$: node server
```

![](https://cdn-images-1.medium.com/max/352/1*T0Y0jDVKq4FFWJ4QrwXnTA.png)<figcaption>The bot is ready</figcaption>

> CONGRATULATIONS ! Your Bot is ready ❤

- The commands :

_You have lot of commands to use with this bot here is the list of the commands ( or you can check them from_[_github’s repo_](https://github.com/SofianeHamlaoui/lockdoor-bot)_ )_

```
run - Execute command
enter - Send input lines to command
type - Type keys into command
control - Type Control+Letter
meta - Send the next typed key with Alt
keypad - Toggle keypad for special keys
redraw - Force the command to repaint
end - Send EOF to command
cancel - Interrupt command
kill - Send signal to process
status - View status and current settings
cd - Change directory
env - Manipulate the environment
shell - Change shell used to run commands
resize - Change the terminal size
setsilent - Enable / disable silent output
setlinkpreviews - Enable / disable link expansion
setinteractive - Enable / disable shell interactive flag
help - Get help
file - View and edit small text files
upload - Upload and overwrite raw files
r - Alias for /run or /enter
```

> The important commands :

```
/run - to run a command
/enter - to Send input lines to command
```

_After Configuring and running the server, Now it’s time to Use_ [_Lockdoor-Framework_](https://github.com/SofianeHamlaoui/Lockdoor-Framework) _From any Telegram Chat/Messenger._

> Now ! You have 2 choices ! As Lockdoor Framework requires the Root Permissions, You can :

- _1 \> Run the bot server as root, ( Not really recommended)_

```
$: sudo node server
```

- _2 \> Run lockdoor as root from the telegram chat_

```
$: ( Telegram chat ) : / **run sudo lockdoor**
```

- _Go to your telegram bot chat and type /_ **_run lockdoor_** _( or /_ **_run sudo lockdoor_** _if you didn’t start the bot server as root )_

> CONGRATULATIONS ! You’re running a Penetration Testing Framework from a Telegram chat ❤

- **_Screenshots :_**

> From Desktop/Web chat :

![](https://cdn-images-1.medium.com/max/1024/1*BTzcc7Np2Iyg01x66AXZeA.jpeg)<figcaption>Screenshots from the Desktop/Web chat</figcaption>

> From phone :

![](https://cdn-images-1.medium.com/max/1024/1*aVTkY5CerhOMrrLzfN1W-w.jpeg)<figcaption>Lockdoor Framework on phone</figcaption>

- **_What’s next ? :_**

> More : Check Lockdoor Framework Github repo with to know more about the tool and how it works ❤

- My Github profile :

[SofianeHamlaoui/Lockdoor-Framework](https://github.com/SofianeHamlaoui/Lockdoor-Framework)

- My Twitter account :

[Sofiane Hamlaoui](https://twitter.com/S0fianeHamlaoui)

- My Website :

[Sofiane HAMLAOUI on about.me](https://sofianehamlaoui.me)

- My Facebook profile

[Facebook](https://www.facebook.com/S0fianeHamlaoui)

- Thanks !

> Thanks to [Arbaz Hussain](https://medium.com/u/c66be62f5b6b) for his article that gave me this idea.  
> Thanks to [Alba Mendez](https://medium.com/u/3c8c96bf9b55) for her bot-shell that helped me making the lockdoor Telegram bot.