Skip to content

Instantly share code, notes, and snippets.

View baudehlo's full-sized avatar

Matt Sergeant baudehlo

View GitHub Profile
matt@Valour /tmp$ cat client.js
var fullchunk;
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
if (!fullchunk) {
fullchunk = "";
$ telnet localhost 3000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
HTTP/1.1 200 OK
Connection: close
// Store mail in Mongo
var Db = require('mongodb').Db,
Connection = require('mongodb').Connection,
Server = require('mongodb').Server,
BSON = require('mongodb').BSONNative;
var MailParser = require("mailparser").MailParser;
exports.hook_queue = function (callback, connection) {
var MailParser = require("mailparser").MailParser;
var util = require('util');
exports.hook_queue = function (callback, connection) {
var plugin = this;
// Parse the mail first...
var mp = new MailParser({fix_smtp_escapes: 0});
var headers;
var body = require('./mailbody');
var fs = require('fs');
var util = require('util');
var b = new body.Body();
b.state = 'headers';
var data = fs.readFileSync('/tmp/multipart.eml', "UTF-8").split(/\n/);
for (var i=0; i < data.length; i++) {
function get_filename (id, cb) {
id = id || 1;
path.exists(path.join(root, id, '.ext'), function (exists) {
if (exists) {
get_filename(id++, cb);
}
else {
cb(id);
}
});
var fs = require('fs');
// Bind to receiving of data
exports.hook_data = function( next, connection, params ) {
var haraka = this,
uid = connection.transaction.uuid;
connection.transaction.notes.attachments = {};
CREATE TABLE User (
id INTEGER PRIMARY KEY,
email TEXT NOT NULL,
);
CREATE TABLE List (
id INTEGER PRIMARY KEY,
email TEXT NOT NULL,
);
# FastHeuristics enabled, run it...
if ($fasth) {
my $urls = $transaction->notes('urls') || [];
$tran_obj = ML::FastHeuristics::Transaction->new($transaction->mail,
cynic => $self->cynic,
transaction => $transaction,
threshold => $threshold,
uris => $urls,
);
// Input:
// perl -MCrypt::CBC -MMIME::Base64 -le 'print MIME::Base64::encode_base64(Crypt::CBC->new(-key=>"test",-cipher=>"DES",-header=>"randomiv")->encrypt("hello world"))';
var crypto = require ('crypto')
var input = 'UmFuZG9tSVZ2l2agomtNj7G5Rff4byYTKJAMbm4+51M=';
var input_buf = new Buffer(input, 'base64');
var KEY_LENGTH = 8;