Skip to content
This repository

Extend the chainsaw? #6

Open
stephank opened this Issue · 4 comments

2 participants

Stéphan Kochen James Halliday
Stéphan Kochen

Perhaps more of a question, but how does one extend the chainsaws node-binary returns? I can't seem to figure out an easy way to this from looking at the source.

One of the things I'm playing with is a native SSH client for node. I'd like to add methods that don't necessarily belong in node-binary itself, but wrap structures that appear frequently in the SSH protocol (like name-list).

James Halliday
Owner

You can check out how node-rfb is organized:

https://github.com/substack/node-rfb/tree/master/lib

Stéphan Kochen

That does give inspiration on how to organize (thanks!), but I don't really see what I'm looking for specifically.

What I'm thinking about is things like this in node-rfb:

this
.word8('msgLen')
.buffer('msg','msgLen')

SSH has length-prefixed data/strings in many places. In the key exchange alone, it has 10 of these: http://tools.ietf.org/html/rfc4253#section-7.1

It'd be swell if I could add a method to the chainsaw for those small things you'd rather not break the chain for.

James Halliday
Owner

I couldn't get the signing to work properly for node-ssh-server but the key exchange works:

https://github.com/substack/node-ssh-server/blob/master/index.js

Stéphan Kochen

That looks great. Have a particular license in mind for your stuff? I may just try to work with that.

I'm still of the opinion this would be useful, though. :)

For example, in node-ssh-server:

Binary(stream)
    .scan('client.ident', '\r\n')
    .tap(frame.unpack('keyframe'))
    .tap(...)

Could look like:

Binary(stream)
    .scan('client.ident', '\r\n')
    .frame('keyframe')
    .tap(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.