Techno<center>
& Jogja{JS}

Self Introduction

Ahmad Basir (Abas)

NodeJS Backend engineer
At Berijalan Technocenter

abas

knkuu_

kankuu

NodeJS TBOT

Code Shell Execution Server

tbot: telegram bot

Goals

hows the NodeJS telegram bot can execute SHell command in server ?

Bots are simply Telegram accounts operated by software – not people – and they'll often have AI features. They can do anything – teach, play, search, broadcast, remind, connect, integrate with other services, or even pass commands to the Internet of Things.

@June 24, 2015
_2 years after Telegram was released

Telegram BOT

What's that!?

@BotFather - manage your own bot
@TriviaBot – test your trivia knowledge or add to groups to compete with friends.
@PollBot – add this one to group chats to create polls.
@vkmusic_bot - search music and listen

Telegram BOT

Sample BOT

-. you must at least One telegram account

-. open chat with @botfather
-. and send command > /newbot

-. once you got TELEGRAM BOT TOKEN,
-.
u can create with your own tech stack :D

Telegram BOT

How to Create ?

A shell is a command-line interpreter that provides a user interface for accessing the services of an operating system. In Unix-like systems, several types of shells are available, including the Bourne Shell (sh), C Shell (csh), Korn Shell (ksh), and Bourne Again Shell (bash).

@ 1977 by Stephen Bourne

AT&T's Bell Labs.

What's that!?

SHell

> ls  # listing directory

> pwd # print work directory

> whoami # get current user

command-line example 

SHell

> root - be carefull! its overpower user :D

> System - non-login users (eg. nobody, www-data)

> Regular - standart linux users can;t sudo (eg. abas)

> Administrator - Regular users with sudo

Level of Users

SHell

Ohh CRAP!! permission denied.

> sudo kill him

this told the machine to kill him with grant permission of Administrator
which him is like PID (Process ID)

 

Fyi:
everysingle linux process  has a PID, even command line

the Power of #SUDO

SHell

>hows the NodeJS telegram bot can execute SHell command in Server ?

/abas/code-shell

take a look first :D

{flow} Explaination

[Code] Dependencies

https://github.com/yagop/node-telegram-bot-api

[Code] Configuration

[Code] Child-process

> module that can spawn child process - can spawn into OS level 

[Code] Exec SHell

Demonstration

Conclution

IN URGENT NEEDED

-. bot can send server log

-. bot can send direct action when connection to server was poor

-. bot can execute several command that bundling in .sh script (automation)

-. bot can reboot server.. or even SHUTDOWN IT ? :v

Telegram BOT

BOT Goals!

ThankYou

Technocenter & JogjaJS

By Abas Kankuu

Technocenter & JogjaJS

NodeJS Telegram BOT : Code Shell Execution Server

  • 11