diff --git a/cfb.js b/cfb.js index c8bd404..36220a8 100644 --- a/cfb.js +++ b/cfb.js @@ -1,6 +1,7 @@ /* vim: set ts=2: */ /*jshint eqnull:true */ +/** Helper Functions */ function readIEEE754(buf, idx, isLE, nl, ml) { if(isLE === undefined) isLE = true; if(!nl) nl = 8; @@ -87,6 +88,7 @@ Array.prototype.utf8 = function(s,e) { var str = ""; for(var i=s; i 0) sector_list[minifat_start].name = "!MiniFAT"; sector_list[fat_addrs[0]].name = "!FAT"; -/** read directory structure */ +/* [MS-CFB] 2.6.1 Compound File Directory Entry */ var files = {}, Paths = []; function read_directory(idx) { var blob, read; @@ -371,20 +372,30 @@ return this; /** CFB Constants */ { + /* 2.1 Compund File Sector Numbers and Types */ var MAXREGSECT = 0xFFFFFFFA; var DIFSECT = 0xFFFFFFFC; var FATSECT = 0xFFFFFFFD; var ENDOFCHAIN = 0xFFFFFFFE; var FREESECT = 0xFFFFFFFF; + /* 2.2 Compound File Header */ var HEADER_SIGNATURE = 'd0cf11e0a1b11ae1'; var HEADER_MINOR_VERSION = '3e00'; var MAXREGSID = 0xFFFFFFFA; var NOSTREAM = 0xFFFFFFFF; var HEADER_CLSID = '00000000000000000000000000000000'; - + /* 2.6.1 Compound File Directory Entry */ var EntryTypes = ['unknown','storage','stream',null,null,'root']; } +var CFB_utils = { + ReadShift: ReadShift, + WarnField: WarnField, + CheckField: CheckField, + prep_blob: prep_blob, + bconcat: bconcat +}; + if(typeof require !== 'undefined' && typeof exports !== 'undefined') { Array.prototype.toBuffer = function() { return Buffer.concat(this[0]); @@ -392,6 +403,7 @@ if(typeof require !== 'undefined' && typeof exports !== 'undefined') { var fs = require('fs'); exports.read = CFB.read; exports.parse = CFB.parse; + exports.utils = CFB_utils; exports.main = function(args) { var cfb = CFB.read(args[0], {type:'file'}); console.log(cfb); diff --git a/package.json b/package.json index bdb271d..59c46c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cfb", - "version": "0.0.2", + "version": "0.1.0", "author": "Niggler", "description": "Compound File Binary File Format extractor", "keywords": [ "cfb", "compression", "office" ],