26 |
29 |
30 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Javascript must be enabled for this page to work!
39 |
40 |
41 |
42 | Drop files here
43 |
44 |
45 |
46 |
SlopFinder
47 |
Statically analyzes Windows executable files to look for use of DEP and ASLR. The lack of either indicates possible bad software development practices which pose security risks.
48 |
49 |
These are free protections provided by Microsoft. Not taking advantage of them is foolish.
50 |
51 |
To use, drag and drop Windows executables onto this page. If you use Chrome, you can drag and drop entire directories in C:\Program Files\. (Dropping your entire C:\ drive will crash your browser).
52 |
53 |
54 |
55 |
56 |
57 |
58 |
For developers
59 |
Data Execution Prevention (DEP) can be turned on by compiling with any Visual Studio version since 2005 and ensure NXCOMPAT is on (default).
60 |
61 |
Address Space Layout Randomization (ASLR) can be turned on by compiling with any Visual Studio version since 2005 and ensure DYNAMICBASE in on (default).
62 |
63 |
64 |
65 |
66 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/about.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Ice Buddha
4 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
Motive
16 | The goal of IceBuddha is to become a general purpose binary file parser to help me learn some things and try out some ideas. I'm doing this because I think it's an interesting idea, and with no goal of financial gain (just street cred).
17 |
18 |
19 |
20 |
Contact me
21 | Email me at 0xdabbad00 – at – gmail.com or read what I'm up to on my main site
0xdabbad00.com .
22 |
23 |
Thank you!
24 | Thanks to the following projects/people for making this site possible:
25 |
jqTree (Apache license) Allows me to show my tree view of the parsed data.
26 |
jQuery.ScrollTo (MIT and GPL licenses) Makes the browser scroll.
27 |
Waypoints (MIT and GPL licenses) Causes events to occur when you scroll.
28 |
ACE editor (BSD license?) Code-editor.
29 |
Eli Grey for
FileSaver.js and
BlobBuilder.js , which I use to download files (MIT/X11 license).
30 |
skulpt (MIT license) In-browser Python to JavaScript compiler.
31 |
32 |
PEG.js (MIT license) No longer used, but still appreciate them for it I was using it.
33 |
34 |
35 |
Thanks in advance
36 |
Bruno for writing my auto-complete code in
his answer to my question on stackoverflow.
37 |
38 |
39 |
Privacy Policy
40 | I don't collect any data. Everything is happening locally, client side on your system. It's all javascript and html, so I invite you to not only review my code on
github , but host this site locally. Or better yet, fork it and send me fixes/features! Most of the site should work by just downloading it and browsing to it on your local hard-drive, even without a web server (some code does currently grab files from my server but I'm trying to figure out a smarter way to handle that). I host this site on amazon EC2 because most free hosting tracks users. I believe strongly in privacy, and frankly I'm too stupid to know how to profit from your use of this site.
41 |
42 |
I do want to eventually incorporate some wiki capabilities into this site which will mean some server side code, but I still will refrain from sending home any data you are not specifically requesting my server receive.
43 |
44 |
45 |
46 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/jquery.cookie.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery Cookie Plugin v1.4.1
3 | * https://github.com/carhartl/jquery-cookie
4 | *
5 | * Copyright 2013 Klaus Hartl
6 | * Released under the MIT license
7 | */
8 | (function (factory) {
9 | if (typeof define === 'function' && define.amd) {
10 | // AMD
11 | define(['jquery'], factory);
12 | } else if (typeof exports === 'object') {
13 | // CommonJS
14 | factory(require('jquery'));
15 | } else {
16 | // Browser globals
17 | factory(jQuery);
18 | }
19 | }(function ($) {
20 |
21 | var pluses = /\+/g;
22 |
23 | function encode(s) {
24 | return config.raw ? s : encodeURIComponent(s);
25 | }
26 |
27 | function decode(s) {
28 | return config.raw ? s : decodeURIComponent(s);
29 | }
30 |
31 | function stringifyCookieValue(value) {
32 | return encode(config.json ? JSON.stringify(value) : String(value));
33 | }
34 |
35 | function parseCookieValue(s) {
36 | if (s.indexOf('"') === 0) {
37 | // This is a quoted cookie as according to RFC2068, unescape...
38 | s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
39 | }
40 |
41 | try {
42 | // Replace server-side written pluses with spaces.
43 | // If we can't decode the cookie, ignore it, it's unusable.
44 | // If we can't parse the cookie, ignore it, it's unusable.
45 | s = decodeURIComponent(s.replace(pluses, ' '));
46 | return config.json ? JSON.parse(s) : s;
47 | } catch(e) {}
48 | }
49 |
50 | function read(s, converter) {
51 | var value = config.raw ? s : parseCookieValue(s);
52 | return $.isFunction(converter) ? converter(value) : value;
53 | }
54 |
55 | var config = $.cookie = function (key, value, options) {
56 |
57 | // Write
58 |
59 | if (value !== undefined && !$.isFunction(value)) {
60 | options = $.extend({}, config.defaults, options);
61 |
62 | if (typeof options.expires === 'number') {
63 | var days = options.expires, t = options.expires = new Date();
64 | t.setTime(+t + days * 864e+5);
65 | }
66 |
67 | return (document.cookie = [
68 | encode(key), '=', stringifyCookieValue(value),
69 | options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
70 | options.path ? '; path=' + options.path : '',
71 | options.domain ? '; domain=' + options.domain : '',
72 | options.secure ? '; secure' : ''
73 | ].join(''));
74 | }
75 |
76 | // Read
77 |
78 | var result = key ? undefined : {};
79 |
80 | // To prevent the for loop in the first place assign an empty array
81 | // in case there are no cookies at all. Also prevents odd result when
82 | // calling $.cookie().
83 | var cookies = document.cookie ? document.cookie.split('; ') : [];
84 |
85 | for (var i = 0, l = cookies.length; i < l; i++) {
86 | var parts = cookies[i].split('=');
87 | var name = decode(parts.shift());
88 | var cookie = parts.join('=');
89 |
90 | if (key && key === name) {
91 | // If second argument (value) is a function it's a converter...
92 | result = read(cookie, value);
93 | break;
94 | }
95 |
96 | // Prevent storing a cookie that we couldn't decode.
97 | if (!key && (cookie = read(cookie)) !== undefined) {
98 | result[name] = cookie;
99 | }
100 | }
101 |
102 | return result;
103 | };
104 |
105 | config.defaults = {};
106 |
107 | $.removeCookie = function (key, options) {
108 | if ($.cookie(key) === undefined) {
109 | return false;
110 | }
111 |
112 | // Must not alter options, thus extending a fresh object...
113 | $.cookie(key, '', $.extend({}, options, { expires: -1 }));
114 | return !$.cookie(key);
115 | };
116 |
117 | }));
118 |
--------------------------------------------------------------------------------
/parse_scripts/mach_o.py:
--------------------------------------------------------------------------------
1 | """ GIF file parse script for IceBuddha.com
2 | """
3 | import icebuddha
4 |
5 | __author__ = "0xdabbad00"
6 | __license__ = "Apache"
7 |
8 | class Parser:
9 | def run(self, data):
10 | filedata = data
11 | ib = icebuddha.IceBuddha(filedata, "MACH_O")
12 |
13 | machHeader = ib.parse(0, "mach_header", """
14 | DWORD magic;
15 | DWORD cputype;
16 | DWORD cpusubtype;
17 | DWORD filetype;
18 | DWORD ncmds;
19 | DWORD sizeofcmds;
20 | DWORD flags;
21 | """)
22 |
23 | magicElement = machHeader.findChild("magic")
24 | magicElement.setMeaningFromConstants("""
25 | MACHO_32 = 0xFEEDFACE
26 | MACHO_64 = 0xFEEDFACF
27 | MACHO_FAT = 0xCAFEBABE
28 | MACHO_FAT_CIGAM = 0xBEBAFECA
29 | """);
30 |
31 | if magicElement.getValue() == "":
32 | ib.setBigEndian()
33 | magicElement.setMeaningFromConstants("""
34 | MACHO_32 = 0xFEEDFACE
35 | MACHO_64 = 0xFEEDFACF
36 | """);
37 | if magicElement.getValue() == "":
38 | print "Unknown file format"
39 | return ib.getParseTree()
40 |
41 | cputype = machHeader.findChild("cputype")
42 | cputype.setMeaningFromConstants("""
43 | CPU_TYPE_I386 = 0x7
44 | CPU_TYPE_X86_64 = 0x01000007
45 | CPU_TYPE_POWERPC = 0x12
46 | CPU_TYPE_POWERPC64 = 0x01000012
47 | CPU_TYPE_ARM = 0xC
48 | """);
49 |
50 | filetype = machHeader.findChild("filetype")
51 | filetype.setMeaningFromConstants("""
52 | MACH_OBJECT = 0x1
53 | MACH_EXECUTE = 0x2
54 | MACH_FVMLIB = 0x3
55 | MACH_CORE = 0x4
56 | MACH_PRELOAD = 0x5
57 | MACH_DYLIB = 0x6
58 | MACH_DYLINKER = 0x7
59 | MACH_BUNDLE = 0x8
60 | MACH_DYLIB_STUB = 0x9
61 | MACH_DSYM = 0xA
62 | MACH_KEXT_BUNDLE = 0xB
63 | """);
64 |
65 | flags = machHeader.findChild("flags")
66 | flags.parseBitField("""
67 | DWORD NOUNDEFS : 1;
68 | DWORD INCRLINK : 1;
69 | DWORD DYLDLINK : 1;
70 | DWORD BINDATLOAD : 1;
71 | DWORD PREBOUND : 1;
72 | DWORD SPLIT_SEGS : 1;
73 | DWORD LAZY_INIT : 1;
74 | DWORD TWOLEVEL : 1;
75 | DWORD FORCE_FLAT : 1;
76 | DWORD NOMULTIDEFS : 1;
77 | DWORD NOFIXPREBINDING : 1;
78 | DWORD PREBINDABLE : 1;
79 | DWORD ALLMODSBOUND : 1;
80 | DWORD SUBSECTIONS_VIA_SYMBOLS : 1;
81 | DWORD CANONICAL : 1;
82 | DWORD WEAK_DEFINES : 1;
83 | DWORD BINDS_TO_WEAK : 1;
84 | DWORD ALLOW_STACK_EXECUTION : 1;
85 | DWORD ROOT_SAFE : 1;
86 | DWORD SETUID_SAFE : 1;
87 | DWORD NO_REEXPORTED_DYLIBS : 1;
88 | DWORD PIE : 1;
89 | DWORD DEAD_STRIPPABLE_DYLIB : 1;
90 | DWORD HAS_TLV_DESCRIPTORS : 1;
91 | DWORD NO_HEAP_EXECUTION : 1;
92 | """);
93 |
94 | ib.append(machHeader)
95 | return ib.getParseTree()
96 |
97 | parser = Parser()
98 |
--------------------------------------------------------------------------------
/waypoints.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | jQuery Waypoints - v1.1.6
3 | Copyright (c) 2011-2012 Caleb Troughton
4 | Dual licensed under the MIT license and GPL license.
5 | https://github.com/imakewebthings/jquery-waypoints/blob/master/MIT-license.txt
6 | https://github.com/imakewebthings/jquery-waypoints/blob/master/GPL-license.txt
7 | */
8 | (function($,k,m,i,d){var e=$(i),g="waypoint.reached",b=function(o,n){o.element.trigger(g,n);if(o.options.triggerOnce){o.element[k]("destroy")}},h=function(p,o){if(!o){return -1}var n=o.waypoints.length-1;while(n>=0&&o.waypoints[n].element[0]!==p[0]){n-=1}return n},f=[],l=function(n){$.extend(this,{element:$(n),oldScroll:0,waypoints:[],didScroll:false,didResize:false,doScroll:$.proxy(function(){var q=this.element.scrollTop(),p=q>this.oldScroll,s=this,r=$.grep(this.waypoints,function(u,t){return p?(u.offset>s.oldScroll&&u.offset<=q):(u.offset<=s.oldScroll&&u.offset>q)}),o=r.length;if(!this.oldScroll||!q){$[m]("refresh")}this.oldScroll=q;if(!o){return}if(!p){r.reverse()}$.each(r,function(u,t){if(t.options.continuous||u===o-1){b(t,[p?"down":"up"])}})},this)});$(n).bind("scroll.waypoints",$.proxy(function(){if(!this.didScroll){this.didScroll=true;i.setTimeout($.proxy(function(){this.doScroll();this.didScroll=false},this),$[m].settings.scrollThrottle)}},this)).bind("resize.waypoints",$.proxy(function(){if(!this.didResize){this.didResize=true;i.setTimeout($.proxy(function(){$[m]("refresh");this.didResize=false},this),$[m].settings.resizeThrottle)}},this));e.load($.proxy(function(){this.doScroll()},this))},j=function(n){var o=null;$.each(f,function(p,q){if(q.element[0]===n){o=q;return false}});return o},c={init:function(o,n){this.each(function(){var u=$.fn[k].defaults.context,q,t=$(this);if(n&&n.context){u=n.context}if(!$.isWindow(u)){u=t.closest(u)[0]}q=j(u);if(!q){q=new l(u);f.push(q)}var p=h(t,q),s=p<0?$.fn[k].defaults:q.waypoints[p].options,r=$.extend({},s,n);r.offset=r.offset==="bottom-in-view"?function(){var v=$.isWindow(u)?$[m]("viewportHeight"):$(u).height();return v-$(this).outerHeight()}:r.offset;if(p<0){q.waypoints.push({element:t,offset:null,options:r})}else{q.waypoints[p].options=r}if(o){t.bind(g,o)}if(n&&n.handler){t.bind(g,n.handler)}});$[m]("refresh");return this},remove:function(){return this.each(function(o,p){var n=$(p);$.each(f,function(r,s){var q=h(n,s);if(q>=0){s.waypoints.splice(q,1);if(!s.waypoints.length){s.element.unbind("scroll.waypoints resize.waypoints");f.splice(r,1)}}})})},destroy:function(){return this.unbind(g)[k]("remove")}},a={refresh:function(){$.each(f,function(r,s){var q=$.isWindow(s.element[0]),n=q?0:s.element.offset().top,p=q?$[m]("viewportHeight"):s.element.height(),o=q?0:s.element.scrollTop();$.each(s.waypoints,function(u,x){if(!x){return}var t=x.options.offset,w=x.offset;if(typeof x.options.offset==="function"){t=x.options.offset.apply(x.element)}else{if(typeof x.options.offset==="string"){var v=parseFloat(x.options.offset);t=x.options.offset.indexOf("%")?Math.ceil(p*(v/100)):v}}x.offset=x.element.offset().top-n+o-t;if(x.options.onlyOnScroll){return}if(w!==null&&s.oldScroll>w&&s.oldScroll<=x.offset){b(x,["up"])}else{if(w!==null&&s.oldScroll
=x.offset){b(x,["down"])}else{if(!w&&o>x.offset){b(x,["down"])}}}});s.waypoints.sort(function(u,t){return u.offset-t.offset})})},viewportHeight:function(){return(i.innerHeight?i.innerHeight:e.height())},aggregate:function(){var n=$();$.each(f,function(o,p){$.each(p.waypoints,function(q,r){n=n.add(r.element)})});return n}};$.fn[k]=function(n){if(c[n]){return c[n].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof n==="function"||!n){return c.init.apply(this,arguments)}else{if(typeof n==="object"){return c.init.apply(this,[null,n])}else{$.error("Method "+n+" does not exist on jQuery "+k)}}}};$.fn[k].defaults={continuous:true,offset:0,triggerOnce:false,context:i};$[m]=function(n){if(a[n]){return a[n].apply(this)}else{return a.aggregate()}};$[m].settings={resizeThrottle:200,scrollThrottle:100};e.load(function(){$[m]("refresh")})})(jQuery,"waypoint","waypoints",window);
--------------------------------------------------------------------------------
/ace/mode-python.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/mode/python",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/python_highlight_rules","ace/mode/folding/pythonic","ace/range"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./python_highlight_rules").PythonHighlightRules,u=e("./folding/pythonic").FoldMode,a=e("../range").Range,f=function(){this.$tokenizer=new s((new o).getRules()),this.foldingRules=new u("\\:")};r.inherits(f,i),function(){this.toggleCommentLines=function(e,t,n,r){var i=!0,s=/^(\s*)#/;for(var o=n;o<=r;o++)if(!s.test(t.getLine(o))){i=!1;break}if(i){var u=new a(0,0,0,0);for(var o=n;o<=r;o++){var f=t.getLine(o),l=f.match(s);u.start.row=o,u.end.row=o,u.end.column=l[0].length,t.replace(u,l[1])}}else t.indentRows(n,r,"#")},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.$tokenizer.getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"){var o=t.match(/^.*[\{\(\[\:]\s*$/);o&&(r+=n)}return r};var e={pass:1,"return":1,raise:1,"break":1,"continue":1};this.checkOutdent=function(t,n,r){if(r!=="\r\n"&&r!=="\r"&&r!=="\n")return!1;var i=this.$tokenizer.getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type=="comment"||s.type=="text"&&s.value.match(/^\s+$/)));return s?s.type=="keyword"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new a(n,r.length-i.length,n,r.length))}}.call(f.prototype),t.Mode=f}),ace.define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){var e="and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield",t="True|False|None|NotImplemented|Ellipsis|__debug__",n="abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern",r=this.createKeywordMapper({"invalid.deprecated":"debugger","support.function":n,"constant.language":t,keyword:e},"identifier"),i="(?:r|u|ur|R|U|UR|Ur|uR)?",s="(?:(?:[1-9]\\d*)|(?:0))",o="(?:0[oO]?[0-7]+)",u="(?:0[xX][\\dA-Fa-f]+)",a="(?:0[bB][01]+)",f="(?:"+s+"|"+o+"|"+u+"|"+a+")",l="(?:[eE][+-]?\\d+)",c="(?:\\.\\d+)",h="(?:\\d+)",p="(?:(?:"+h+"?"+c+")|(?:"+h+"\\.))",d="(?:(?:"+p+"|"+h+")"+l+")",v="(?:"+d+"|"+p+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:i+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",merge:!0,regex:i+'"{3}.*$',next:"qqstring"},{token:"string",regex:i+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:i+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",merge:!0,regex:i+"'{3}.*$",next:"qstring"},{token:"string",regex:i+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+v+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:v},{token:"constant.numeric",regex:f+"[lL]\\b"},{token:"constant.numeric",regex:f+"\\b"},{token:r,regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"paren.lparen",regex:"[\\[\\(\\{]"},{token:"paren.rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",merge:!0,regex:".+"}]}};r.inherits(s,i),t.PythonHighlightRules=s}),ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"],function(e,t,n){var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=t.FoldMode=function(e){this.foldingStartMarker=new RegExp("([\\[{])(?:\\s*)$|("+e+")(?:\\s*)(?:#.*)?$")};r.inherits(s,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i)return i[1]?this.openingBracketBlock(e,i[1],n,i.index):i[2]?this.indentationBlock(e,n,i.index+i[2].length):this.indentationBlock(e,n)}}.call(s.prototype)})
--------------------------------------------------------------------------------
/BlobBuilder.js:
--------------------------------------------------------------------------------
1 | /* BlobBuilder.js
2 | * A BlobBuilder implementation.
3 | * 2012-04-21
4 | *
5 | * By Eli Grey, http://eligrey.com
6 | * License: X11/MIT
7 | * See LICENSE.md
8 | */
9 |
10 | /*global self, unescape */
11 | /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
12 | plusplus: true */
13 |
14 | /*! @source http://purl.eligrey.com/github/BlobBuilder.js/blob/master/BlobBuilder.js */
15 |
16 | var BlobBuilder = BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder || (function(view) {
17 | "use strict";
18 | var
19 | get_class = function(object) {
20 | return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];
21 | }
22 | , FakeBlobBuilder = function(){
23 | this.data = [];
24 | }
25 | , FakeBlob = function(data, type, encoding) {
26 | this.data = data;
27 | this.size = data.length;
28 | this.type = type;
29 | this.encoding = encoding;
30 | }
31 | , FBB_proto = FakeBlobBuilder.prototype
32 | , FB_proto = FakeBlob.prototype
33 | , FileReaderSync = view.FileReaderSync
34 | , FileException = function(type) {
35 | this.code = this[this.name = type];
36 | }
37 | , file_ex_codes = (
38 | "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
39 | + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
40 | ).split(" ")
41 | , file_ex_code = file_ex_codes.length
42 | , realURL = view.URL || view.webkitURL || view
43 | , real_create_object_URL = realURL.createObjectURL
44 | , real_revoke_object_URL = realURL.revokeObjectURL
45 | , URL = realURL
46 | , btoa = view.btoa
47 | , atob = view.atob
48 | , can_apply_typed_arrays = false
49 | , can_apply_typed_arrays_test = function(pass) {
50 | can_apply_typed_arrays = !pass;
51 | }
52 |
53 | , ArrayBuffer = view.ArrayBuffer
54 | , Uint8Array = view.Uint8Array
55 | ;
56 | FakeBlobBuilder.fake = FB_proto.fake = true;
57 | while (file_ex_code--) {
58 | FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
59 | }
60 | try {
61 | if (Uint8Array) {
62 | can_apply_typed_arrays_test.apply(0, new Uint8Array(1));
63 | }
64 | } catch (ex) {}
65 | if (!realURL.createObjectURL) {
66 | URL = view.URL = {};
67 | }
68 | URL.createObjectURL = function(blob) {
69 | var
70 | type = blob.type
71 | , data_URI_header
72 | ;
73 | if (type === null) {
74 | type = "application/octet-stream";
75 | }
76 | if (blob instanceof FakeBlob) {
77 | data_URI_header = "data:" + type;
78 | if (blob.encoding === "base64") {
79 | return data_URI_header + ";base64," + blob.data;
80 | } else if (blob.encoding === "URI") {
81 | return data_URI_header + "," + decodeURIComponent(blob.data);
82 | } if (btoa) {
83 | return data_URI_header + ";base64," + btoa(blob.data);
84 | } else {
85 | return data_URI_header + "," + encodeURIComponent(blob.data);
86 | }
87 | } else if (real_create_object_url) {
88 | return real_create_object_url.call(realURL, blob);
89 | }
90 | };
91 | URL.revokeObjectURL = function(object_url) {
92 | if (object_url.substring(0, 5) !== "data:" && real_revoke_object_url) {
93 | real_revoke_object_url.call(realURL, object_url);
94 | }
95 | };
96 | FBB_proto.append = function(data/*, endings*/) {
97 | var bb = this.data;
98 | // decode data to a binary string
99 | if (Uint8Array && data instanceof ArrayBuffer) {
100 | if (can_apply_typed_arrays) {
101 | bb.push(String.fromCharCode.apply(String, new Uint8Array(data)));
102 | } else {
103 | var
104 | str = ""
105 | , buf = new Uint8Array(data)
106 | , i = 0
107 | , buf_len = buf.length
108 | ;
109 | for (; i < buf_len; i++) {
110 | str += String.fromCharCode(buf[i]);
111 | }
112 | }
113 | } else if (get_class(data) === "Blob" || get_class(data) === "File") {
114 | if (FileReaderSync) {
115 | var fr = new FileReaderSync;
116 | bb.push(fr.readAsBinaryString(data));
117 | } else {
118 | // async FileReader won't work as BlobBuilder is sync
119 | throw new FileException("NOT_READABLE_ERR");
120 | }
121 | } else if (data instanceof FakeBlob) {
122 | if (data.encoding === "base64" && atob) {
123 | bb.push(atob(data.data));
124 | } else if (data.encoding === "URI") {
125 | bb.push(decodeURIComponent(data.data));
126 | } else if (data.encoding === "raw") {
127 | bb.push(data.data);
128 | }
129 | } else {
130 | if (typeof data !== "string") {
131 | data += ""; // convert unsupported types to strings
132 | }
133 | // decode UTF-16 to binary string
134 | bb.push(unescape(encodeURIComponent(data)));
135 | }
136 | };
137 | FBB_proto.getBlob = function(type) {
138 | if (!arguments.length) {
139 | type = null;
140 | }
141 | return new FakeBlob(this.data.join(""), type, "raw");
142 | };
143 | FBB_proto.toString = function() {
144 | return "[object BlobBuilder]";
145 | };
146 | FB_proto.slice = function(start, end, type) {
147 | var args = arguments.length;
148 | if (args < 3) {
149 | type = null;
150 | }
151 | return new FakeBlob(
152 | this.data.slice(start, args > 1 ? end : this.data.length)
153 | , type
154 | , this.encoding
155 | );
156 | };
157 | FB_proto.toString = function() {
158 | return "[object Blob]";
159 | };
160 | return FakeBlobBuilder;
161 | }(self));
--------------------------------------------------------------------------------
/jquery.hotkeys.js:
--------------------------------------------------------------------------------
1 | /*jslint browser: true*/
2 | /*jslint jquery: true*/
3 |
4 | /*
5 | * jQuery Hotkeys Plugin
6 | * Copyright 2010, John Resig
7 | * Dual licensed under the MIT or GPL Version 2 licenses.
8 | *
9 | * Based upon the plugin by Tzury Bar Yochay:
10 | * http://github.com/tzuryby/hotkeys
11 | *
12 | * Original idea by:
13 | * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
14 | */
15 |
16 | /*
17 | * One small change is: now keys are passed by object { keys: '...' }
18 | * Might be useful, when you want to pass some other data to your handler
19 | */
20 |
21 | (function(jQuery) {
22 |
23 | jQuery.hotkeys = {
24 | version: "0.8",
25 |
26 | specialKeys: {
27 | 8: "backspace",
28 | 9: "tab",
29 | 10: "return",
30 | 13: "return",
31 | 16: "shift",
32 | 17: "ctrl",
33 | 18: "alt",
34 | 19: "pause",
35 | 20: "capslock",
36 | 27: "esc",
37 | 32: "space",
38 | 33: "pageup",
39 | 34: "pagedown",
40 | 35: "end",
41 | 36: "home",
42 | 37: "left",
43 | 38: "up",
44 | 39: "right",
45 | 40: "down",
46 | 45: "insert",
47 | 46: "del",
48 | 59: ";",
49 | 61: "=",
50 | 96: "0",
51 | 97: "1",
52 | 98: "2",
53 | 99: "3",
54 | 100: "4",
55 | 101: "5",
56 | 102: "6",
57 | 103: "7",
58 | 104: "8",
59 | 105: "9",
60 | 106: "*",
61 | 107: "+",
62 | 109: "-",
63 | 110: ".",
64 | 111: "/",
65 | 112: "f1",
66 | 113: "f2",
67 | 114: "f3",
68 | 115: "f4",
69 | 116: "f5",
70 | 117: "f6",
71 | 118: "f7",
72 | 119: "f8",
73 | 120: "f9",
74 | 121: "f10",
75 | 122: "f11",
76 | 123: "f12",
77 | 144: "numlock",
78 | 145: "scroll",
79 | 173: "-",
80 | 186: ";",
81 | 187: "=",
82 | 188: ",",
83 | 189: "-",
84 | 190: ".",
85 | 191: "/",
86 | 192: "`",
87 | 219: "[",
88 | 220: "\\",
89 | 221: "]",
90 | 222: "'"
91 | },
92 |
93 | shiftNums: {
94 | "`": "~",
95 | "1": "!",
96 | "2": "@",
97 | "3": "#",
98 | "4": "$",
99 | "5": "%",
100 | "6": "^",
101 | "7": "&",
102 | "8": "*",
103 | "9": "(",
104 | "0": ")",
105 | "-": "_",
106 | "=": "+",
107 | ";": ": ",
108 | "'": "\"",
109 | ",": "<",
110 | ".": ">",
111 | "/": "?",
112 | "\\": "|"
113 | },
114 |
115 | // excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
116 | textAcceptingInputTypes: [
117 | "text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
118 | "datetime-local", "search", "color", "tel"],
119 |
120 | options: {
121 | filterTextInputs: true
122 | }
123 | };
124 |
125 | function keyHandler(handleObj) {
126 | if (typeof handleObj.data === "string") {
127 | handleObj.data = {
128 | keys: handleObj.data
129 | };
130 | }
131 |
132 | // Only care when a possible input has been specified
133 | if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
134 | return;
135 | }
136 |
137 | var origHandler = handleObj.handler,
138 | keys = handleObj.data.keys.toLowerCase().split(" ");
139 |
140 | handleObj.handler = function(event) {
141 | // Don't fire in text-accepting inputs that we didn't directly bind to
142 | if (this !== event.target && (/textarea|select/i.test(event.target.nodeName) ||
143 | (jQuery.hotkeys.options.filterTextInputs &&
144 | jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
145 | return;
146 | }
147 |
148 | var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
149 | character = String.fromCharCode(event.which).toLowerCase(),
150 | modif = "",
151 | possible = {};
152 |
153 | jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) {
154 |
155 | if (event[specialKey + 'Key'] && special !== specialKey) {
156 | modif += specialKey + '+';
157 | }
158 | });
159 |
160 | // metaKey is triggered off ctrlKey erronously
161 | if (event.metaKey && !event.ctrlKey && special !== "meta") {
162 | modif += "meta+";
163 | }
164 |
165 | if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
166 | modif = modif.replace("alt+ctrl+shift+", "hyper+");
167 | }
168 |
169 | if (special) {
170 | possible[modif + special] = true;
171 | }
172 | else {
173 | possible[modif + character] = true;
174 | possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
175 |
176 | // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
177 | if (modif === "shift+") {
178 | possible[jQuery.hotkeys.shiftNums[character]] = true;
179 | }
180 | }
181 |
182 | for (var i = 0, l = keys.length; i < l; i++) {
183 | if (possible[keys[i]]) {
184 | return origHandler.apply(this, arguments);
185 | }
186 | }
187 | };
188 | }
189 |
190 | jQuery.each(["keydown", "keyup", "keypress"], function() {
191 | jQuery.event.special[this] = {
192 | add: keyHandler
193 | };
194 | });
195 |
196 | })(jQuery || this.jQuery || window.jQuery);
197 |
--------------------------------------------------------------------------------
/ace/keybinding-emacs.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,n){var r=e("../lib/dom"),i=function(e,t){var n=this.scroller.getBoundingClientRect(),i=Math.floor((e+this.scrollLeft-n.left-this.$padding-r.getPageScrollLeft())/this.characterWidth),s=Math.floor((t+this.scrollTop-n.top-r.getPageScrollTop())/this.lineHeight);return this.session.screenToDocumentPosition(s,i)},s=e("./hash_handler").HashHandler;t.handler=new s;var o=!1;t.handler.attach=function(e){o||(o=!0,r.importCssString(" .emacs-mode .ace_cursor{ border: 2px rgba(50,250,50,0.8) solid!important; -moz-box-sizing: border-box!important; -webkit-box-sizing: border-box!important; box-sizing: border-box!important; background-color: rgba(0,250,0,0.9); opacity: 0.5; } .emacs-mode .ace_cursor.ace_hidden{ opacity: 1; background-color: transparent; } .emacs-mode .ace_overwrite-cursors .ace_cursor { opacity: 1; background-color: transparent; border-width: 0 0 2px 2px !important; } .emacs-mode .ace_text-layer { z-index: 4 } .emacs-mode .ace_cursor-layer { z-index: 2 }","emacsMode")),e.renderer.screenToTextCoordinates=i,e.setStyle("emacs-mode")},t.handler.detach=function(e){delete e.renderer.screenToTextCoordinates,e.unsetStyle("emacs-mode")};var u=e("../lib/keys").KEY_MODS,a={C:"ctrl",S:"shift",M:"alt"};["S-C-M","S-C","S-M","C-M","S","C","M"].forEach(function(e){var t=0;e.split("-").forEach(function(e){t|=u[a[e]]}),a[t]=e.toLowerCase()+"-"}),t.handler.bindKey=function(e,t){if(!e)return;var n=this.commmandKeyBinding;e.split("|").forEach(function(e){e=e.toLowerCase(),n[e]=t,e=e.split(" ")[0],n[e]||(n[e]="null")},this)},t.handler.handleKeyboard=function(e,t,n,r){if(t==-1&&e.count){var i=Array(e.count+1).join(n);return e.count=null,{command:"insertstring",args:i}}if(n=="\0")return;var s=a[t];if(s=="c-"||e.universalArgument){var o=parseInt(n[n.length-1]);if(o)return e.count=o,{command:"null"}}e.universalArgument=!1,s&&(n=s+n),e.keyChain&&(n=e.keyChain+=" "+n);var u=this.commmandKeyBinding[n];e.keyChain=u=="null"?n:"";if(!u)return;if(u=="null")return{command:"null"};if(u=="universalArgument")return e.universalArgument=!0,{command:"null"};if(typeof u!="string"){var f=u.args;u=u.command}typeof u=="string"&&(u=this.commands[u]||e.editor.commands.commands[u]),!u.readonly&&!u.isYank&&(e.lastCommand=null);if(e.count){var o=e.count;return e.count=0,{args:f,command:{exec:function(e,t){for(var n=0;n30&&this.$data.shift()},get:function(){return this.$data[this.$data.length-1]||""},pop:function(){return this.$data.length>1&&this.$data.pop(),this.get()},rotate:function(){return this.$data.unshift(this.$data.pop()),this.get()}}})
--------------------------------------------------------------------------------
/ace/ext-textarea.js:
--------------------------------------------------------------------------------
1 | ace.define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate","ace/mode/text"],function(e,t,n){function a(e,t){for(var n in t)e.style[n]=t[n]}function f(e,t){if(e.type!="textarea")throw"Textarea required!";var n=e.parentNode,i=document.createElement("div"),s=function(){var t="position:relative;";["margin-top","margin-left","margin-right","margin-bottom"].forEach(function(n){t+=n+":"+u(e,i,n)+";"});var n=u(e,i,"width")||e.clientWidth+"px",r=u(e,i,"height")||e.clientHeight+"px";t+="height:"+r+";width:"+n+";",t+="display:inline-block;",i.setAttribute("style",t)};r.addListener(window,"resize",s),s(),e.nextSibling?n.insertBefore(i,e.nextSibling):n.appendChild(i);while(n!==document){if(n.tagName.toUpperCase()==="FORM"){var o=n.onsubmit;n.onsubmit=function(n){e.innerHTML=t(),e.value=t(),o&&o.call(this,n)};break}n=n.parentNode}return i}function l(t,n,r){s.loadScript(t,function(){e([n],r)})}function c(n,r,i,s,o,u){function c(e){return e=="true"}var a=n.getSession(),f=n.renderer;u=u||l,n.setDisplaySettings=function(e){e==null&&(e=i.style.display=="none"),i.style.display=e?"block":"none"},n.setOption=function(t,i){if(o[t]==i)return;switch(t){case"gutter":f.setShowGutter(c(i));break;case"mode":i!="text"?u("mode-"+i+".js","ace/mode/"+i,function(){var t=e("../mode/"+i).Mode;a.setMode(new t)}):a.setMode(new(e("../mode/text").Mode));break;case"theme":i!="textmate"?u("theme-"+i+".js","ace/theme/"+i,function(){n.setTheme("ace/theme/"+i)}):n.setTheme("ace/theme/textmate");break;case"fontSize":r.style.fontSize=i;break;case"softWrap":switch(i){case"off":a.setUseWrapMode(!1),f.setPrintMarginColumn(80);break;case"40":a.setUseWrapMode(!0),a.setWrapLimitRange(40,40),f.setPrintMarginColumn(40);break;case"80":a.setUseWrapMode(!0),a.setWrapLimitRange(80,80),f.setPrintMarginColumn(80);break;case"free":a.setUseWrapMode(!0),a.setWrapLimitRange(null,null),f.setPrintMarginColumn(80)}break;case"useSoftTabs":a.setUseSoftTabs(c(i));break;case"showPrintMargin":f.setShowPrintMargin(c(i));break;case"showInvisibles":n.setShowInvisibles(c(i))}o[t]=i},n.getOption=function(e){return o[e]},n.getOptions=function(){return o};for(var h in t.options)n.setOption(h,t.options[h]);return n}function h(e,t,n,i){function f(e,t,n,r){e.push("");for(var i in n)e.push("",n[i]," ");e.push(" ")}var s={"true":!0,"false":!1},o={mode:"Mode:",gutter:"Display Gutter:",theme:"Theme:",fontSize:"Font Size:",softWrap:"Soft Wrap:",showPrintMargin:"Show Print Margin:",useSoftTabs:"Use Soft Tabs:",showInvisibles:"Show Invisibles"},u={mode:{text:"Plain",javascript:"JavaScript",xml:"XML",html:"HTML",css:"CSS",scss:"SCSS",python:"Python",php:"PHP",java:"Java",ruby:"Ruby",c_cpp:"C/C++",coffee:"CoffeeScript",json:"json",perl:"Perl",clojure:"Clojure",ocaml:"OCaml",csharp:"C#",haxe:"haXe",svg:"SVG",textile:"Textile",groovy:"Groovy",liquid:"Liquid",Scala:"Scala"},theme:{clouds:"Clouds",clouds_midnight:"Clouds Midnight",cobalt:"Cobalt",crimson_editor:"Crimson Editor",dawn:"Dawn",eclipse:"Eclipse",idle_fingers:"Idle Fingers",kr_theme:"Kr Theme",merbivore:"Merbivore",merbivore_soft:"Merbivore Soft",mono_industrial:"Mono Industrial",monokai:"Monokai",pastel_on_dark:"Pastel On Dark",solarized_dark:"Solarized Dark",solarized_light:"Solarized Light",textmate:"Textmate",twilight:"Twilight",vibrant_ink:"Vibrant Ink"},gutter:s,fontSize:{"10px":"10px","11px":"11px","12px":"12px","14px":"14px","16px":"16px"},softWrap:{off:"Off",40:"40",80:"80",free:"Free"},showPrintMargin:s,useSoftTabs:s,showInvisibles:s},a=[];a.push("Setting Value ");for(var l in i)a.push("",o[l]," "),a.push(""),f(a,l,u[l],i[l]),a.push(" ");a.push("
"),e.innerHTML=a.join("");var c=e.getElementsByTagName("select");for(var h=0;h
2 |
3 | Ice Buddha
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
38 |
39 |
40 |
41 | Javascript must be enabled for this page to work!
42 |
43 |
44 |
45 |
46 | Drop file here
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
Check out Summit Route for end-point protection.
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
About
64 | IceBuddha is an open-source (MIT license) hex viewer and generic binary file parser that runs in the browser.
65 |
66 | See an example .
67 |
68 |
69 |
Why?
70 | I wanted to test the limits of what was possible in the browser from a static site. Because all the files are static (no database, and no server-side functionality) IceBuddha is hosted on
github pages .
71 |
72 |
Ridiculous things IceBuddha does
73 |
74 | "Submitted" files are not uploaded anywhere. Everything happens in your browser locally.
75 | If you're concerned, you can clone and host this project locally by running it in a simple web server,
76 | such as using "python -m SimpleHTTPServer" in the folder you clone the repo to.
77 | Files are parsed via >Python scripts that define the structure of the files.
78 | The python is converted to Javascript in your browser via the skulpt library.
79 | By clicking on the "Parse as" tab when you drop a file, you can see this Python code.
80 | You can then edit it, and your file will parsed again immediately using your new code.
81 | Again, this is all happening entirely in your browser without hitting the server.
82 | You can take your python parse scripts, and run them directly on files to generate JSON data, without using your browser, as explained here
83 |
84 |
Similar projects/products
85 |
010 editor : Windows & Mac (commercial), odd format for binary templates to parse files, but looks similar to C structs and is often referenced.
86 |
Synalize It! : Mac only (commercial); XML based grammar format which means limited capability for more advanced binary file formats.
87 |
88 |
File parsing
89 | IceBuddha can parse a few of the main structures in the following file types:
90 |
91 | PE files (.exe, .dll, .sys)
92 | GIF image files
93 | Mach-O (Mac OS X files)
94 |
95 |
Expanding and adding your own file parsing
96 | File types are automatically identified in drop.js via the function "ChooseParseScript". Look at
pe.py to see an example of how files are parsed.
97 |
98 | Change the PE in the line ib = icebuddha.IceBuddha(filedata, "PE") to be name of your file type.
99 | The line imageDosHeader = ib.parse(0, "IMAGE_DOS_HEADER", """ creates a structure at offset 0 with name IMAGE_DOS_HEADER.
100 | Then the next lines in that file describe what is in that structure.
101 | Known variable types are:
102 |
103 | BYTE, CHAR, and anything unknown: 1 byte
104 | WORD: 2 bytes
105 | DWORD: 4 bytes
106 | ULONGLONG: 8 bytes
107 |
108 | You can also create arrays such as WORD e_res2[10];
109 | ib is the root object, so we then append imageDosHeader to that. Later we append objects to imageDosHeader
110 | The line e_lfanew = imageDosHeader.getInt("e_lfanew") gets the value of PE.IMAGE_DOS_HEADER.e_lfanew in the file it parses, and sets the variable e_lfanew which is then used as the offset in the next line.
111 | Usually you can specify an offset simply by using something like imageNtHeader.end() to specify the end of the previous object.
112 | To describe a bit field, you can look at what I did for dllCharacteristics.
113 | Finally, you just need to return everything with the lines return ib.getParseTree() and parser = Parse()
114 | You can have loops, other functions, and other logic in your code, as shown in gif.py .
115 | You can also describe what a value means as shown with the function setMeaningFromConstants in the file mach_o.py
116 | You can set the endianness as shown with setBigEndian in the file mach_o.py
117 |
118 |
119 |
120 |
Project status
121 | IceBuddha is mostly abandoned (last update on 2014-11-13). It does a lot of stuff, but a lot of things are impossible for a webapp based on static files (ex. saving files).
122 |
This was my first javascript project. The codebase is not pretty.
123 |
124 |
125 |
126 |
127 |
128 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |