Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/coderofsalvation/hubot-script-http

run all hubot commands thru the browser or using bash terminal
https://github.com/coderofsalvation/hubot-script-http

Last synced: 12 days ago
JSON representation

run all hubot commands thru the browser or using bash terminal

Awesome Lists containing this project

README

        

hubot-script-http
=================

Simple remote execution of hubot commands using bash,
without the need of an extra rest- or shelladapter.

# Installation

npm install

# URLS:

/cmd/help
/cmd/mustache/me/mark
and so on

# Commands:

you need to add your ip in order to get access :

hubot ip show - shows ip addresses which have http GET-access
hubot ip add - adds ip ( '*' allows everybody )
hubot ip flush - clears the ip table

# Terminal powa!

Just put this little shellscript somewhere ('hubotbash' e.g.)

#!/bin/bash
PORT=5555
URL="http://localhost:$PORT/cmd/$*"
URL="${URL// //}"
curl "$URL"

Then do this:

$ hubotbash help | grep mustache
hubot mustache me - Searches Google Images for the specified query
hubot mustache me - Adds a mustache to the specified URL.

See? Terminal powa!

NOTE: for a more robust/secure shellscript look here

# Why

I made this since I could only find an example which demonstrated
posting something to a room.
This however, gives full access to the hubot commands.
Which is nice, because bash / curl / awk are my daily tools
to work/massage data with.

# Security

This is a proof of concept, therefore its not totally secure when you are
not using https + hubot's express authentication (using env variables).
Since not everybody will go thru this labour of setting this up, I've included
a pseudo ip-security.

Anyways, try adding these express environment vars to get basic auth going:

* EXPRESS_PASSWORD=yourpass
* EXPRESS_USER=admin

# Known issues

* requesting non-existing commands can cause minor hickups on the adapter (since the adapter is temporarely overridden by httprequests).