https://github.com/elsehow/peerssh
mad science using hopping codes
https://github.com/elsehow/peerssh
Last synced: 9 months ago
JSON representation
mad science using hopping codes
- Host: GitHub
- URL: https://github.com/elsehow/peerssh
- Owner: elsehow
- Created: 2016-02-20T20:10:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-21T04:45:43.000Z (over 10 years ago)
- Last Synced: 2025-10-03T23:54:09.197Z (9 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* peerssh
** imagine we want to execute commands on a remote computer
** but we don't want anyone else to be able to
** complicating matters, this computer doesn't have a static hostname
** and neither do we
*** (a familiar problem to people who write malicious software, like randsomeware)
** here i demonstrate a simple way to send a command over a publically accessible channel using a good PRNG
* walk through basic idea of garage door opener
** introduce how car garage door openers work
*** output of a prng indistinguishable from noise
*** even though output is deterministic given a seed
**** if this seems like a contradiction to you, refer to []
** show our basic implementation in js
* DONE coordinating an action over a public channel
CLOSED: [2016-02-20 Sat 20:39]
** TODO introduce indra
*** [[https://github.com/berkeley-biosense/indra-server][indra server]] on github
*** TODO it's running at this address
#+BEGIN_SRC js :tangle pubsub-host-config.js
module.exports = "http://indra.webfactional.com"
#+END_SRC
yeah, yeah, it's not using https... well, we shouldn't really have to run https! cryptographically secure and all that
*** it's very simple - it takes subscribers over web sockets
*** and accepts post requests over this route
**** the =key= field in json post relates to client subscription
**** essentially the channel the message is published on
** DONE receiver
CLOSED: [2016-02-20 Sat 20:37]
#+BEGIN_SRC js :tangle receiver.js
'use strict';
// parse command line opts
var argv = require('minimist')(process.argv.slice(2))
// host uri for pubsub server
var host = require('./pubsub-host-config.js')
// takes a seed -s and a start index -i over the command line
var garagedoor = require('garage-door-opener')
// the sender is responsible for generating codes
var receiver = garagedoor.receiver(argv.s, argv.i)
// connect to socket server
var socket = require('socket.io-client')(host)
socket.on('connect', () => {
socket.on('public-channel', (msg) => {
if (receiver.check(msg.key))
console.log('key ok!', msg)
else
console.log('key not ok!', msg)
})
console.log('listening for commands')
})
#+END_SRC
*** TODO test simple config
*** TODO test listening to different channels
*** TODO test exec-ing commands
** DONE sender
CLOSED: [2016-02-20 Sat 20:37]
#+BEGIN_SRC js :tangle sender.js
'use strict';
var split = require('split')
// parse command line opts
var argv = require('minimist')(process.argv.slice(2))
// host uri for pubsub server
var host = require('./pubsub-host-config.js')
// takes a seed -s and a start index -i over the command line
var garagedoor = require('garage-door-opener')
// the sender is responsible for generating codes
var sender = garagedoor.sender(argv.s, argv.i)
// a client for sending messages to the listener
var client = require('request-json')
.createClient(host)
// posts a message with our sender key
function post (cmd) {
var payload = {
type: 'public-channel', // the public channel on which we're broadcasting
key: sender.next(), // our new key
eval: cmd.toString()
}
client.post('/', payload, (err, res, body) => {
if (err)
console.log('ERR!', err)
else
console.log('posted')
})
}
// post data whenever user presses return
process.stdin.pipe(split()).on('data', post)
#+END_SRC
*** script loads config and listens to stdin
*** splits stdin on newline and posts each bit as a command
*** subscribes to responses
*** =req.pipe(process.stdout)=
* running shell commands over a public channel
* authenticating a peer relationship over a public channel
* peerscp
** generating 2 binaries - a receiver and a sender
** distributing them - to be kept secret, like a key
** note that you can replicate the sender - authenticate multiple computers
* cracking peerssh
** forced to do a very long exhaustive search
*** can simulate this / talk about complexity
* limitations
** no ssh
** no encryption in response
** tradeoffs between lookahead and security?
* implications
** perfect for your botnet or randsomeware
** demonstrates the elegant simplicty of a rolling code
*** and the nice propreties of a good PRNG