Coder Social home page Coder Social logo

teleshell's Introduction

teleshell

Gain shell access to your machine using a Telegram Bot.

Some cases where this might be helpful:

  • You're in a double NAT environment and do not have access to your ISP's routers.
  • You're behind a firewall which blocks incoming traffic.
  • You have a dynamic IP address and don't want to set up Dynamic DNS
  • You have no one to turn to, and you need to run a few commands to get a reverse SSH tunnel going

Quick Start

  • Generate a telegram bot authorization token by following the instructions here
  • Rename the configuration template file (config.example.json) to config.json. Here are the properties that are supported
Property Type Description
token String The authorization token for your telegram bot
whitelist Array(Number) An array of whitelisted user ID (see below), from which commands will be run.
processTimeout Number Number of milliseconds after which the spawned process will be killed (Optional)
  • npm install
  • node server.js
  • Now go to Telegram and ping the bot that you've created. If the token has been set correctly, you should see loglines like so on your terminal: Unauthorized command from user <NAME> (<USER ID>) [Thu Sep 08 2016 22:39:02 GMT+0530 (IST)]: ls
  • Copy the User ID and add it to the whitelist and you are done. The bot will alert you if it receives messages from non-whitelisted IDs

Autostart

Using pm2, you can get teleshell to autoexecute on startup

  • npm install --global pm2
  • sudo pm2 startup
  • pm2 server.js --name teleshell
  • pm2 save

Suggestions, contributions, criticism and pull requests welcome.

teleshell's People

Contributors

karthikiyengar avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

onode

teleshell's Issues

Start bot

after you set it up with my data, how do I start it? I have to give some commands via shell? you can start it automatically when you restart the operating system?

Error: connect ETIMEDOUT

after a few minutes of this error, the connection is not a problem as everything works properly:

Unhandled rejection RequestError: Error: connect ETIMEDOUT 149.154.167.198:443
at new RequestError (/home/osmc/teleshell/node_modules/node-telegram-bot-api/node_modules/request-promise/lib/errors.js:11:15)
at Request.RP$callback [as _callback] (/home/osmc/teleshell/node_modules/node-telegram-bot-api/node_modules/request-promise/lib/rp.js:60:32)
at self.callback (/home/osmc/teleshell/node_modules/node-telegram-bot-api/node_modules/request/request.js:186:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (/home/osmc/teleshell/node_modules/node-telegram-bot-api/node_modules/request/request.js:845:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at TLSSocket.socketErrorListener (_http_client.js:256:9)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at emitErrorNT (net.js:1255:8)
at nextTickCallbackWith2Args (node.js:437:9)
at process._tickCallback (node.js:351:17)

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.