Skip to content

Instantly share code, notes, and snippets.

Avatar

Jelle De Loecker skerit

View GitHub Profile
@skerit
skerit / send_syn.js
Created Mar 15, 2018 — forked from zachary822/send_syn.js
Send TCP SYN with node.js and raw-socket package
View send_syn.js
/**
* Sending a TCP SYN packet properly using the raw-socket package.
*/
var raw = require('raw-socket');
var crypto = require('crypto');
// create a raw socket using TCP
var s = raw.createSocket({
protocol: raw.Protocol.TCP
});
@skerit
skerit / binary-plist.js
Created Nov 1, 2015 — forked from clee/binary-plist.js
initial binary plist implementation in nodejs
View binary-plist.js
#!/usr/bin/env node
var fs = require('fs');
var sys = require('sys');
var bin = require('binary');
function bytesize(n) {
// JavaScript can't handle 64-bit ints natively.
// TODO: hack it up anyway.
// (n & 0xFFFFFFFF00000000) ? 8 : ...
@skerit
skerit / gist:5216766
Created Mar 21, 2013
"Inject" something into a function's scope (NOT context) This is just a proof-of-concept. Because it uses eval() on every execution you get a 99% performance hit.
View gist:5216766
Function.prototype.compel = function(scope, args, scope_args) {
var code = '';
// Every scope_args entry will be added to this code
for (var name in scope_args) {
code += 'var ' + name + ' = scope_args["' + name + '"];';
}
// eval the code, so these variables are available in this scope
You can’t perform that action at this time.