use to find the --hex-string value for the first iptables rule from http://dev.kryo.se/iodine/wiki/TipsAndTricks
usage: node hostpack.js tunnel.blah.com
use to find the --hex-string value for the first iptables rule from http://dev.kryo.se/iodine/wiki/TipsAndTricks
usage: node hostpack.js tunnel.blah.com
function enc(s) { | |
if (!s) throw new Error('need hostname') | |
if (s.slice(-1) != '.') s += '.' | |
var r = Buffer(s.length + 1) | |
s = s.split('.') | |
var cc = 0 | |
for (var i = 0; i < s.length; i++) { | |
r.writeUInt8(s[i].length, cc) | |
cc++ | |
r.write(s[i], cc) | |
cc += s[i].length | |
} | |
return r.toString('hex') | |
} | |
console.log(enc(process.argv[2])) |