diff --git a/.gitattributes b/.gitattributes index 486a2325..3e80b98a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ *.zip filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index 8b2342e7..6b697b88 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ samples/** dump.bin *.yara *.traits +dump.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..4450283f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs/theme"] + path = docs/theme + url = https://github.com/jothepro/doxygen-awesome-css.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 00bc6159..4d813065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,38 @@ -cmake_minimum_required(VERSION 3.16.3) +cmake_minimum_required(VERSION 3.5) project(binlex) -add_executable(${PROJECT_NAME} main.cpp) +set(SOURCES_BINLEX + src/binlex.cpp + src/args.cpp + src/raw.cpp + src/common.cpp + src/blelf.cpp + src/pe.cpp + src/decompiler.cpp + src/decompiler_rev.cpp +) -target_link_libraries(${PROJECT_NAME} -lcapstone) +add_executable(binlex ${SOURCES_BINLEX}) + +target_link_libraries(binlex -lcapstone -lcrypto -lm) + +target_include_directories(binlex + PRIVATE + ${PROJECT_SOURCE_DIR}/include +) + +project(blyara) + +set(SOURCES_BLYARA + src/blyara.cpp +) + +add_executable(blyara ${SOURCES_BLYARA}) + +target_link_libraries(blyara -lcapstone -lcrypto -lm) + +target_include_directories(blyara + PRIVATE + ${PROJECT_SOURCE_DIR}/include +) diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 00000000..7a50b674 --- /dev/null +++ b/Doxyfile @@ -0,0 +1,385 @@ +# Doxyfile 1.8.17 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = "binlex" +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = +OUTPUT_DIRECTORY = build/docs/ +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = README.md include/ +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.doc \ + *.txt \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice +RECURSIVE = NO +EXCLUDE = include/json.h +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = README.md +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +CLANG_ASSISTED_PARSING = NO +CLANG_OPTIONS = +CLANG_DATABASE_PATH = +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = docs/theme/doxygen-awesome.css +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4 +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_SUBDIR = +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/Makefile b/Makefile index 6e2e1923..4df7ae11 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: docs + threads=1 all: @@ -6,18 +8,28 @@ all: cmake -S ../ -B . && \ make -j ${threads} +docs: + mkdir -p build/docs/ + (cat Doxyfile; echo "NUM_PROC_THREADS=${threads}") | doxygen - + +docs-update: + rm -rf docs/html/ + cp -r build/docs/html/ docs/ + install: cp build/binlex /usr/bin/ + cp build/blyara /usr/bin/ uninstall: rm -f /usr/bin/binlex + rm -f /usr/bin/blyara traits: check-parameter-source check-parameter-dest check-parameter-type check-parameter-format check-parameter-arch @echo "[-] building traits..." @find ${source} -type f | while read i; do \ mkdir -p ${dest}/${type}/${format}/${arch}/; \ filename=`basename $${i}`; \ - echo "binlex -m ${format}:${arch} --input $${i} --output ${dest}/${type}/${format}/${arch}/$${filename}.traits"; \ + echo "binlex -m ${format}:${arch} -i $${i} | jq '.[] | .trait' > ${dest}/${type}/${format}/${arch}/$${filename}.traits"; \ done | parallel -u --progress -j ${threads} {} @echo "[*] trait build complete" diff --git a/README.md b/README.md index fdc75fa9..3baa5f02 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,34 @@ # binlex -

A Genetic Binary Trait Lexer Library and Utility

+

A Genetic Binary Trait Lexer Library and Utility

-The purpose of `binlex` is to extract basic blocks and functions as traits from binaries. +The purpose of `binlex` is to extract basic blocks and functions as traits from binaries for malware research, hunting and detection. -Most projects attempting this use Python to generate traits, but it's slow. When working with a lot of malware binaries, it is much better to use a faster compiled language like C++. +Most projects attempting this use Python to generate traits, but it is very slow. + +The design philophy behind `binlex` is it to keep it simple and extensable. + +The simple command-line interface allows malware researchers and analysts to hunt traits across hundreds or thousands of potentially similar malware saving time and money in production environments. + +While the C++ API allows developers to get creative with their own detection solutions. + +# Introduction Video + +

+ + Introduction Video + +

+ +Get slides [here](docs/oalabs.pdf). # Use Cases - YARA Signature Creation/Automation - Identifying Code-Reuse - Threat Hunting +- Building Goodware Trait Corpus +- Building Malware Trait Corpus +- Genetic Programming - Machine Learning Malware Detection # Installing @@ -17,8 +36,8 @@ Most projects attempting this use Python to generate traits, but it's slow. When **From Source:** ```bash -sudo apt install -y git libcapstone-dev cmake make parallel -git clone https://github.com/c3rb3ru5d3d53c/binlex.git +sudo apt install -y git build-essential libcapstone-dev cmake make parallel doxygen git-lfs +git clone --recursive https://github.com/c3rb3ru5d3d53c/binlex.git cd binlex/ make threads=4 sudo make install @@ -30,15 +49,16 @@ binlex -m elf:x86 -i tests/elf/elf.x86 **NOTE:** - ZIP files in the `tests/` directory can be extracted using the password `infected` -# Usage +# Basic Usage ```text -binlex v1.0.1 - A Binary Genetic Traits Lexer +binlex v1.1.0 - A Binary Genetic Traits Lexer -i --input input file (required) -m --mode set mode (required) -lm --list-modes list modes -h --help display help -o --output output file (optional) + -p --pretty pretty output (optional) -v --version display version Author: @c3rb3ru5d3d53c ``` @@ -51,11 +71,82 @@ Author: @c3rb3ru5d3d53c - `pe:x86_64` - `raw:x86` - `raw:x86_64` -- `raw:cil` +- `raw:cil` (experimental) __NOTE:__ The `raw` formats can be used on shellcode -**Advanced Usage:** +# Advanced Usage + +If you are hunting using `binlex` you can use `jq` to your advantage for advanced searches. + +```bash +binlex -m raw:x86 -i tests/raw/raw.x86 | jq -r '.[] | select(.type == "block" and .size < 32 and .size > 0) | .bytes' +2c 20 c1 cf 0d 01 c7 49 75 ef +52 57 8b 52 10 8b 42 3c 01 d0 8b 40 78 85 c0 74 4c +01 d0 50 8b 58 20 8b 48 18 01 d3 85 c9 74 3c +49 8b 34 8b 01 d6 31 ff 31 c0 c1 cf 0d ac 01 c7 38 e0 75 f4 +03 7d f8 3b 7d 24 75 e0 +58 5f 5a 8b 12 e9 80 ff ff ff +ff 4e 08 75 ec +e8 67 00 00 00 6a 00 6a 04 56 57 68 02 d9 c8 5f ff d5 83 f8 00 7e 36 +e9 9b ff ff ff +01 c3 29 c6 75 c1 +``` + +Other queries you can do: +```bash +# Block traits with a size between 0 and 32 bytes +jq -r '[.[] | select(.type == "block" and .size < 32 and .size > 0)]' +# Function traits with a cyclomatic complexity greater than 32 (maybe obfuscation) +jq -r '[.[] | select(.type == "function" and .cyclomatic_complexity > 32)]' +# Traits where bytes have high entropy +jq -r '[.[] | select(.bytes_entropy > 7)]' +# Output all trait strings only +jq -r '.[] | .trait' +# Output only trait hashes +jq -r '.[] | .trait_sha256' +``` + +If you output just traits you want to `stdout` you can do build a `yara` signature on the fly with the included tool `blyara`: + +```bash +build/binlex -m raw:x86 -i tests/raw/raw.x86 | jq -r '.[] | select(.size > 16 and .size < 32) | .trait' | build/blyara --name example_0 -m author example -m tlp white -c 1 +rule example_0 { + metadata: + author = "example" + tlp = "white" + strings: + trait_0 = {52 57 8b 52 ?? 8b 42 ?? 01 d0 8b 40 ?? 85 c0 74 4c} + trait_1 = {49 8b 34 8b 01 d6 31 ff 31 c0 c1 cf ?? ac 01 c7 38 e0 75 f4} + trait_2 = {e8 67 00 00 00 6a 00 6a ?? 56 57 68 ?? ?? ?? ?? ff d5 83 f8 00 7e 36} + condition: + 1 of them +} +``` + +You can also use the switch `--pretty` to output `json` to identify more properies to query. + +```bash +binlex -m pe:x86 -i tests/pe/pe.trickbot.x86 --pretty +[ + { + "average_instructions_per_block": 29, + "blocks": 1, + "bytes": "ae 32 c3 32 1a 33 25 34 85 39 ae 3b b4 3b c8 3b 35 3c 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f 30 aa 30 01 31 1d 31 ac 31 d6 31 e5 31 f5 31 1c 32 31 32 75 34", + "bytes_entropy": 5.070523738861084, + "bytes_sha256": "67a966fe573ef678feaea6229271bb374304b418fe63f464b71af1fbe2a87f37", + "cyclomatic_complexity": 3, + "edges": 2, + "instructions": 29, + "offset": 11589, + "size": 74, + "trait": "ae 32 c3 32 1a 33 25 ?? ?? ?? ?? 3b b4 3b ?? ?? ?? ?? 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f ?? aa 30 01 31 1d ?? ?? ?? ?? 31 e5 31 f5 31 1c 32 31 32 75 34", + "trait_entropy": 4.9164042472839355, + "trait_sha256": "a00fcb2b23a916192990665d8a5f53b2adfa74ec98991277e571542aee94c3a5", + "type": "block" + } +] +``` If you have terabytes of executable files, we can leverage the power of `parallel` to generate traits for us. @@ -91,18 +182,78 @@ Binlex is designed to do one thing and one thing only, extract genetic traits fr Again, **it's up to you to implement your own algorithms for detection based on the genetic traits you extract**. # Trait Format + Traits will contain binary code represented in hexadecimal form and will use `??` as wild cards for memory operands or other operands subject to change. -Trait files will contain a list of traits ordered by size and use the sha256 of the sample as the file name. +They will also contain additional properties about the trait including its `offset`, `edges`, `blocks`, `cyclomatic_complexity`, `average_instruction_per_block`, `bytes`, `trait`, `trait_sha256`, `bytes_sha256`, `trait_entropy`, `bytes_entropy`, `type`, `size`, and `instructions`. ``` -# Example Trait File -12 34 56 ?? ?? 11 12 13 -14 15 16 17 18 ?? ?? 21 22 23 -# ... More traits to follow +[ + { + "average_instructions_per_block": 29, + "blocks": 1, + "bytes": "ae 32 c3 32 1a 33 25 34 85 39 ae 3b b4 3b c8 3b 35 3c 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f 30 aa 30 01 31 1d 31 ac 31 d6 31 e5 31 f5 31 1c 32 31 32 75 34", + "bytes_entropy": 5.070523738861084, + "bytes_sha256": "67a966fe573ef678feaea6229271bb374304b418fe63f464b71af1fbe2a87f37", + "cyclomatic_complexity": 3, + "edges": 2, + "instructions": 29, + "offset": 11589, + "size": 74, + "trait": "ae 32 c3 32 1a 33 25 ?? ?? ?? ?? 3b b4 3b ?? ?? ?? ?? 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f ?? aa 30 01 31 1d ?? ?? ?? ?? 31 e5 31 f5 31 1c 32 31 32 75 34", + "trait_entropy": 4.9164042472839355, + "trait_sha256": "a00fcb2b23a916192990665d8a5f53b2adfa74ec98991277e571542aee94c3a5", + "type": "block" + } +] ``` +# Building Docs + +You can access the C++ API Documentation and everything else by building the documents using `doxygen`. + +```bash +make docs threads=4 +``` + +The documents will be available at `build/docs/html/index.html`. + +# C++ API Example Code + +It couldn't be any easier to leverage `binlex` and its C++ API to build your own applications. + +See example code below: + +```cpp +#include +#include + +using namespace binlex; + +int main(int argc, char **argv){ + Pe pe32; + if (pe32.Setup(PE_MODE_X86) == false){ + return 1; + } + if (pe32.ReadFile(argv[1]) == false){ + return 1; + } + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_32); + for (int i = 0; i < PE_MAX_SECTIONS; i++){ + if (pe32.sections[i].data != NULL){ + decompiler.x86_64(pe32.sections[i].data, pe32.sections[i].size, pe32.sections[i].offset, i); + } + } + decompiler.PrintTraits(args.options.pretty); +} +``` + +We hope this encourages people to build their own detection solutions based on binary genetic traits. + # Tips +- If you are hunting be sure to use `jq` to improve your searches +- Does not support PE files that are VB6 or .NET if you run against these you will get errors - Don't mix packed and unpacked malware or you will taint your dataset (seen this in academics all the time) - Verify the samples you are collecting into a group using skilled analysts - These traits are best used with a hybrid approach (supervised) @@ -120,9 +271,10 @@ The remaining population of traits will be unique to the malware family tested a This fitness model allows for accurate classification of the tested malware family. # Future Work +- Recursive Decompiler - Java Bytecode Support `raw:jvm`, `java:jvm` - Cutter, Ghidra and IDA Plugins -- .NET PE support `pe:cil` +- .NET support `pe:cil` and `raw:cil` - Mac-O Support `macho:x86_64`, `macho:x86` # Contributing diff --git a/docs/html/annotated.html b/docs/html/annotated.html new file mode 100644 index 00000000..cf342a3a --- /dev/null +++ b/docs/html/annotated.html @@ -0,0 +1,124 @@ + + + + + + + +binlex: Class List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Class List
+
+
+
Here are the classes, structs, unions and interfaces with brief descriptions:
+
+
+ + + + diff --git a/docs/html/annotated_dup.js b/docs/html/annotated_dup.js new file mode 100644 index 00000000..f0ecdec9 --- /dev/null +++ b/docs/html/annotated_dup.js @@ -0,0 +1,4 @@ +var annotated_dup = +[ + [ "binlex", "namespacebinlex.html", "namespacebinlex" ] +]; \ No newline at end of file diff --git a/docs/html/args_8h_source.html b/docs/html/args_8h_source.html new file mode 100644 index 00000000..1a7c5d22 --- /dev/null +++ b/docs/html/args_8h_source.html @@ -0,0 +1,139 @@ + + + + + + + +binlex: include/args.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
args.h
+
+
+
1 #ifndef ARGS_H
+
2 #define ARGS_H
+
3 
+
4 #define ARGS_MODE_COUNT 7
+
5 
+
6 #define ARGS_IO_TYPE_UNKNOWN 0
+
7 #define ARGS_IO_TYPE_FILE 1
+
8 #define ARGS_IO_TYPE_DIR 2
+
9 
+
14 namespace binlex{
+
15  class Args {
+
16  public:
+
17  char version[7] = "v1.1.0";
+
18  const char *modes[ARGS_MODE_COUNT] = {"elf:x86", "elf:x86_64", "pe:x86", "pe:x86_64", "raw:x86", "raw:x86_64", "raw:cil"};
+
19  struct{
+
20  char *input;
+
21  int io_type;
+
22  char *output;
+
23  unsigned int threads;
+
24  bool help;
+
25  bool list_modes;
+
26  char *mode;
+
27  bool pretty;
+
28  } options;
+
29  Args();
+
30  void SetDefault();
+
31  bool check_mode(char *mode);
+
32  int is_file(const char *path);
+
33  int is_dir(const char *path);
+
34  void set_io_type(char *input);
+
35  void print_help();
+
36  void parse(int argc, char **argv);
+
37  ~Args();
+
38  };
+
39 }
+
40 #endif
+
+
+
Definition: args.h:15
+
the binlex namespace
+ + + + diff --git a/docs/html/bc_s.png b/docs/html/bc_s.png new file mode 100644 index 00000000..2eba412e --- /dev/null +++ b/docs/html/bc_s.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e7ed0ef70f99bb7f763a48ddd95d5990e103bb145eedfd0a76d19c122374be2 +size 676 diff --git a/docs/html/bdwn.png b/docs/html/bdwn.png new file mode 100644 index 00000000..42638302 --- /dev/null +++ b/docs/html/bdwn.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:782b30d237bdbeddfde4aed01f007264cc116b2d4be2f398a7cb74ec7a5bc58b +size 147 diff --git a/docs/html/blelf_8h_source.html b/docs/html/blelf_8h_source.html new file mode 100644 index 00000000..e7c9a8a5 --- /dev/null +++ b/docs/html/blelf_8h_source.html @@ -0,0 +1,144 @@ + + + + + + + +binlex: include/blelf.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
blelf.h
+
+
+
1 #include <stdio.h>
+
2 #include <stdlib.h>
+
3 
+
4 #ifndef ELF_H
+
5 #define ELF_H
+
6 
+
7 #define ELF_MAX_SECTIONS 32
+
8 
+
9 #define ELF_MODE_UNSET 0
+
10 #define ELF_MODE_X86 1
+
11 #define ELF_MODE_X86_64 2
+
12 
+
13 namespace binlex{
+
14  class Elf{
+
15  private:
+
16  struct Section {
+
17  uint offset;
+
18  int size;
+
19  void *data;
+
20  };
+
21  bool is_arch(int arch);
+
22  bool is_elf();
+
23  void SetSectionsDefault();
+
24  unsigned int GetSectionTableSize();
+
25  bool ReadSectionHeaders();
+
26  bool GetExecutableData();
+
27  public:
+
28  char magic[4] = {0x7F, 0x45, 0x4C, 0x46};
+
29  FILE *fd = NULL;
+
30  void *header = NULL;
+
31  void *sh_table = NULL;
+
32  char *sh_str = NULL;
+
33  int mode = ELF_MODE_UNSET;
+
34  struct Section sections[ELF_MAX_SECTIONS];
+
35  Elf();
+
36  bool Setup(int input_mode);
+
37  bool ReadFile(char *file_path);
+
38  ~Elf();
+
39  };
+
41 }
+
42 #endif
+
+
+
Definition: blelf.h:14
+
the binlex namespace
+ + + + diff --git a/docs/html/cil_8h_source.html b/docs/html/cil_8h_source.html new file mode 100644 index 00000000..c0a29224 --- /dev/null +++ b/docs/html/cil_8h_source.html @@ -0,0 +1,101 @@ + + + + + + + +binlex: include/cil.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
cil.h
+
+
+
+
+ + + + diff --git a/docs/html/classbinlex_1_1Args-members.html b/docs/html/classbinlex_1_1Args-members.html new file mode 100644 index 00000000..6978e975 --- /dev/null +++ b/docs/html/classbinlex_1_1Args-members.html @@ -0,0 +1,123 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Args Member List
+
+
+ +

This is the complete list of members for binlex::Args, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
Args() (defined in binlex::Args)binlex::Args
check_mode(char *mode) (defined in binlex::Args)binlex::Args
help (defined in binlex::Args)binlex::Args
input (defined in binlex::Args)binlex::Args
io_type (defined in binlex::Args)binlex::Args
is_dir(const char *path) (defined in binlex::Args)binlex::Args
is_file(const char *path) (defined in binlex::Args)binlex::Args
list_modes (defined in binlex::Args)binlex::Args
mode (defined in binlex::Args)binlex::Args
modes (defined in binlex::Args)binlex::Args
options (defined in binlex::Args)binlex::Args
output (defined in binlex::Args)binlex::Args
parse(int argc, char **argv) (defined in binlex::Args)binlex::Args
pretty (defined in binlex::Args)binlex::Args
print_help() (defined in binlex::Args)binlex::Args
set_io_type(char *input) (defined in binlex::Args)binlex::Args
SetDefault() (defined in binlex::Args)binlex::Args
threads (defined in binlex::Args)binlex::Args
version (defined in binlex::Args)binlex::Args
~Args() (defined in binlex::Args)binlex::Args
+
+ + + + diff --git a/docs/html/classbinlex_1_1Args.html b/docs/html/classbinlex_1_1Args.html new file mode 100644 index 00000000..9b3b72d4 --- /dev/null +++ b/docs/html/classbinlex_1_1Args.html @@ -0,0 +1,170 @@ + + + + + + + +binlex: binlex::Args Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Args Class Reference
+
+
+ + + + + + + + + + + + + + + + +

+Public Member Functions

+void SetDefault ()
 
+bool check_mode (char *mode)
 
+int is_file (const char *path)
 
+int is_dir (const char *path)
 
+void set_io_type (char *input)
 
+void print_help ()
 
+void parse (int argc, char **argv)
 
+ + + + + + + + + + + + + + + + + + + + + + + + +

+Public Attributes

+char version [7] = "v1.1.0"
 
+const char * modes [ARGS_MODE_COUNT] = {"elf:x86", "elf:x86_64", "pe:x86", "pe:x86_64", "raw:x86", "raw:x86_64", "raw:cil"}
 
+struct {
+   char *   input
 
+   int   io_type
 
+   char *   output
 
+   unsigned int   threads
 
+   bool   help
 
+   bool   list_modes
 
+   char *   mode
 
+   bool   pretty
 
options
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Args.js b/docs/html/classbinlex_1_1Args.js new file mode 100644 index 00000000..ee6cd9da --- /dev/null +++ b/docs/html/classbinlex_1_1Args.js @@ -0,0 +1,23 @@ +var classbinlex_1_1Args = +[ + [ "Args", "classbinlex_1_1Args.html#a3a4f4b7dc53ca69b61cec9185f86041c", null ], + [ "~Args", "classbinlex_1_1Args.html#ae19970f079be23bfbef4287a86149a38", null ], + [ "check_mode", "classbinlex_1_1Args.html#a117f44a5ac6bf1923ac76859cf005e17", null ], + [ "is_dir", "classbinlex_1_1Args.html#a4d51ca0244f1ee8ed2ccf0b1d04e174c", null ], + [ "is_file", "classbinlex_1_1Args.html#acd538b8b0b1511b5bb948dfadc7ec89a", null ], + [ "parse", "classbinlex_1_1Args.html#a0477e45421fc020c0dd3c589ca3d2651", null ], + [ "print_help", "classbinlex_1_1Args.html#ab5010e9c2bbdc522a628de3f389c9ecc", null ], + [ "set_io_type", "classbinlex_1_1Args.html#a46e29ccab7e771d0df504bd73d07acdc", null ], + [ "SetDefault", "classbinlex_1_1Args.html#ac11a1822921a1f258fe5c3ce56545aad", null ], + [ "help", "classbinlex_1_1Args.html#a2491b08ed8671ee298f81a4bb8a55edc", null ], + [ "input", "classbinlex_1_1Args.html#a58f6c480ae8b6252daa8ab5d9b6424a9", null ], + [ "io_type", "classbinlex_1_1Args.html#a1081246280cb0c7db1996e7ec8ad1a4f", null ], + [ "list_modes", "classbinlex_1_1Args.html#a43a0dfcdb95d728359660a3fc2511bf9", null ], + [ "mode", "classbinlex_1_1Args.html#a27df5d13ba0e523d6fe7c9e7cd3846ae", null ], + [ "modes", "classbinlex_1_1Args.html#a68075815fcdbf18dcbf8ab2060bc14cb", null ], + [ "options", "classbinlex_1_1Args.html#ad7903e030130436a79d5e47dbac90a95", null ], + [ "output", "classbinlex_1_1Args.html#a7e087780eeeda9b14de02c0e271b92af", null ], + [ "pretty", "classbinlex_1_1Args.html#ae3622028422ff83cece80da50842ea14", null ], + [ "threads", "classbinlex_1_1Args.html#a7c7b63377352c20b9badb2fc83014d1e", null ], + [ "version", "classbinlex_1_1Args.html#ac612b207d3378af1b0a30d701091bc8a", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1Common-members.html b/docs/html/classbinlex_1_1Common-members.html new file mode 100644 index 00000000..a631e910 --- /dev/null +++ b/docs/html/classbinlex_1_1Common-members.html @@ -0,0 +1,112 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Common Member List
+
+
+ +

This is the complete list of members for binlex::Common, including all inherited members.

+ + + + + + + + + + +
GetByteSize(string s)binlex::Common
Hexdump(const char *desc, const void *addr, const int len)binlex::Common
HexdumpBE(const void *data, size_t size)binlex::Common
RemoveSpaces(string s)binlex::Common
RemoveWildcards(string trait)binlex::Common
SHA256(const char *trait)binlex::Common
TraitToChar(string trait)binlex::Common
TrimRight(const std::string &s)binlex::Common
WildcardTrait(string trait, string bytes)binlex::Common
+
+ + + + diff --git a/docs/html/classbinlex_1_1Common.html b/docs/html/classbinlex_1_1Common.html new file mode 100644 index 00000000..81baa01c --- /dev/null +++ b/docs/html/classbinlex_1_1Common.html @@ -0,0 +1,394 @@ + + + + + + + +binlex: binlex::Common Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Common Class Reference
+
+
+ + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

string SHA256 (const char *trait)
 
vector< char > TraitToChar (string trait)
 
string RemoveWildcards (string trait)
 
uint GetByteSize (string s)
 
string RemoveSpaces (string s)
 
string WildcardTrait (string trait, string bytes)
 
string TrimRight (const std::string &s)
 
string HexdumpBE (const void *data, size_t size)
 
void Hexdump (const char *desc, const void *addr, const int len)
 
+

Member Function Documentation

+ +

◆ GetByteSize()

+ +
+
+ + + + + + + + +
uint binlex::Common::GetByteSize (string s)
+
+

This method gets the size in bytes of a trait string (includes wildcards).

Parameters
+ + +
traitinput trait string.
+
+
+
Returns
Returns uint size of bytes
+ +
+
+ +

◆ Hexdump()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void binlex::Common::Hexdump (const char * desc,
const void * addr,
const int len 
)
+
+

This method prints hexdump to stdout.

Parameters
+ + + + +
descA description of the data.
dataA pointer to the data
sizeThe size of the data to collect
+
+
+ +
+
+ +

◆ HexdumpBE()

+ +
+
+ + + + + + + + + + + + + + + + + + +
string binlex::Common::HexdumpBE (const void * data,
size_t size 
)
+
+

This method creates a byte string based on a pointer and its size.

Parameters
+ + + +
dataA pointer to the data
sizeThe size of the data to collect
+
+
+
Returns
Returns a byte string of the selected data
+ +
+
+ +

◆ RemoveSpaces()

+ +
+
+ + + + + + + + +
string binlex::Common::RemoveSpaces (string s)
+
+

This method removes spaces from a string.

Parameters
+ + +
sinput string
+
+
+
Returns
Returns string without spaces
+ +
+
+ +

◆ RemoveWildcards()

+ +
+
+ + + + + + + + +
string binlex::Common::RemoveWildcards (string trait)
+
+

This method removes wildcards from a trait string.

Parameters
+ + +
traitinput trait string.
+
+
+
Returns
Returns trait without wildcards
+ +
+
+ +

◆ SHA256()

+ +
+
+ + + + + + + + +
string binlex::Common::SHA256 (const char * trait)
+
+

This class contains methods common to binlex. This method takes an input string and returns its sha256 hash.

Parameters
+ + +
traitinput string.
+
+
+
Returns
Returns the sha256 hash of the trait string
+ +
+
+ +

◆ TraitToChar()

+ +
+
+ + + + + + + + +
vector<char> binlex::Common::TraitToChar (string trait)
+
+

This method takes an input trait string and returns a char vector of bytes (ignores wildcards).

Parameters
+ + +
traitinput string.
+
+
+
Returns
Returns char vector of bytes
+ +
+
+ +

◆ TrimRight()

+ +
+
+ + + + + + + + +
string binlex::Common::TrimRight (const std::string & s)
+
+

This method removes whitespace on the right.

Parameters
+ + +
sinput string
+
+
+
Returns
Returns string with whitespace on right trimmed
+ +
+
+ +

◆ WildcardTrait()

+ +
+
+ + + + + + + + + + + + + + + + + + +
string binlex::Common::WildcardTrait (string trait,
string bytes 
)
+
+

This method wildcards byte strings for traits.

Parameters
+ + + +
traitinput trait string
bytesbyte string to wildcard
+
+
+
Returns
Returns wildcarded trait string
+ +
+
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Common.js b/docs/html/classbinlex_1_1Common.js new file mode 100644 index 00000000..1f5aa147 --- /dev/null +++ b/docs/html/classbinlex_1_1Common.js @@ -0,0 +1,12 @@ +var classbinlex_1_1Common = +[ + [ "GetByteSize", "classbinlex_1_1Common.html#a537f95841cada660f148930c2d4e4f8d", null ], + [ "Hexdump", "classbinlex_1_1Common.html#a8b07ec710b5a4f3c1d83084aec16b9f3", null ], + [ "HexdumpBE", "classbinlex_1_1Common.html#a94c338b55668ea0ebc430b9047fd3742", null ], + [ "RemoveSpaces", "classbinlex_1_1Common.html#a4b271f6ac9e939b8bb1133bab81b3ac1", null ], + [ "RemoveWildcards", "classbinlex_1_1Common.html#ae5c095392a25d1805cfe09d5b9623831", null ], + [ "SHA256", "classbinlex_1_1Common.html#ad8e308be16a7d66383c5ed66deb88329", null ], + [ "TraitToChar", "classbinlex_1_1Common.html#ae31b773b28542c1b5a20e460750d9058", null ], + [ "TrimRight", "classbinlex_1_1Common.html#a12b0c27bc88357bd3027cc0033279cb9", null ], + [ "WildcardTrait", "classbinlex_1_1Common.html#a6869d240d567e4e678a90d31133521ff", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1Decompiler-members.html b/docs/html/classbinlex_1_1Decompiler-members.html new file mode 100644 index 00000000..de6b7112 --- /dev/null +++ b/docs/html/classbinlex_1_1Decompiler-members.html @@ -0,0 +1,113 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Decompiler Member List
+
+
+ +

This is the complete list of members for binlex::Decompiler, including all inherited members.

+ + + + + + + + + + + +
Decompiler() (defined in binlex::Decompiler)binlex::Decompiler
handle (defined in binlex::Decompiler)binlex::Decompiler
pc (defined in binlex::Decompiler)binlex::Decompiler
PrintTraits(bool pretty) (defined in binlex::Decompiler)binlex::Decompiler
sections (defined in binlex::Decompiler)binlex::Decompiler
Setup(cs_arch arch, cs_mode mode) (defined in binlex::Decompiler)binlex::Decompiler
status (defined in binlex::Decompiler)binlex::Decompiler
WriteTraits(char *file_path, bool pretty) (defined in binlex::Decompiler)binlex::Decompiler
x86_64(void *data, size_t data_size, size_t data_offset, uint index) (defined in binlex::Decompiler)binlex::Decompiler
~Decompiler() (defined in binlex::Decompiler)binlex::Decompiler
+
+ + + + diff --git a/docs/html/classbinlex_1_1Decompiler.html b/docs/html/classbinlex_1_1Decompiler.html new file mode 100644 index 00000000..3af60e0a --- /dev/null +++ b/docs/html/classbinlex_1_1Decompiler.html @@ -0,0 +1,140 @@ + + + + + + + +binlex: binlex::Decompiler Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Decompiler Class Reference
+
+
+ + + + + + + + + + +

+Public Member Functions

+bool Setup (cs_arch arch, cs_mode mode)
 
+int x86_64 (void *data, size_t data_size, size_t data_offset, uint index)
 
+void PrintTraits (bool pretty)
 
+void WriteTraits (char *file_path, bool pretty)
 
+ + + + + + + + + +

+Public Attributes

+csh handle
 
+cs_err status
 
+uint64_t pc
 
+struct Section sections [DECOMPILER_MAX_SECTIONS]
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Decompiler.js b/docs/html/classbinlex_1_1Decompiler.js new file mode 100644 index 00000000..3049a2e9 --- /dev/null +++ b/docs/html/classbinlex_1_1Decompiler.js @@ -0,0 +1,13 @@ +var classbinlex_1_1Decompiler = +[ + [ "Decompiler", "classbinlex_1_1Decompiler.html#aed812dca72adccb3b84fa31ce87c94c1", null ], + [ "~Decompiler", "classbinlex_1_1Decompiler.html#a5a145a039eeecf47afa0bb3a53d8ca72", null ], + [ "PrintTraits", "classbinlex_1_1Decompiler.html#a788f80fd44f34f00084375d4669bd443", null ], + [ "Setup", "classbinlex_1_1Decompiler.html#a5a43ceb4ff01dfb4c4718a5f72b70052", null ], + [ "WriteTraits", "classbinlex_1_1Decompiler.html#ac50cdc13964e9a1a40a6d09fd838fde7", null ], + [ "x86_64", "classbinlex_1_1Decompiler.html#a41ce03b9678a55d88cffafe72f8c114c", null ], + [ "handle", "classbinlex_1_1Decompiler.html#ad198fb48689d88b3ad6cfb850bcc0cf7", null ], + [ "pc", "classbinlex_1_1Decompiler.html#aaf6ea37aab0f3dde8d49eed2bdc03007", null ], + [ "sections", "classbinlex_1_1Decompiler.html#afcba0f93a71ab4ce1237bac70a4b43d9", null ], + [ "status", "classbinlex_1_1Decompiler.html#a002652497ee69348093d12967d042104", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1DecompilerREV-members.html b/docs/html/classbinlex_1_1DecompilerREV-members.html new file mode 100644 index 00000000..c4455b8e --- /dev/null +++ b/docs/html/classbinlex_1_1DecompilerREV-members.html @@ -0,0 +1,117 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::DecompilerREV Member List
+
+
+ +

This is the complete list of members for binlex::DecompilerREV, including all inherited members.

+ + + + + + + + + + + + + + + +
AddEdges(uint count, uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
ClearBlock(uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
ClearTrait(uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
CollectBlockTrait(uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
CollectFunctionTrait(uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
common (defined in binlex::DecompilerREV)binlex::DecompilerREV
Decompile(void *data, size_t data_size, size_t data_offset, uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
DecompilerREV() (defined in binlex::DecompilerREV)binlex::DecompilerREV
PrintTraits(bool pretty) (defined in binlex::DecompilerREV)binlex::DecompilerREV
sections (defined in binlex::DecompilerREV)binlex::DecompilerREV
Seek(uint offset, uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
Setup(cs_arch arch, cs_mode mode, uint index) (defined in binlex::DecompilerREV)binlex::DecompilerREV
WriteTraits(char *file_path, bool pretty) (defined in binlex::DecompilerREV)binlex::DecompilerREV
~DecompilerREV() (defined in binlex::DecompilerREV)binlex::DecompilerREV
+
+ + + + diff --git a/docs/html/classbinlex_1_1DecompilerREV.html b/docs/html/classbinlex_1_1DecompilerREV.html new file mode 100644 index 00000000..ebdf5ae4 --- /dev/null +++ b/docs/html/classbinlex_1_1DecompilerREV.html @@ -0,0 +1,157 @@ + + + + + + + +binlex: binlex::DecompilerREV Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::DecompilerREV Class Reference
+
+
+ + + + +

+Classes

struct  Section
 
+ + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+bool Setup (cs_arch arch, cs_mode mode, uint index)
 
+void ClearBlock (uint index)
 
+void ClearTrait (uint index)
 
+void AddEdges (uint count, uint index)
 
+void CollectBlockTrait (uint index)
 
+void CollectFunctionTrait (uint index)
 
+void PrintTraits (bool pretty)
 
+void WriteTraits (char *file_path, bool pretty)
 
+uint Decompile (void *data, size_t data_size, size_t data_offset, uint index)
 
+void Seek (uint offset, uint index)
 
+ + + + + +

+Public Attributes

+struct Section sections [DECOMPILER_REV_MAX_SECTIONS]
 
+Common common
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1DecompilerREV.js b/docs/html/classbinlex_1_1DecompilerREV.js new file mode 100644 index 00000000..4b6e04bb --- /dev/null +++ b/docs/html/classbinlex_1_1DecompilerREV.js @@ -0,0 +1,18 @@ +var classbinlex_1_1DecompilerREV = +[ + [ "Section", "structbinlex_1_1DecompilerREV_1_1Section.html", "structbinlex_1_1DecompilerREV_1_1Section" ], + [ "DecompilerREV", "classbinlex_1_1DecompilerREV.html#aa8086b747b66311885012ec8510c9267", null ], + [ "~DecompilerREV", "classbinlex_1_1DecompilerREV.html#a20a36e0c8f03b7c6da5ea322728f2a4b", null ], + [ "AddEdges", "classbinlex_1_1DecompilerREV.html#a2aa721eaa0678095a7b01991a61a88fc", null ], + [ "ClearBlock", "classbinlex_1_1DecompilerREV.html#a56950fb4fb18c2ee214b7f0111faecce", null ], + [ "ClearTrait", "classbinlex_1_1DecompilerREV.html#ade9a421afc2a3dab639aecd20f3779c1", null ], + [ "CollectBlockTrait", "classbinlex_1_1DecompilerREV.html#a2ddb584ca050864f7398611c52c185d8", null ], + [ "CollectFunctionTrait", "classbinlex_1_1DecompilerREV.html#a6fc531e99c44b4ae776d68c09b0987b4", null ], + [ "Decompile", "classbinlex_1_1DecompilerREV.html#a31aa2f810ffdb42d3c995b90c8f0080b", null ], + [ "PrintTraits", "classbinlex_1_1DecompilerREV.html#a75f68711ec1bffb114e2daf4338002e3", null ], + [ "Seek", "classbinlex_1_1DecompilerREV.html#aee29fe98fcb7ffbb2cd1e8f294269c53", null ], + [ "Setup", "classbinlex_1_1DecompilerREV.html#a4e69a1595d0ec77388d77453e9a63933", null ], + [ "WriteTraits", "classbinlex_1_1DecompilerREV.html#a0023b30826a4b6bb8cb0d728e85c3826", null ], + [ "common", "classbinlex_1_1DecompilerREV.html#a20f28f6dd59e0e41ec3a21fe9af2b204", null ], + [ "sections", "classbinlex_1_1DecompilerREV.html#ac78b03eb2f1796aad3d9ebc150154404", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1Elf-members.html b/docs/html/classbinlex_1_1Elf-members.html new file mode 100644 index 00000000..88eaccd5 --- /dev/null +++ b/docs/html/classbinlex_1_1Elf-members.html @@ -0,0 +1,114 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Elf Member List
+
+
+ +

This is the complete list of members for binlex::Elf, including all inherited members.

+ + + + + + + + + + + + +
Elf() (defined in binlex::Elf)binlex::Elf
fd (defined in binlex::Elf)binlex::Elf
header (defined in binlex::Elf)binlex::Elf
magic (defined in binlex::Elf)binlex::Elf
mode (defined in binlex::Elf)binlex::Elf
ReadFile(char *file_path) (defined in binlex::Elf)binlex::Elf
sections (defined in binlex::Elf)binlex::Elf
Setup(int input_mode) (defined in binlex::Elf)binlex::Elf
sh_str (defined in binlex::Elf)binlex::Elf
sh_table (defined in binlex::Elf)binlex::Elf
~Elf() (defined in binlex::Elf)binlex::Elf
+
+ + + + diff --git a/docs/html/classbinlex_1_1Elf.html b/docs/html/classbinlex_1_1Elf.html new file mode 100644 index 00000000..c99fcd2b --- /dev/null +++ b/docs/html/classbinlex_1_1Elf.html @@ -0,0 +1,143 @@ + + + + + + + +binlex: binlex::Elf Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Elf Class Reference
+
+
+ + + + + + +

+Public Member Functions

+bool Setup (int input_mode)
 
+bool ReadFile (char *file_path)
 
+ + + + + + + + + + + + + + + +

+Public Attributes

+char magic [4] = {0x7F, 0x45, 0x4C, 0x46}
 
+FILE * fd = NULL
 
+void * header = NULL
 
+void * sh_table = NULL
 
+char * sh_str = NULL
 
+int mode = ELF_MODE_UNSET
 
+struct Section sections [ELF_MAX_SECTIONS]
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Elf.js b/docs/html/classbinlex_1_1Elf.js new file mode 100644 index 00000000..0be266c4 --- /dev/null +++ b/docs/html/classbinlex_1_1Elf.js @@ -0,0 +1,14 @@ +var classbinlex_1_1Elf = +[ + [ "Elf", "classbinlex_1_1Elf.html#a2146e544ddc46ec6b2219c74394484e7", null ], + [ "~Elf", "classbinlex_1_1Elf.html#a5fe63863715971ebcbf604de985012ae", null ], + [ "ReadFile", "classbinlex_1_1Elf.html#a7cb21db980b7fae5f7f02f514eab6aa9", null ], + [ "Setup", "classbinlex_1_1Elf.html#a26608a447ea0b1d07dfe7ae152f47742", null ], + [ "fd", "classbinlex_1_1Elf.html#a9586754dd396a490dbea2bcc0c695b43", null ], + [ "header", "classbinlex_1_1Elf.html#abe441563fde6f841022588c7427436ca", null ], + [ "magic", "classbinlex_1_1Elf.html#a7a8232536ad1681dea06e5bb4208ed2f", null ], + [ "mode", "classbinlex_1_1Elf.html#a9d506a8df87f242f4aff0fd022c2605a", null ], + [ "sections", "classbinlex_1_1Elf.html#a9e9f13972ac5ee860e60440a8ade4852", null ], + [ "sh_str", "classbinlex_1_1Elf.html#ae3972e8d3bffc104beb2482d35c96a1c", null ], + [ "sh_table", "classbinlex_1_1Elf.html#a2d43bbdb1479ebf2292c7cf7713716d1", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1Pe-members.html b/docs/html/classbinlex_1_1Pe-members.html new file mode 100644 index 00000000..89e015a1 --- /dev/null +++ b/docs/html/classbinlex_1_1Pe-members.html @@ -0,0 +1,118 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Pe Member List
+
+
+ +

This is the complete list of members for binlex::Pe, including all inherited members.

+ + + + + + + + + + + + + + + + +
coff_header (defined in binlex::Pe)binlex::Pe
dos_header (defined in binlex::Pe)binlex::Pe
fd (defined in binlex::Pe)binlex::Pe
magic_mz (defined in binlex::Pe)binlex::Pe
magic_pe (defined in binlex::Pe)binlex::Pe
mode (defined in binlex::Pe)binlex::Pe
optional_header_32 (defined in binlex::Pe)binlex::Pe
optional_header_64 (defined in binlex::Pe)binlex::Pe
Pe() (defined in binlex::Pe)binlex::Pe
pe_header_ptr (defined in binlex::Pe)binlex::Pe
ReadFile(char *file_path) (defined in binlex::Pe)binlex::Pe
section_header (defined in binlex::Pe)binlex::Pe
sections (defined in binlex::Pe)binlex::Pe
Setup(int input_mode) (defined in binlex::Pe)binlex::Pe
~Pe() (defined in binlex::Pe)binlex::Pe
+
+ + + + diff --git a/docs/html/classbinlex_1_1Pe.html b/docs/html/classbinlex_1_1Pe.html new file mode 100644 index 00000000..689b8d26 --- /dev/null +++ b/docs/html/classbinlex_1_1Pe.html @@ -0,0 +1,155 @@ + + + + + + + +binlex: binlex::Pe Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Pe Class Reference
+
+
+ + + + + + +

+Public Member Functions

+bool Setup (int input_mode)
 
+bool ReadFile (char *file_path)
 
+ + + + + + + + + + + + + + + + + + + + + + + +

+Public Attributes

+char magic_mz [2] = {0x5a, 0x4d}
 
+char magic_pe [4] = {0x00, 0x00, 0x45, 0x50}
 
+FILE * fd = NULL
 
+PIMAGE_DOS_HEADER dos_header = NULL
 
+PIMAGE_COFF_HEADER coff_header = NULL
 
+uint32_t pe_header_ptr = 0
 
+PIMAGE_OPTIONAL_HEADER_32 optional_header_32 = NULL
 
+PIMAGE_OPTIONAL_HEADER_64 optional_header_64 = NULL
 
+PIMAGE_SECTION_HEADER section_header = NULL
 
+int mode = PE_MODE_UNSET
 
+struct Section sections [PE_MAX_SECTIONS]
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Pe.js b/docs/html/classbinlex_1_1Pe.js new file mode 100644 index 00000000..77ffbd42 --- /dev/null +++ b/docs/html/classbinlex_1_1Pe.js @@ -0,0 +1,18 @@ +var classbinlex_1_1Pe = +[ + [ "Pe", "classbinlex_1_1Pe.html#a15c8b638c1ee10bfdf31feee871f58ba", null ], + [ "~Pe", "classbinlex_1_1Pe.html#a740f0ddfc26419b5ebe46f23a949324f", null ], + [ "ReadFile", "classbinlex_1_1Pe.html#ae15629c20c42f3404657be52235cffcf", null ], + [ "Setup", "classbinlex_1_1Pe.html#af47802bbaf2db4954881015f3ce58c69", null ], + [ "coff_header", "classbinlex_1_1Pe.html#a8d747b6fb8131aefa09e554c0a5f2dc0", null ], + [ "dos_header", "classbinlex_1_1Pe.html#ad53de82cd20480f0b5e913b956ad2c6e", null ], + [ "fd", "classbinlex_1_1Pe.html#a710d6d8e4501e78e01aa159a9645acac", null ], + [ "magic_mz", "classbinlex_1_1Pe.html#aedd6e985f881f95c7c4b0d7f069c2e0b", null ], + [ "magic_pe", "classbinlex_1_1Pe.html#a9a0be686f112a7e9ce9410fb2e116784", null ], + [ "mode", "classbinlex_1_1Pe.html#a4da63ad35dd33255f81d7cda295ddf8b", null ], + [ "optional_header_32", "classbinlex_1_1Pe.html#ac23cfa1c8803ed947634a358ad9746de", null ], + [ "optional_header_64", "classbinlex_1_1Pe.html#a4231da813700b18c5fc14d5047f29c24", null ], + [ "pe_header_ptr", "classbinlex_1_1Pe.html#a8d75580d483eb0fe3d2fa428630ad6cd", null ], + [ "section_header", "classbinlex_1_1Pe.html#ad3c4609a64355cf2c52dcdbeb90ac4c5", null ], + [ "sections", "classbinlex_1_1Pe.html#aa64c2c8694c6736ae9fd34a7dfe8afea", null ] +]; \ No newline at end of file diff --git a/docs/html/classbinlex_1_1Raw-members.html b/docs/html/classbinlex_1_1Raw-members.html new file mode 100644 index 00000000..f5ad1ca7 --- /dev/null +++ b/docs/html/classbinlex_1_1Raw-members.html @@ -0,0 +1,107 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex::Raw Member List
+
+
+ +

This is the complete list of members for binlex::Raw, including all inherited members.

+ + + + + +
Raw() (defined in binlex::Raw)binlex::Raw
ReadFile(char *file_path, int section_index) (defined in binlex::Raw)binlex::Raw
sections (defined in binlex::Raw)binlex::Raw
~Raw() (defined in binlex::Raw)binlex::Raw
+
+ + + + diff --git a/docs/html/classbinlex_1_1Raw.html b/docs/html/classbinlex_1_1Raw.html new file mode 100644 index 00000000..2f0c9636 --- /dev/null +++ b/docs/html/classbinlex_1_1Raw.html @@ -0,0 +1,122 @@ + + + + + + + +binlex: binlex::Raw Class Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
binlex::Raw Class Reference
+
+
+ + + + +

+Public Member Functions

+bool ReadFile (char *file_path, int section_index)
 
+ + + +

+Public Attributes

+struct Section sections [RAW_MAX_SECTIONS]
 
+
The documentation for this class was generated from the following file: +
+
+ + + + diff --git a/docs/html/classbinlex_1_1Raw.js b/docs/html/classbinlex_1_1Raw.js new file mode 100644 index 00000000..8fc51c0d --- /dev/null +++ b/docs/html/classbinlex_1_1Raw.js @@ -0,0 +1,7 @@ +var classbinlex_1_1Raw = +[ + [ "Raw", "classbinlex_1_1Raw.html#a915b0beb5ff4072d6a91c16f85490334", null ], + [ "~Raw", "classbinlex_1_1Raw.html#a77114b63f320ff61309c65704525ffe4", null ], + [ "ReadFile", "classbinlex_1_1Raw.html#adc9ab64577800aa7e4de6250e548044e", null ], + [ "sections", "classbinlex_1_1Raw.html#ace9179a89fe617b541c73f0bef3961e6", null ] +]; \ No newline at end of file diff --git a/docs/html/classes.html b/docs/html/classes.html new file mode 100644 index 00000000..bce2412a --- /dev/null +++ b/docs/html/classes.html @@ -0,0 +1,149 @@ + + + + + + + +binlex: Class Index + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
Class Index
+
+
+
a | c | d | e | i | p | r | s
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
  a  
+
DecompilerREV (binlex)   IMAGE_DOS_HEADER (binlex)   IMAGE_SECTION_HEADER (binlex)   
  s  
+
  e  
+
IMAGE_EXPORT_DIRECTORY (binlex)   IMAGE_TLS_DIRECTORY32 (binlex)   
Args (binlex)   IMAGE_FILE_HEADER (binlex)   IMAGE_TLS_DIRECTORY64 (binlex)   DecompilerREV::Section (binlex)   
  c  
+
Elf (binlex)   IMAGE_OPTIONAL_HEADER (binlex)   
  p  
+
  i  
+
IMAGE_OPTIONAL_HEADER_32 (binlex)   
Common (binlex)   IMAGE_OPTIONAL_HEADER_64 (binlex)   Pe (binlex)   
  d  
+
IMAGE_DATA_DIRECTORY (binlex)   IMAGE_ROM_OPTIONAL_HEADER (binlex)   
  r  
+
Decompiler (binlex)   Raw (binlex)   
+
a | c | d | e | i | p | r | s
+
+
+ + + + diff --git a/docs/html/closed.png b/docs/html/closed.png new file mode 100644 index 00000000..7b3198ff --- /dev/null +++ b/docs/html/closed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c98c02adc57337f58c40aae15bbac05a3ccb364e5adb1d610a16452e92f17830 +size 132 diff --git a/docs/html/common_8h_source.html b/docs/html/common_8h_source.html new file mode 100644 index 00000000..064e968e --- /dev/null +++ b/docs/html/common_8h_source.html @@ -0,0 +1,127 @@ + + + + + + + +binlex: include/common.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
common.h
+
+
+
1 #include <iostream>
+
2 #include <vector>
+
3 
+
4 #ifndef COMMON_H
+
5 #define COMMON_H
+
6 
+
7 using namespace std;
+
8 
+
9 namespace binlex {
+
10  class Common{
+
14  public:
+
20  string SHA256(const char *trait);
+
26  vector<char> TraitToChar(string trait);
+
32  string RemoveWildcards(string trait);
+
38  uint GetByteSize(string s);
+
44  string RemoveSpaces(string s);
+
51  string WildcardTrait(string trait, string bytes);
+
57  string TrimRight(const std::string &s);
+
64  string HexdumpBE(const void *data, size_t size);
+
71  void Hexdump(const char * desc, const void * addr, const int len);
+
72  };
+
73 }
+
74 
+
75 #endif
+
+
+
Definition: common.h:10
+
the binlex namespace
+ + + + diff --git a/docs/html/decompiler_8h_source.html b/docs/html/decompiler_8h_source.html new file mode 100644 index 00000000..4cdf7c33 --- /dev/null +++ b/docs/html/decompiler_8h_source.html @@ -0,0 +1,152 @@ + + + + + + + +binlex: include/decompiler.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
decompiler.h
+
+
+
1 #include <vector>
+
2 #include "json.h"
+
3 
+
4 #ifndef DECOMPILER_H
+
5 #define DECOMPILER_H
+
6 
+
7 #define DECOMPILER_TYPE_FUNCS 0
+
8 #define DECOMPILER_TYPE_BLCKS 1
+
9 #define DECOMPILER_TYPE_UNSET 2
+
10 #define DECOMPILER_TYPE_ALL 3
+
11 
+
12 #define DECOMPILER_MAX_SECTIONS 256
+
13 
+
14 using namespace std;
+
15 using json = nlohmann::json;
+
16 
+
17 namespace binlex{
+
18  class Decompiler{
+
19  private:
+
20  struct Section {
+
21  json traits;
+
22  vector<uint64_t> visited;
+
23  };
+
24  string sha256(const char *trait);
+
25  float entropy(string trait);
+
26  vector<char> t2c(string trait);
+
27  string rs(string s);
+
28  string rwc(string s);
+
29  uint trait_size(string s);
+
30  string rtrim(const std::string &s);
+
31  string hexdump_be(const void *data, size_t size, bool cont);
+
32  string hexdump_mem_disp(uint64_t disp);
+
33  string wildcard_bytes(string bytes, string sub_bytes);
+
34  string wildcard_all(string bytes);
+
35  json GetTraits();
+
36  public:
+
37  csh handle;
+
38  cs_err status;
+
39  uint64_t pc;
+
40  struct Section sections[DECOMPILER_MAX_SECTIONS];
+
41  Decompiler();
+
42  bool Setup(cs_arch arch, cs_mode mode);
+
43  int x86_64(void *data, size_t data_size, size_t data_offset, uint index);
+
44  void PrintTraits(bool pretty);
+
45  void WriteTraits(char *file_path, bool pretty);
+
46  ~Decompiler();
+
47  };
+
48 }
+
49 #endif
+
+
+
Definition: decompiler.h:18
+
the binlex namespace
+ + + + diff --git a/docs/html/decompiler__rev_8h_source.html b/docs/html/decompiler__rev_8h_source.html new file mode 100644 index 00000000..85277b9f --- /dev/null +++ b/docs/html/decompiler__rev_8h_source.html @@ -0,0 +1,166 @@ + + + + + + + +binlex: include/decompiler_rev.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
decompiler_rev.h
+
+
+
1 #include <vector>
+
2 #include <capstone/capstone.h>
+
3 #include "common.h"
+
4 
+
5 #ifndef DECOMPILER_REV_H
+
6 #define DECOMPILER_REV_H
+
7 
+
8 #define DECOMPILER_REV_MAX_SECTIONS 256
+
9 
+
10 using namespace std;
+
11 using json = nlohmann::json;
+
12 
+
13 namespace binlex {
+ +
15  private:
+
16  json GetTraits();
+
17  public:
+
18  struct Section {
+
19  csh handle;
+
20  cs_err status;
+
21  json traits;
+
22  uint offset;
+
23  uint64_t pc;
+
24  size_t code_size;
+
25  size_t data_size;
+
26  size_t data_offset;
+
27  void *data;
+
28  const uint8_t *code;
+
29  uint b_edges;
+
30  uint f_edges;
+
31  bool b_end;
+
32  bool f_end;
+
33  uint b_count;
+
34  uint b_insn_count;
+
35  uint f_insn_count;
+
36  string b_trait;
+
37  string b_bytes;
+
38  string f_trait;
+
39  string f_bytes;
+
40  vector<uint64_t> blocks;
+
41  vector<uint64_t> functions;
+
42  vector<uint64_t> visited;
+
43  };
+
44  struct Section sections[DECOMPILER_REV_MAX_SECTIONS];
+
45  Common common;
+
46  DecompilerREV();
+
47  bool Setup(cs_arch arch, cs_mode mode, uint index);
+
48  void ClearBlock(uint index);
+
49  void ClearTrait(uint index);
+
50  void AddEdges(uint count, uint index);
+
51  void CollectBlockTrait(uint index);
+
52  void CollectFunctionTrait(uint index);
+
53  void PrintTraits(bool pretty);
+
54  void WriteTraits(char *file_path, bool pretty);
+
55  uint Decompile(void *data, size_t data_size, size_t data_offset, uint index);
+
56  void Seek(uint offset, uint index);
+
57  ~DecompilerREV();
+
58 
+
59  };
+
60 }
+
61 #endif
+
+
+
Definition: decompiler_rev.h:14
+
Definition: common.h:10
+
Definition: decompiler_rev.h:18
+
the binlex namespace
+ + + + diff --git a/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html new file mode 100644 index 00000000..1d3b26aa --- /dev/null +++ b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html @@ -0,0 +1,101 @@ + + + + + + + +binlex: include Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
include Directory Reference
+
+
+
+
+ + + + diff --git a/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js new file mode 100644 index 00000000..fb1d226e --- /dev/null +++ b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js @@ -0,0 +1,12 @@ +var dir_d44c64559bbebec7f509842c48db8b23 = +[ + [ "args.h", "args_8h_source.html", null ], + [ "blelf.h", "blelf_8h_source.html", null ], + [ "cil.h", "cil_8h_source.html", null ], + [ "common.h", "common_8h_source.html", null ], + [ "decompiler.h", "decompiler_8h_source.html", null ], + [ "decompiler_rev.h", "decompiler__rev_8h_source.html", null ], + [ "jvm.h", "jvm_8h_source.html", null ], + [ "pe.h", "pe_8h_source.html", null ], + [ "raw.h", "raw_8h_source.html", null ] +]; \ No newline at end of file diff --git a/docs/html/doc.png b/docs/html/doc.png new file mode 100644 index 00000000..3b60d92c --- /dev/null +++ b/docs/html/doc.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5cd4cb41607a30d7820cc20ea76b4a3b8f57d3d2b7d102b58c8e13ad95e83aa1 +size 746 diff --git a/docs/html/doxygen-awesome.css b/docs/html/doxygen-awesome.css new file mode 100644 index 00000000..83929e2e --- /dev/null +++ b/docs/html/doxygen-awesome.css @@ -0,0 +1,1505 @@ +/** + +Doxygen Awesome +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +html { + /* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */ + --primary-color: #1779c4; + --primary-dark-color: #00559f; + --primary-light-color: #7aabd6; + --primary-lighter-color: #cae1f1; + --primary-lightest-color: #e9f1f8; + + /* page base colors */ + --page-background-color: white; + --page-foreground-color: #2c3e50; + --page-secondary-foreground-color: #67727e; + + /* color for all separators on the website: hr, borders, ... */ + --separator-color: #dedede; + + /* border radius for all rounded components. Will affect many components, like dropdowns, memitems, codeblocks, ... */ + --border-radius-large: 8px; + --border-radius-small: 4px; + --border-radius-medium: 6px; + + /* default spacings. Most compontest reference these values for spacing, to provide uniform spacing on the page. */ + --spacing-small: 5px; + --spacing-medium: 10px; + --spacing-large: 16px; + + /* default box shadow used for raising an element above the normal content. Used in dropdowns, Searchresult, ... */ + --box-shadow: 0 2px 10px 0 rgba(0,0,0,.1); + + --odd-color: rgba(0,0,0,.03); + + /* font-families. will affect all text on the website + * font-family: the normal font for text, headlines, menus + * font-family-monospace: used for preformatted text in memtitle, code, fragments + */ + --font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif; + --font-family-monospace: source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace; + + /* font sizes */ + --page-font-size: 15.6px; + --navigation-font-size: 14.4px; + --code-font-size: 14.4px; /* affects code, fragment */ + --title-font-size: 22px; + + /* content text properties. These only affect the page content, not the navigation or any other ui elements */ + --content-line-height: 27px; + /* The content is centered and constraint in it's width. To make the content fill the whole page, set the variable to auto.*/ + --content-maxwidth: 1000px; + + /* colors for various content boxes: @warning, @note, @deprecated @bug */ + --warning-color: #fca49b; + --warning-color-dark: #b61825; + --warning-color-darker: #75070f; + --note-color: rgba(255,229,100,.3); + --note-color-dark: #c39900; + --note-color-darker: #8d7400; + --deprecated-color: rgb(214, 216, 224); + --deprecated-color-dark: #5b6269; + --deprecated-color-darker: #43454a; + --bug-color: rgb(246, 208, 178); + --bug-color-dark: #a53a00; + --bug-color-darker: #5b1d00; + --invariant-color: #b7f8d0; + --invariant-color-dark: #00ba44; + --invariant-color-darker: #008622; + + /* blockquote colors */ + --blockquote-background: #f5f5f5; + --blockquote-foreground: #727272; + + /* table colors */ + --tablehead-background: #f1f1f1; + --tablehead-foreground: var(--page-foreground-color); + + /* menu-display: block | none + * Visibility of the top navigation on screens >= 768px. On smaller screen the menu is always visible. + * `GENERATE_TREEVIEW` MUST be enabled! + */ + --menu-display: block; + + --menu-focus-foreground: var(--page-background-color); + --menu-focus-background: var(--primary-color); + --menu-selected-background: rgba(0,0,0,.05); + + + --header-background: var(--page-background-color); + --header-foreground: var(--page-foreground-color); + + /* searchbar colors */ + --searchbar-background: var(--side-nav-background); + --searchbar-foreground: var(--page-foreground-color); + + /* searchbar size + * (`searchbar-width` is only applied on screens >= 768px. + * on smaller screens the searchbar will always fill the entire screen width) */ + --searchbar-height: 33px; + --searchbar-width: 210px; + + /* code block colors */ + --code-background: #f5f5f5; + --code-foreground: var(--page-foreground-color); + + /* fragment colors */ + --fragment-background: #282c34; + --fragment-foreground: #ffffff; + --fragment-keyword: #cc99cd; + --fragment-keywordtype: #ab99cd; + --fragment-keywordflow: #e08000; + --fragment-token: #7ec699; + --fragment-comment: #999999; + --fragment-link: #98c0e3; + --fragment-preprocessor: #65cabe; + --fragment-linenumber-color: #cccccc; + --fragment-linenumber-background: #35393c; + --fragment-linenumber-border: #1f1f1f; + --fragment-lineheight: 20px; + + /* sidebar navigation (treeview) colors */ + --side-nav-background: #fbfbfb; + --side-nav-foreground: var(--page-foreground-color); + --side-nav-arrow-opacity: 0; + --side-nav-arrow-hover-opacity: 0.9; + + /* height of an item in any tree / collapsable table */ + --tree-item-height: 30px; + + --darkmode-toggle-button-icon: '☀️' +} + +@media screen and (max-width: 767px) { + html { + --page-font-size: 16px; + --navigation-font-size: 16px; + --code-font-size: 15px; /* affects code, fragment */ + --title-font-size: 22px; + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #5ca8e2; + --primary-light-color: #4779ac; + --primary-lighter-color: #191e21; + --primary-lightest-color: #191a1c; + + --box-shadow: 0 2px 10px 0 rgba(0,0,0,.35); + + --odd-color: rgba(0,0,0,.1); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #000000; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #1f2022; + --blockquote-foreground: #77848a; + + --warning-color: #b61825; + --warning-color-dark: #510a02; + --warning-color-darker: #f5b1aa; + --note-color: rgb(255, 183, 0); + --note-color-dark: #9f7300; + --note-color-darker: #645b39; + --deprecated-color: rgb(88, 90, 96); + --deprecated-color-dark: #262e37; + --deprecated-color-darker: #a0a5b0; + --bug-color: rgb(248, 113, 0); + --bug-color-dark: #812a00; + --bug-color-darker: #ffd3be; + + --darkmode-toggle-button-icon: '🌛'; + } +} + +/* dark mode variables are defined twice, to support both the dark-mode without and with doxygen-awesome-darkmode-toggle.js */ +html.dark-mode { + color-scheme: dark; + + --primary-color: #1982d2; + --primary-dark-color: #5ca8e2; + --primary-light-color: #4779ac; + --primary-lighter-color: #191e21; + --primary-lightest-color: #191a1c; + + --box-shadow: 0 2px 10px 0 rgba(0,0,0,.35); + + --odd-color: rgba(0,0,0,.1); + + --menu-selected-background: rgba(0,0,0,.4); + + --page-background-color: #1C1D1F; + --page-foreground-color: #d2dbde; + --page-secondary-foreground-color: #859399; + --separator-color: #000000; + --side-nav-background: #252628; + + --code-background: #2a2c2f; + + --tablehead-background: #2a2c2f; + + --blockquote-background: #1f2022; + --blockquote-foreground: #77848a; + + --warning-color: #b61825; + --warning-color-dark: #510a02; + --warning-color-darker: #f5b1aa; + --note-color: rgb(255, 183, 0); + --note-color-dark: #9f7300; + --note-color-darker: #645b39; + --deprecated-color: rgb(88, 90, 96); + --deprecated-color-dark: #262e37; + --deprecated-color-darker: #a0a5b0; + --bug-color: rgb(248, 113, 0); + --bug-color-dark: #812a00; + --bug-color-darker: #ffd3be; + + --darkmode-toggle-button-icon: '🌛'; +} + +body { + color: var(--page-foreground-color); + background-color: var(--page-background-color); + font-size: var(--page-font-size); +} + +body, table, div, p, dl, #nav-tree .label, .title, .sm-dox a, .sm-dox a:hover, .sm-dox a:focus, #projectname, .SelectItem, #MSearchField, .navpath li.navelem a, .navpath li.navelem a:hover { + font-family: var(--font-family); +} + +h1, h2, h3, h4, h5 { + margin-top: .9em; + font-weight: 600; + line-height: initial; +} + +p, div, table, dl { + font-size: var(--page-font-size); +} + +a:link, a:visited, a:hover, a:focus, a:active { + color: var(--primary-color) !important; + font-weight: 500; +} + +/* + Title and top navigation + */ + +#top { + background: var(--header-background); + border-bottom: 1px solid var(--separator-color); +} + +@media screen and (min-width: 768px) { + #top { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + } +} + +#main-nav { + flex-grow: 5; + padding: var(--spacing-small) var(--spacing-medium); +} + +#titlearea { + width: auto; + padding: var(--spacing-medium) var(--spacing-large); + background: none; + color: var(--header-foreground); + border-bottom: none; +} + +@media screen and (max-width: 767px) { + #titlearea { + padding-bottom: var(--spacing-small); + } +} + +#titlearea table tbody tr { + height: auto !important; +} + +#projectname { + font-size: var(--title-font-size); + font-weight: 600; +} + +#projectnumber { + font-family: inherit; + font-size: 60%; +} + +#projectbrief { + font-family: inherit; + font-size: 80%; +} + +#projectlogo { + vertical-align: middle; +} + +#projectlogo img { + max-height: calc(var(--title-font-size) * 2); + margin-right: var(--spacing-small); +} + +.sm-dox, .tabs, .tabs2, .tabs3 { + background: none; + padding: 0; +} + +.tabs, .tabs2, .tabs3 { + border-bottom: 1px solid var(--separator-color); + margin-bottom: -1px; +} + +@media screen and (max-width: 767px) { + .sm-dox a span.sub-arrow { + background: var(--code-background); + } +} + +@media screen and (min-width: 768px) { + .sm-dox li, .tablist li { + display: var(--menu-display); + } + + .sm-dox a span.sub-arrow { + border-color: var(--header-foreground) transparent transparent transparent; + } + + .sm-dox a:hover span.sub-arrow { + border-color: var(--menu-focus-foreground) transparent transparent transparent; + } + + .sm-dox ul a span.sub-arrow { + border-color: transparent transparent transparent var(--page-foreground-color); + } + + .sm-dox ul a:hover span.sub-arrow { + border-color: transparent transparent transparent var(--menu-focus-foreground); + } +} + +.sm-dox ul { + background: var(--page-background-color); + box-shadow: var(--box-shadow); + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium) !important; + padding: var(--spacing-small); + animation: ease-out 150ms slideInMenu; +} + +@keyframes slideInMenu { + from { + opacity: 0; + transform: translate(0px, -2px); + } + + to { + opacity: 1; + transform: translate(0px, 0px); + } +} + +.sm-dox ul a { + color: var(--page-foreground-color) !important; + background: var(--page-background-color); + font-size: var(--navigation-font-size); +} + +.sm-dox>li>ul:after { + border-bottom-color: var(--page-background-color) !important; +} + +.sm-dox>li>ul:before { + border-bottom-color: var(--separator-color) !important; +} + +.sm-dox ul a:hover, .sm-dox ul a:active, .sm-dox ul a:focus { + font-size: var(--navigation-font-size) !important; + color: var(--menu-focus-foreground) !important; + text-shadow: none; + background-color: var(--menu-focus-background); + border-radius: var(--border-radius-small) !important; +} + +.sm-dox a, .sm-dox a:focus, .tablist li, .tablist li a, .tablist li.current a { + text-shadow: none; + background: transparent; + background-image: none !important; + color: var(--header-foreground) !important; + font-weight: normal; + font-size: var(--navigation-font-size); +} + +.sm-dox a:focus { + outline: auto; +} + +.sm-dox a:hover, .sm-dox a:active, .tablist li a:hover { + text-shadow: none; + font-weight: normal; + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; + border-radius: var(--border-radius-small) !important; + font-size: var(--navigation-font-size); +} + +.tablist li.current { + border-radius: var(--border-radius-small); + background: var(--menu-selected-background); +} + +.tablist li { + margin: var(--spacing-small) 0 var(--spacing-small) var(--spacing-small); +} + +.tablist a { + padding: 0 var(--spacing-large); +} + + +/* + Search box + */ + +#MSearchBox { + height: var(--searchbar-height); + background: var(--searchbar-background); + border-radius: var(--searchbar-height); + border: 1px solid var(--separator-color); + overflow: hidden; + width: var(--searchbar-width); + position: relative; + box-shadow: none; + display: block; + margin-top: 0; +} + +.left #MSearchSelect { + left: 0; +} + +.tabs .left #MSearchSelect { + padding-left: 0; +} + +.tabs #MSearchBox { + position: absolute; + right: var(--spacing-medium); +} + +@media screen and (max-width: 767px) { + .tabs #MSearchBox { + position: relative; + right: 0; + margin-left: var(--spacing-medium); + margin-top: 0; + } +} + +#MSearchSelectWindow, #MSearchResultsWindow { + z-index: 9999; +} + +#MSearchBox.MSearchBoxActive { + border-color: var(--primary-color); + box-shadow: inset 0 0 0 1px var(--primary-color); +} + +#main-menu > li:last-child { + margin-right: 0; +} + +@media screen and (max-width: 767px) { + #main-menu > li:last-child { + height: 50px; + } +} + +#MSearchField { + font-size: var(--navigation-font-size); + height: calc(var(--searchbar-height) - 2px); + background: transparent; + width: calc(var(--searchbar-width) - 64px); +} + +.MSearchBoxActive #MSearchField { + color: var(--searchbar-foreground); +} + +#MSearchSelect { + top: calc(calc(var(--searchbar-height) / 2) - 11px); +} + +.left #MSearchSelect { + padding-left: 8px; +} + +#MSearchBox span.left, #MSearchBox span.right { + background: none; +} + +#MSearchBox span.right { + padding-top: calc(calc(var(--searchbar-height) / 2) - 12px); + position: absolute; + right: var(--spacing-small); +} + +.tabs #MSearchBox span.right { + top: calc(calc(var(--searchbar-height) / 2) - 12px); +} + +@keyframes slideInSearchResults { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } +} + +#MSearchResultsWindow { + left: auto !important; + right: var(--spacing-medium); + border-radius: var(--border-radius-large); + border: 1px solid var(--separator-color); + transform: translate(0, 20px); + box-shadow: var(--box-shadow); + animation: ease-out 280ms slideInSearchResults; + background: var(--page-background-color); +} + +iframe#MSearchResults { + margin: 4px; +} + +iframe { + color-scheme: normal; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) iframe#MSearchResults { + filter: invert() hue-rotate(180deg); + } +} + +html.dark-mode iframe#MSearchResults { + filter: invert() hue-rotate(180deg); +} + +#MSearchSelectWindow { + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + box-shadow: var(--box-shadow); + background: var(--page-background-color); +} + +#MSearchSelectWindow a.SelectItem { + font-size: var(--navigation-font-size); + line-height: var(--content-line-height); + margin: 0 var(--spacing-small); + border-radius: var(--border-radius-small); + color: var(--page-foreground-color) !important; + font-weight: normal; +} + +#MSearchSelectWindow a.SelectItem:hover { + background: var(--menu-focus-background); + color: var(--menu-focus-foreground) !important; +} + +@media screen and (max-width: 767px) { + #MSearchBox { + margin-top: var(--spacing-medium); + margin-bottom: var(--spacing-medium); + width: calc(100vw - 30px); + } + + #main-menu > li:last-child { + float: none !important; + } + + #MSearchField { + width: calc(100vw - 110px); + } + + @keyframes slideInSearchResultsMobile { + from { + opacity: 0; + transform: translate(0, 15px); + } + + to { + opacity: 1; + transform: translate(0, 20px); + } + } + + #MSearchResultsWindow { + left: var(--spacing-medium) !important; + right: var(--spacing-medium); + overflow: auto; + transform: translate(0, 20px); + animation: ease-out 280ms slideInSearchResultsMobile; + } + + /* + * Overwrites for fixing the searchbox on mobile in doxygen 1.9.2 + */ + label.main-menu-btn ~ #searchBoxPos1 { + top: 3px !important; + right: 6px !important; + left: 45px; + display: flex; + } + + label.main-menu-btn ~ #searchBoxPos1 > #MSearchBox { + margin-top: 0; + margin-bottom: 0; + flex-grow: 2; + float: left; + } +} + +/* + Tree view + */ + +#side-nav { + padding: 0 !important; + background: var(--side-nav-background); +} + +@media screen and (max-width: 767px) { + #side-nav { + display: none; + } + + #doc-content { + margin-left: 0 !important; + height: auto !important; + padding-bottom: calc(2 * var(--spacing-large)); + } +} + +#nav-tree { + background: transparent; +} + +#nav-tree .label { + font-size: var(--navigation-font-size); +} + +#nav-tree .item { + height: var(--tree-item-height); + line-height: var(--tree-item-height); +} + +#nav-sync { + top: 12px !important; + right: 12px; +} + +#nav-tree .selected { + text-shadow: none; + background-image: none; + background-color: transparent; + box-shadow: inset 4px 0 0 0 var(--primary-color); +} + +#nav-tree a { + color: var(--side-nav-foreground) !important; + font-weight: normal; +} + +#nav-tree a:focus { + outline-style: auto; +} + +#nav-tree .arrow { + opacity: var(--side-nav-arrow-opacity); +} + +.arrow { + color: inherit; + cursor: pointer; + font-size: 45%; + vertical-align: middle; + margin-right: 2px; + font-family: serif; + height: auto; + text-align: right; +} + +#nav-tree div.item:hover .arrow, #nav-tree a:focus .arrow { + opacity: var(--side-nav-arrow-hover-opacity); +} + +#nav-tree .selected a { + color: var(--primary-color) !important; + font-weight: bolder; + font-weight: 600; +} + +.ui-resizable-e { + background: var(--separator-color); + width: 1px; +} + +/* + Contents + */ + +div.header { + border-bottom: 1px solid var(--separator-color); + background-color: var(--page-background-color); + background-image: none; +} + +div.contents, div.header .title, div.header .summary { + max-width: var(--content-maxwidth); +} + +div.contents, div.header .title { + line-height: initial; + margin: calc(var(--spacing-medium) + .2em) auto var(--spacing-medium) auto; +} + +div.header .summary { + margin: var(--spacing-medium) auto 0 auto; +} + +div.headertitle { + padding: 0; +} + +div.header .title { + font-weight: 600; + font-size: 210%; + padding: var(--spacing-medium) var(--spacing-large); + word-break: break-word; +} + +div.header .summary { + width: auto; + display: block; + float: none; + padding: 0 var(--spacing-large); +} + +td.memSeparator { + border-color: var(--separator-color); +} + +.mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background: var(--code-background); +} + +.mdescRight { + color: var(--page-secondary-foreground-color); +} + +span.mlabel { + background: var(--primary-color); + border: none; + padding: 4px 9px; + border-radius: 12px; + margin-right: var(--spacing-medium); +} + +span.mlabel:last-of-type { + margin-right: 2px; +} + +div.contents { + padding: 0 var(--spacing-large); +} + +div.contents p, div.contents li { + line-height: var(--content-line-height); +} + +div.contents div.dyncontent { + margin: var(--spacing-medium) 0; +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) div.contents div.dyncontent img, + html:not(.light-mode) div.contents center img, + html:not(.light-mode) div.contents table img, + html:not(.light-mode) div.contents div.dyncontent iframe, + html:not(.light-mode) div.contents center iframe, + html:not(.light-mode) div.contents table iframe { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode div.contents div.dyncontent img, +html.dark-mode div.contents center img, +html.dark-mode div.contents table img, +html.dark-mode div.contents div.dyncontent iframe, +html.dark-mode div.contents center iframe, +html.dark-mode div.contents table iframe { + filter: hue-rotate(180deg) invert(); +} + +h2.groupheader { + border-bottom: 1px solid var(--separator-color); + color: var(--page-foreground-color); +} + +blockquote { + padding: var(--spacing-small) var(--spacing-medium); + background: var(--blockquote-background); + color: var(--blockquote-foreground); + border-left: 2px solid var(--blockquote-foreground); + margin: 0; +} + +blockquote p { + margin: var(--spacing-small) 0 var(--spacing-medium) 0; +} +.paramname { + font-weight: 600; + color: var(--primary-dark-color); +} + +.glow { + text-shadow: 0 0 15px var(--primary-light-color) !important; +} + +.alphachar a { + color: var(--page-foreground-color); +} + +/* + Table of Contents + */ + +div.toc { + background-color: var(--side-nav-background); + border: 1px solid var(--separator-color); + border-radius: var(--border-radius-medium); + box-shadow: var(--box-shadow); + padding: 0 var(--spacing-large); + margin: 0 0 var(--spacing-medium) var(--spacing-medium); +} + +div.toc h3 { + color: var(--side-nav-foreground); + font-size: var(--navigation-font-size); + margin: var(--spacing-large) 0; +} + +div.toc li { + font-size: var(--navigation-font-size); + padding: 0; + background: none; +} + +div.toc li:before { + content: '↓'; + font-weight: 800; + font-family: var(--font-family); + margin-right: var(--spacing-small); + color: var(--side-nav-foreground); + opacity: .4; +} + +div.toc ul li.level1 { + margin: 0; +} + +div.toc ul li.level2, div.toc ul li.level3 { + margin-top: 0; +} + + +@media screen and (max-width: 767px) { + div.toc { + float: none; + width: auto; + margin: 0 0 var(--spacing-medium) 0; + } +} + +/* + Code & Fragments + */ + +code, div.fragment, pre.fragment { + border-radius: var(--border-radius-small); + border: none; + overflow: hidden; +} + +code { + display: inline; + background: var(--code-background); + color: var(--code-foreground); + padding: 2px 6px; + word-break: break-word; +} + +div.fragment, pre.fragment { + margin: var(--spacing-medium) 0; + padding: 14px 16px; + background: var(--fragment-background); + color: var(--fragment-foreground); + overflow-x: auto; +} + +@media screen and (max-width: 767px) { + div.fragment, pre.fragment { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + + .contents > div.fragment, .textblock > div.fragment, .textblock > pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + border-radius: 0; + } + + .textblock li > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-large)); + } + + .memdoc li > .fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + } + + .memdoc > div.fragment, .memdoc > pre.fragment, dl dd > div.fragment, dl dd pre.fragment { + margin: var(--spacing-medium) calc(0px - var(--spacing-medium)); + border-radius: 0; + } +} + +code, code a, pre.fragment, div.fragment, div.fragment .line, div.fragment span, div.fragment .line a, div.fragment .line span { + font-family: var(--font-family-monospace); + font-size: var(--code-font-size) !important; +} + +div.line:after { + margin-right: var(--spacing-medium); +} + +div.fragment .line, pre.fragment { + white-space: pre; + word-wrap: initial; + line-height: var(--fragment-lineheight); +} + +div.fragment span.keyword { + color: var(--fragment-keyword); +} + +div.fragment span.keywordtype { + color: var(--fragment-keywordtype); +} + +div.fragment span.keywordflow { + color: var(--fragment-keywordflow); +} + +div.fragment span.stringliteral { + color: var(--fragment-token) +} + +div.fragment span.comment { + color: var(--fragment-comment); +} + +div.fragment a.code { + color: var(--fragment-link) !important; +} + +div.fragment span.preprocessor { + color: var(--fragment-preprocessor); +} + +div.fragment span.lineno { + display: inline-block; + width: 27px; + border-right: none; + background: var(--fragment-linenumber-background); + color: var(--fragment-linenumber-color); +} + +div.fragment span.lineno a { + background: none; + color: var(--fragment-link) !important; +} + +div.fragment .line:first-child .lineno { + box-shadow: -999999px 0px 0 999999px var(--fragment-linenumber-background), -999998px 0px 0 999999px var(--fragment-linenumber-border); +} + +/* + dl warning, attention, note, deprecated, bug, ... + */ + +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre { + padding: var(--spacing-medium); + margin: var(--spacing-medium) 0; + color: var(--page-background-color); + overflow: hidden; + margin-left: 0; + border-radius: var(--border-radius-small); +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention { + background: var(--warning-color); + border-left: 8px solid var(--warning-color-dark); + color: var(--warning-color-darker); +} + +dl.warning dt, dl.attention dt { + color: var(--warning-color-dark); +} + +dl.note { + background: var(--note-color); + border-left: 8px solid var(--note-color-dark); + color: var(--note-color-darker); +} + +dl.note dt { + color: var(--note-color-dark); +} + +dl.bug { + background: var(--bug-color); + border-left: 8px solid var(--bug-color-dark); + color: var(--bug-color-darker); +} + +dl.bug dt a { + color: var(--bug-color-dark) !important; +} + +dl.deprecated { + background: var(--deprecated-color); + border-left: 8px solid var(--deprecated-color-dark); + color: var(--deprecated-color-darker); +} + +dl.deprecated dt a { + color: var(--deprecated-color-dark) !important; +} + +dl.section dd, dl.bug dd, dl.deprecated dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre { + background: var(--invariant-color); + border-left: 8px solid var(--invariant-color-dark); + color: var(--invariant-color-darker); +} + +/* + memitem + */ + +div.memdoc, div.memproto, h2.memtitle { + box-shadow: none; + background-image: none; + border: none; +} + +div.memdoc { + padding: 0 var(--spacing-medium); + background: var(--page-background-color); +} + +h2.memtitle, div.memitem { + border: 1px solid var(--separator-color); +} + +div.memproto, h2.memtitle { + background: var(--code-background); + text-shadow: none; +} + +h2.memtitle { + font-weight: 500; + font-family: monospace, fixed; + border-bottom: none; + border-top-left-radius: var(--border-radius-medium); + border-top-right-radius: var(--border-radius-medium); + word-break: break-all; +} + +a:target + h2.memtitle, a:target + h2.memtitle + div.memitem { + border-color: var(--primary-light-color); +} + +a:target + h2.memtitle { + box-shadow: -3px -3px 3px 0 var(--primary-lightest-color), 3px -3px 3px 0 var(--primary-lightest-color); +} + +a:target + h2.memtitle + div.memitem { + box-shadow: 0 0 10px 0 var(--primary-lighter-color); +} + +div.memitem { + border-top-right-radius: var(--border-radius-medium); + border-bottom-right-radius: var(--border-radius-medium); + border-bottom-left-radius: var(--border-radius-medium); + overflow: hidden; + display: block !important; +} + +div.memdoc { + border-radius: 0; +} + +div.memproto { + border-radius: 0 var(--border-radius-small) 0 0; + overflow: auto; + border-bottom: 1px solid var(--separator-color); + padding: var(--spacing-medium); + margin-bottom: -1px; +} + +div.memtitle { + border-top-right-radius: var(--border-radius-medium); + border-top-left-radius: var(--border-radius-medium); +} + +div.memproto table.memname { + font-family: monospace, fixed; + color: var(--page-foreground-color); +} + +table.mlabels, table.mlabels > tbody { + display: block; +} + +td.mlabels-left { + width: auto; +} + +table.mlabels > tbody > tr:first-child { + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.memname, .memitem span.mlabels { + margin: 0 +} + +/* + reflist + */ + +dl.reflist { + box-shadow: var(--box-shadow); + border-radius: var(--border-radius-medium); + border: 1px solid var(--separator-color); + overflow: hidden; + padding: 0; +} + + +dl.reflist dt, dl.reflist dd { + box-shadow: none; + text-shadow: none; + background-image: none; + border: none; + padding: 12px; +} + + +dl.reflist dt { + font-weight: 500; + border-radius: 0; + background: var(--code-background); + border-bottom: 1px solid var(--separator-color); + color: var(--page-foreground-color) +} + + +dl.reflist dd { + background: none; +} + +/* + Table + */ + +table.markdownTable, table.fieldtable { + width: 100%; + border: 1px solid var(--separator-color); + margin: var(--spacing-medium) 0; +} + +table.fieldtable { + box-shadow: none; + border-radius: var(--border-radius-small); +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background: var(--tablehead-background); + color: var(--tablehead-foreground); + font-weight: 600; + font-size: var(--page-font-size); +} + +table.markdownTable td, table.markdownTable th, table.fieldtable dt { + border: 1px solid var(--separator-color); + padding: var(--spacing-small) var(--spacing-medium); +} + +table.fieldtable th { + font-size: var(--page-font-size); + font-weight: 600; + background-image: none; + background-color: var(--tablehead-background); + color: var(--tablehead-foreground); + border-bottom: 1px solid var(--separator-color); +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + border-bottom: 1px solid var(--separator-color); + border-right: 1px solid var(--separator-color); +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid var(--separator-color); +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: var(--primary-light-color); + box-shadow: 0 0 15px var(--primary-lighter-color); +} + +table.memberdecls { + display: block; + overflow-x: auto; + overflow-y: hidden; +} + + +/* + Horizontal Rule + */ + +hr { + margin-top: var(--spacing-large); + margin-bottom: var(--spacing-large); + border-top:1px solid var(--separator-color); +} + +.contents hr { + box-shadow: var(--content-maxwidth) 0 0 0 var(--separator-color), calc(0px - var(--content-maxwidth)) 0 0 0 var(--separator-color); +} + +.contents img, .contents .center, .contents center { + max-width: 100%; + overflow: scroll; +} + +/* + Directories + */ +div.directory { + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + width: auto; +} + +table.directory { + font-family: var(--font-family); + font-size: var(--page-font-size); + font-weight: normal; +} + +.directory td.entry { + padding: var(--spacing-small); + display: flex; + align-items: center; +} + +.directory tr.even { + background-color: var(--odd-color); +} + +.icona { + width: auto; + height: auto; + margin: 0 var(--spacing-small); +} + +.icon { + background: var(--primary-color); + width: 18px; + height: 18px; + line-height: 18px; +} + +.iconfopen, .icondoc, .iconfclosed { + background-position: center; + margin-bottom: 0; +} + +.icondoc { + filter: saturate(0.2); +} + +@media screen and (max-width: 767px) { + div.directory { + margin-left: calc(0px - var(--spacing-medium)); + margin-right: calc(0px - var(--spacing-medium)); + } +} + +@media (prefers-color-scheme: dark) { + html:not(.light-mode) .iconfopen, html:not(.light-mode) .iconfclosed { + filter: hue-rotate(180deg) invert(); + } +} + +html.dark-mode .iconfopen, html.dark-mode .iconfclosed { + filter: hue-rotate(180deg) invert(); +} + +/* + Class list + */ + +.classindex dl.odd { + background: var(--odd-color); + border-radius: var(--border-radius-small); +} + +@media screen and (max-width: 767px) { + .classindex { + margin: 0 calc(0px - var(--spacing-small)); + } +} + +/* + Footer and nav-path + */ + +#nav-path { + margin-bottom: -1px; + width: 100%; +} + +#nav-path ul { + background-image: none; + background: var(--page-background-color); + border: none; + border-top: 1px solid var(--separator-color); + border-bottom: 1px solid var(--separator-color); + font-size: var(--navigation-font-size); +} + +img.footer { + width: 60px; +} + +.navpath li.footer { + color: var(--page-secondary-foreground-color); +} + +address.footer { + margin-bottom: var(--spacing-large); +} + +#nav-path li.navelem { + background-image: none; + display: flex; + align-items: center; +} + +.navpath li.navelem a { + text-shadow: none; + display: inline-block; + color: var(--primary-color) !important; +} + +.navpath li.navelem b { + color: var(--primary-dark-color); + font-weight: 500; +} + +li.navelem { + padding: 0; + margin-left: -8px; +} + +li.navelem:first-child { + margin-left: var(--spacing-large); +} + +li.navelem:first-child:before { + display: none; +} + +#nav-path li.navelem:after { + content: ''; + border: 5px solid var(--page-background-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: scaleY(4.2); + z-index: 10; + margin-left: 6px; +} + +#nav-path li.navelem:before { + content: ''; + border: 5px solid var(--separator-color); + border-bottom-color: transparent; + border-right-color: transparent; + border-top-color: transparent; + transform: scaleY(3.2); + margin-right: var(--spacing-small); +} + +.navpath li.navelem a:hover { + color: var(--primary-color); +} + +/* + Optional Dark mode toggle button +*/ + +doxygen-awesome-dark-mode-toggle { + display: inline-block; + margin: 0 0 0 var(--spacing-small); + padding: 0; + width: var(--searchbar-height); + height: var(--searchbar-height); + background: none; + border: none; + font-size: 23px; + border-radius: var(--border-radius-medium); + vertical-align: middle; + text-align: center; + line-height: var(--searchbar-height); +} + +doxygen-awesome-dark-mode-toggle:hover { + background: var(--separator-color); +} + +doxygen-awesome-dark-mode-toggle:after { + content: var(--darkmode-toggle-button-icon) +} diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css new file mode 100644 index 00000000..73ecbb2c --- /dev/null +++ b/docs/html/doxygen.css @@ -0,0 +1,1771 @@ +/* The standard CSS for doxygen 1.8.17 */ + +body, table, div, p, dl { + font: 400 14px/22px Roboto,sans-serif; +} + +p.reference, p.definition { + font: 400 14px/22px Roboto,sans-serif; +} + +/* @group Heading Levels */ + +h1.groupheader { + font-size: 150%; +} + +.title { + font: 400 14px/28px Roboto,sans-serif; + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + +dt { + font-weight: bold; +} + +ul.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +th p.starttd, p.intertd, p.endtd { + font-size: 100%; + font-weight: 700; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +p.interli { +} + +p.interdd { +} + +p.intertd { +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #FFFFFF; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #FFFFFF; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited, a.line, a.line:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +ul { + overflow: hidden; /*Fixed: list item bullets overlap floating elements*/ +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/ + overflow-y: hidden; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; +} + +div.fragment { + padding: 0 0 1px 0; /*Fixed: last line underline overlap border*/ + margin: 4px 8px 4px 2px; + background-color: #FBFCFD; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.ah, span.ah { + background-color: black; + font-weight: bold; + color: #FFFFFF; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000 110%); +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl, img.inline { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +blockquote.DocNodeRTL { + border-left: 0; + border-right: 2px solid #9CAFD4; + margin: 0 4px 0 24px; + padding: 0 16px 0 12px; +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight, .memTemplItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; + font-size: 80%; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-image: url('nav_f.png'); + background-repeat: repeat-x; + background-color: #E2E8F2; + line-height: 1.25; + font-weight: 300; + float:left; +} + +.permalink +{ + font-size: 65%; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; +} + +.memname { + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + background-color: #DFE5F1; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + +} + +.overload { + font-family: "courier new",courier,monospace; + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 10px 2px 10px; + background-color: #FBFCFD; + border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; + /* opera specific markup */ + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} +.paramname code { + line-height: 14px; +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype, .tparams .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir, .tparams .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; +} + +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; +} + +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + /*width: 100%;*/ + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + background-position: 0 -5px; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +.PageDocRTL-title div.headertitle { + text-align: right; + direction: rtl; +} + +dl { + padding: 0 0 0 0; +} + +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug, dl.examples */ +dl.section { + margin-left: 0px; + padding-left: 0px; +} + +dl.section.DocNodeRTL { + margin-right: 0px; + padding-right: 0px; +} + +dl.note { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #D0C000; +} + +dl.note.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #D0C000; +} + +dl.warning, dl.attention { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #FF0000; +} + +dl.warning.DocNodeRTL, dl.attention.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00D000; +} + +dl.pre.DocNodeRTL, dl.post.DocNodeRTL, dl.invariant.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00D000; +} + +dl.deprecated { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #505050; +} + +dl.deprecated.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #505050; +} + +dl.todo { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #00C0E0; +} + +dl.todo.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #00C0E0; +} + +dl.test { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #3030E0; +} + +dl.test.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #3030E0; +} + +dl.bug { + margin-left: -7px; + padding-left: 3px; + border-left: 4px solid; + border-color: #C08050; +} + +dl.bug.DocNodeRTL { + margin-left: 0; + padding-left: 0; + border-left: 0; + margin-right: -7px; + padding-right: 3px; + border-right: 4px solid; + border-color: #C08050; +} + +dl.section dd { + margin-bottom: 6px; +} + + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +.PageDocRTL-title div.toc { + float: left !important; + text-align: right; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +.PageDocRTL-title div.toc li { + background-position-x: right !important; + padding-left: 0 !important; + padding-right: 10px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.PageDocRTL-title div.toc li.level1 { + margin-left: 0 !important; + margin-right: 0; +} + +.PageDocRTL-title div.toc li.level2 { + margin-left: 0 !important; + margin-right: 15px; +} + +.PageDocRTL-title div.toc li.level3 { + margin-left: 0 !important; + margin-right: 30px; +} + +.PageDocRTL-title div.toc li.level4 { + margin-left: 0 !important; + margin-right: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + white-space: nowrap; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #FFFFFF; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #FFFFFF; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +/* +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTableHead tr { +} + +table.markdownTableBodyLeft td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft { + text-align: left +} + +th.markdownTableHeadRight { + text-align: right +} + +th.markdownTableHeadCenter { + text-align: center +} +*/ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + +.DocNodeRTL { + text-align: right; + direction: rtl; +} + +.DocNodeLTR { + text-align: left; + direction: ltr; +} + +table.DocNodeRTL { + width: auto; + margin-right: 0; + margin-left: auto; +} + +table.DocNodeLTR { + width: auto; + margin-right: auto; + margin-left: 0; +} + +tt, code, kbd, samp +{ + display: inline-block; + direction:ltr; +} +/* @end */ + +u { + text-decoration: underline; +} + diff --git a/docs/html/doxygen.png b/docs/html/doxygen.png new file mode 100644 index 00000000..1a1ed58f --- /dev/null +++ b/docs/html/doxygen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6973a2aae66bbb99f2b57f2ef160182825fa5305444511ca1eca4e1b0b38528b +size 3779 diff --git a/docs/html/dynsections.js b/docs/html/dynsections.js new file mode 100644 index 00000000..ea0a7b39 --- /dev/null +++ b/docs/html/dynsections.js @@ -0,0 +1,120 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l + + + + + + +binlex: File List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
File List
+
+
+
Here is a list of all documented files with brief descriptions:
+
[detail level 12]
+ + + + + + + + + + +
  include
 args.h
 blelf.h
 cil.h
 common.h
 decompiler.h
 decompiler_rev.h
 jvm.h
 pe.h
 raw.h
+
+
+
+ + + + diff --git a/docs/html/files_dup.js b/docs/html/files_dup.js new file mode 100644 index 00000000..f1749d90 --- /dev/null +++ b/docs/html/files_dup.js @@ -0,0 +1,4 @@ +var files_dup = +[ + [ "include", "dir_d44c64559bbebec7f509842c48db8b23.html", "dir_d44c64559bbebec7f509842c48db8b23" ] +]; \ No newline at end of file diff --git a/docs/html/folderclosed.png b/docs/html/folderclosed.png new file mode 100644 index 00000000..0e8458af --- /dev/null +++ b/docs/html/folderclosed.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6ca13a1c87edcfbfc91317896452c31a9d49c4768f1b4b46ac32e0907e00a73 +size 616 diff --git a/docs/html/folderopen.png b/docs/html/folderopen.png new file mode 100644 index 00000000..cc10730f --- /dev/null +++ b/docs/html/folderopen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:680166339ff62595dd2d2eed3a79fb9fa0c2e8250e89539f6d678aa2e5e51e26 +size 597 diff --git a/docs/html/functions.html b/docs/html/functions.html new file mode 100644 index 00000000..ef0d0cdc --- /dev/null +++ b/docs/html/functions.html @@ -0,0 +1,125 @@ + + + + + + + +binlex: Class Members + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
Here is a list of all documented class members with links to the class documentation for each member:
+
+
+ + + + diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html new file mode 100644 index 00000000..6cab3a12 --- /dev/null +++ b/docs/html/functions_func.html @@ -0,0 +1,125 @@ + + + + + + + +binlex: Class Members - Functions + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ + + + diff --git a/docs/html/index.html b/docs/html/index.html new file mode 100644 index 00000000..ee4dc9d5 --- /dev/null +++ b/docs/html/index.html @@ -0,0 +1,318 @@ + + + + + + + +binlex: binlex + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
binlex
+
+
+

A Genetic Binary Trait Lexer Library and Utility

+

The purpose of binlex is to extract basic blocks and functions as traits from binaries for malware research, hunting and detection.

+

Most projects attempting this use Python to generate traits, but it is very slow.

+

The design philophy behind binlex is it to keep it simple and extensable.

+

The simple command-line interface allows malware researchers and analysts to hunt traits across hundreds or thousands of potentially similar malware saving time and money in production environments.

+

While the C++ API allows developers to get creative with their own detection solutions.

+

+Introduction Video

+

Introduction Video

+

Get slides here.

+

+Use Cases

+
    +
  • YARA Signature Creation/Automation
  • +
  • Identifying Code-Reuse
  • +
  • Threat Hunting
  • +
  • Building Goodware Trait Corpus
  • +
  • Building Malware Trait Corpus
  • +
  • Genetic Programming
  • +
  • Machine Learning Malware Detection
  • +
+

+Installing

+

From Source:

+
sudo apt install -y git build-essential libcapstone-dev cmake make parallel doxygen git-lfs
+
git clone --recursive https://github.com/c3rb3ru5d3d53c/binlex.git
+
cd binlex/
+
make threads=4
+
sudo make install
+
binlex -m elf:x86 -i tests/elf/elf.x86
+

Binary Release: See the releases page.

+

NOTE:

    +
  • ZIP files in the tests/ directory can be extracted using the password infected
  • +
+

+Basic Usage

+
binlex v1.1.0 - A Binary Genetic Traits Lexer
+
-i --input input file (required)
+
-m --mode set mode (required)
+
-lm --list-modes list modes
+
-h --help display help
+
-o --output output file (optional)
+
-p --pretty pretty output (optional)
+
-v --version display version
+
Author: @c3rb3ru5d3d53c
+

Currently Supported Modes

+
    +
  • elf:x86
  • +
  • elf:x86_64
  • +
  • pe:x86
  • +
  • pe:x86_64
  • +
  • raw:x86
  • +
  • raw:x86_64
  • +
  • raw:cil (experimental)
  • +
+

NOTE: The raw formats can be used on shellcode

+

+Advanced Usage

+

If you are hunting using binlex you can use jq to your advantage for advanced searches.

+
binlex -m raw:x86 -i tests/raw/raw.x86 | jq -r '.[] | select(.type == "block" and .size < 32 and .size > 0) | .bytes'
+
2c 20 c1 cf 0d 01 c7 49 75 ef
+
52 57 8b 52 10 8b 42 3c 01 d0 8b 40 78 85 c0 74 4c
+
01 d0 50 8b 58 20 8b 48 18 01 d3 85 c9 74 3c
+
49 8b 34 8b 01 d6 31 ff 31 c0 c1 cf 0d ac 01 c7 38 e0 75 f4
+
03 7d f8 3b 7d 24 75 e0
+
58 5f 5a 8b 12 e9 80 ff ff ff
+
ff 4e 08 75 ec
+
e8 67 00 00 00 6a 00 6a 04 56 57 68 02 d9 c8 5f ff d5 83 f8 00 7e 36
+
e9 9b ff ff ff
+
01 c3 29 c6 75 c1
+

Other queries you can do:

# Block traits with a size between 0 and 32 bytes
+
jq -r '[.[] | select(.type == "block" and .size < 32 and .size > 0)]'
+
# Function traits with a cyclomatic complexity greater than 32 (maybe obfuscation)
+
jq -r '[.[] | select(.type == "function" and .cyclomatic_complexity > 32)]'
+
# Traits where bytes have high entropy
+
jq -r '[.[] | select(.bytes_entropy > 7)]'
+
# Output all trait strings only
+
jq -r '.[] | .trait'
+
# Output only trait hashes
+
jq -r '.[] | .trait_sha256'
+

If you output just traits you want to stdout you can do build a yara signature on the fly with the included tool blyara:

+
build/binlex -m raw:x86 -i tests/raw/raw.x86 | jq -r '.[] | select(.size > 16 and .size < 32) | .trait' | build/blyara --name example_0 -m author example -m tlp white -c 1
+
rule example_0 {
+
metadata:
+
author = "example"
+
tlp = "white"
+
strings:
+
trait_0 = {52 57 8b 52 ?? 8b 42 ?? 01 d0 8b 40 ?? 85 c0 74 4c}
+
trait_1 = {49 8b 34 8b 01 d6 31 ff 31 c0 c1 cf ?? ac 01 c7 38 e0 75 f4}
+
trait_2 = {e8 67 00 00 00 6a 00 6a ?? 56 57 68 ?? ?? ?? ?? ff d5 83 f8 00 7e 36}
+
condition:
+
1 of them
+
}
+

You can also use the switch --pretty to output json to identify more properies to query.

+
binlex -m pe:x86 -i tests/pe/pe.trickbot.x86 --pretty
+
[
+
{
+
"average_instructions_per_block": 29,
+
"blocks": 1,
+
"bytes": "ae 32 c3 32 1a 33 25 34 85 39 ae 3b b4 3b c8 3b 35 3c 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f 30 aa 30 01 31 1d 31 ac 31 d6 31 e5 31 f5 31 1c 32 31 32 75 34",
+
"bytes_entropy": 5.070523738861084,
+
"bytes_sha256": "67a966fe573ef678feaea6229271bb374304b418fe63f464b71af1fbe2a87f37",
+
"cyclomatic_complexity": 3,
+
"edges": 2,
+
"instructions": 29,
+
"offset": 11589,
+
"size": 74,
+
"trait": "ae 32 c3 32 1a 33 25 ?? ?? ?? ?? 3b b4 3b ?? ?? ?? ?? 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f ?? aa 30 01 31 1d ?? ?? ?? ?? 31 e5 31 f5 31 1c 32 31 32 75 34",
+
"trait_entropy": 4.9164042472839355,
+
"trait_sha256": "a00fcb2b23a916192990665d8a5f53b2adfa74ec98991277e571542aee94c3a5",
+
"type": "block"
+
}
+
]
+

If you have terabytes of executable files, we can leverage the power of parallel to generate traits for us.

+
make traits source=samples/malware/pe/x32/ dest=dist/ type=malware format=pe arch=x86 threads=4
+
make traits-combine source=dist/ dest=dist/ type=malware format=pe arch=x86 threads=4
+

It also allows you to name your type of dataset, i.e. goodware/malware/riskware/pua etc...

+

With binlex it is up to you to remove goodware traits from your extracted traits.

+

There have been many questions about removing "library code", there is a make target shown below to help you with this.

+
make traits-clean remove=goodware.traits source=sample.traits dest=malware.traits
+

With binlex the power is in your hands, "With great power comes great responsibility", it is up to you!

+

Plugins:

+

There has been some interest in making IDA, Ghidra and Cutter plugins for binlex.

+

This is something that will be started soon.

+

This README.md will be updated when they are ready to use.

+

General Usage Information:

+

Binlex is designed to do one thing and one thing only, extract genetic traits from executable code in files. This means it is up to you "the researcher" / "the data scientist" to determine which traits are good and which traits are bad. To accomplish this, you need to use your own fitness function. I encourage you to read about genetic programming to gain a better understanding of this in practice. Perhaps watching this introductory video will help your understanding.

+

Again, it's up to you to implement your own algorithms for detection based on the genetic traits you extract.

+

+Trait Format

+

Traits will contain binary code represented in hexadecimal form and will use ?? as wild cards for memory operands or other operands subject to change.

+

They will also contain additional properties about the trait including its offset, edges, blocks, cyclomatic_complexity, average_instruction_per_block, bytes, trait, trait_sha256, bytes_sha256, trait_entropy, bytes_entropy, type, size, and instructions.

+
[
+
{
+
"average_instructions_per_block": 29,
+
"blocks": 1,
+
"bytes": "ae 32 c3 32 1a 33 25 34 85 39 ae 3b b4 3b c8 3b 35 3c 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f 30 aa 30 01 31 1d 31 ac 31 d6 31 e5 31 f5 31 1c 32 31 32 75 34",
+
"bytes_entropy": 5.070523738861084,
+
"bytes_sha256": "67a966fe573ef678feaea6229271bb374304b418fe63f464b71af1fbe2a87f37",
+
"cyclomatic_complexity": 3,
+
"edges": 2,
+
"instructions": 29,
+
"offset": 11589,
+
"size": 74,
+
"trait": "ae 32 c3 32 1a 33 25 ?? ?? ?? ?? 3b b4 3b ?? ?? ?? ?? 3a 3c 6b 3c 71 3c 85 3c aa 3d b0 3d 6a 3e a5 3e b8 3e fd 3e 38 3f 4b 3f 87 3f 00 20 00 00 58 00 00 00 4f ?? aa 30 01 31 1d ?? ?? ?? ?? 31 e5 31 f5 31 1c 32 31 32 75 34",
+
"trait_entropy": 4.9164042472839355,
+
"trait_sha256": "a00fcb2b23a916192990665d8a5f53b2adfa74ec98991277e571542aee94c3a5",
+
"type": "block"
+
}
+
]
+

+Building Docs

+

You can access the C++ API Documentation and everything else by building the documents using doxygen.

+
make docs threads=4
+

The documents will be available at build/docs/html/index.html.

+

+C++ API Example Code

+

It couldn't be any easier to leverage binlex and its C++ API to build your own applications.

+

See example code below:

+
#include <binlex/pe.h>
+
#include <binlex/decompiler.h>
+
+
using namespace binlex;
+
+
int main(int argc, char **argv){
+
Pe pe32;
+
if (pe32.Setup(PE_MODE_X86) == false){
+
return 1;
+
}
+
if (pe32.ReadFile(argv[1]) == false){
+
return 1;
+
}
+
Decompiler decompiler;
+
decompiler.Setup(CS_ARCH_X86, CS_MODE_32);
+
for (int i = 0; i < PE_MAX_SECTIONS; i++){
+
if (pe32.sections[i].data != NULL){
+
decompiler.x86_64(pe32.sections[i].data, pe32.sections[i].size, pe32.sections[i].offset, i);
+
}
+
}
+
decompiler.PrintTraits(args.options.pretty);
+
}
+

We hope this encourages people to build their own detection solutions based on binary genetic traits.

+

+Tips

+
    +
  • If you are hunting be sure to use jq to improve your searches
  • +
  • Does not support PE files that are VB6 or .NET if you run against these you will get errors
  • +
  • Don't mix packed and unpacked malware or you will taint your dataset (seen this in academics all the time)
  • +
  • Verify the samples you are collecting into a group using skilled analysts
  • +
  • These traits are best used with a hybrid approach (supervised)
  • +
+

+Example Fitness Model

+

Traits will be compared amongst their common malware family, any traits not common to all samples will be discarded.

+

Once completed, all remaining traits will be compared to traits from a goodware set, any traits that match the goodware set will be discarded.

+

To further differ the traits from other malware families, the remaining population will be compared to other malware families, any that match will be discarded.

+

The remaining population of traits will be unique to the malware family tested and not legitimate binaries or other malware families.

+

This fitness model allows for accurate classification of the tested malware family.

+

+Future Work

+
    +
  • Recursive Decompiler
  • +
  • Java Bytecode Support raw:jvm, java:jvm
  • +
  • Cutter, Ghidra and IDA Plugins
  • +
  • .NET support pe:cil and raw:cil
  • +
  • Mac-O Support macho:x86_64, macho:x86
  • +
+

+Contributing

+

If you wish to contribute to Binlex DM me on Twitter https://twitter.com/c3rb3ru5d3d53c.

+

Currently looking for help on:

    +
  • MacOS Developer (Parse Mach-O)
  • +
  • Plugin Developers (Python)
  • +
+
+
+
+
Definition: decompiler.h:18
+
Definition: pe.h:409
+
the binlex namespace
+ + + + diff --git a/docs/html/jquery.js b/docs/html/jquery.js new file mode 100644 index 00000000..103c32d7 --- /dev/null +++ b/docs/html/jquery.js @@ -0,0 +1,35 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element +},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** + * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler + * Licensed under MIT + * @author Ariel Flesler + * @version 2.1.2 + */ +;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 + * http://www.smartmenus.org/ + * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); \ No newline at end of file diff --git a/docs/html/jvm_8h_source.html b/docs/html/jvm_8h_source.html new file mode 100644 index 00000000..631d46d7 --- /dev/null +++ b/docs/html/jvm_8h_source.html @@ -0,0 +1,101 @@ + + + + + + + +binlex: include/jvm.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
binlex +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
jvm.h
+
+
+
+
+ + + + diff --git a/docs/html/menu.js b/docs/html/menu.js new file mode 100644 index 00000000..433c15b8 --- /dev/null +++ b/docs/html/menu.js @@ -0,0 +1,50 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+=''; + } + return result; + } + + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchEnabled) { + if (serverSide) { + $('#main-menu').append('
  • '); + } else { + $('#main-menu').append('
  • '); + } + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/docs/html/menudata.js b/docs/html/menudata.js new file mode 100644 index 00000000..53bfd52f --- /dev/null +++ b/docs/html/menudata.js @@ -0,0 +1,34 @@ +/* +@licstart The following is the entire license notice for the +JavaScript code in this file. + +Copyright (C) 1997-2019 by Dimitri van Heesch + +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as published by +the Free Software Foundation + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +@licend The above is the entire license notice +for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Namespaces",url:"namespaces.html",children:[ +{text:"Namespace List",url:"namespaces.html"}]}, +{text:"Classes",url:"annotated.html",children:[ +{text:"Class List",url:"annotated.html"}, +{text:"Class Index",url:"classes.html"}, +{text:"Class Members",url:"functions.html",children:[ +{text:"All",url:"functions.html"}, +{text:"Functions",url:"functions_func.html"}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}]}]} diff --git a/docs/html/namespacebinlex.html b/docs/html/namespacebinlex.html new file mode 100644 index 00000000..babcfa76 --- /dev/null +++ b/docs/html/namespacebinlex.html @@ -0,0 +1,357 @@ + + + + + + + +binlex: binlex Namespace Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex Namespace Reference
    +
    +
    + +

    the binlex namespace +More...

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Classes

    class  Args
     
    class  Common
     
    class  Decompiler
     
    class  DecompilerREV
     
    class  Elf
     
    struct  IMAGE_DATA_DIRECTORY
     
    struct  IMAGE_DOS_HEADER
     
    struct  IMAGE_EXPORT_DIRECTORY
     
    struct  IMAGE_FILE_HEADER
     
    struct  IMAGE_OPTIONAL_HEADER
     
    struct  IMAGE_OPTIONAL_HEADER_32
     
    struct  IMAGE_OPTIONAL_HEADER_64
     
    struct  IMAGE_ROM_OPTIONAL_HEADER
     
    struct  IMAGE_SECTION_HEADER
     
    struct  IMAGE_TLS_DIRECTORY32
     
    struct  IMAGE_TLS_DIRECTORY64
     
    class  Pe
     
    class  Raw
     
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Typedefs

    +typedef struct binlex::IMAGE_EXPORT_DIRECTORYPIMAGE_EXPORT_DIRECTORY
     
    +typedef struct binlex::IMAGE_TLS_DIRECTORY32PIMAGE_TLS_DIRECTORY32
     
    +typedef struct binlex::IMAGE_TLS_DIRECTORY64PIMAGE_TLS_DIRECTORY64
     
    +typedef struct binlex::IMAGE_DATA_DIRECTORYPIMAGE_DATA_DIRECTORY
     
    +typedef struct binlex::IMAGE_FILE_HEADER IMAGE_COFF_HEADER
     
    +typedef struct binlex::IMAGE_FILE_HEADERPIMAGE_FILE_HEADER
     
    +typedef struct binlex::IMAGE_FILE_HEADERPIMAGE_COFF_HEADER
     
    +typedef struct binlex::IMAGE_DOS_HEADERPIMAGE_DOS_HEADER
     
    +typedef struct binlex::IMAGE_ROM_OPTIONAL_HEADERPIMAGE_ROM_OPTIONAL_HEADER
     
    +typedef struct binlex::IMAGE_OPTIONAL_HEADER_32PIMAGE_OPTIONAL_HEADER_32
     
    +typedef struct binlex::IMAGE_OPTIONAL_HEADER_64PIMAGE_OPTIONAL_HEADER_64
     
    +typedef struct binlex::IMAGE_OPTIONAL_HEADERPIMAGE_OPTIONAL_HEADER
     
    +typedef struct binlex::IMAGE_SECTION_HEADERPIMAGE_SECTION_HEADER
     
    + + + + + + + + + + + + + + + +

    +Enumerations

    enum  ImageDirectoryEntry {
    +  IMAGE_DIRECTORY_ENTRY_EXPORT = 0, +IMAGE_DIRECTORY_ENTRY_IMPORT = 1, +IMAGE_DIRECTORY_ENTRY_RESOURCE = 2, +IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3, +
    +  IMAGE_DIRECTORY_ENTRY_SECURITY = 4, +IMAGE_DIRECTORY_ENTRY_BASERELOC = 5, +IMAGE_DIRECTORY_ENTRY_DEBUG = 6, +IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7, +
    +  IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8, +IMAGE_DIRECTORY_ENTRY_TLS = 9, +IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10, +IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11, +
    +  IMAGE_DIRECTORY_ENTRY_IAT = 12, +IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13, +IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14, +IMAGE_DIRECTORY_RESERVED = 15 +
    + }
     
    enum  MachineType {
    +  IMAGE_FILE_MACHINE_UNKNOWN = 0x0, +IMAGE_FILE_MACHINE_AM33 = 0x1d3, +IMAGE_FILE_MACHINE_AMD64 = 0x8664, +IMAGE_FILE_MACHINE_ARM = 0x1c0, +
    +  IMAGE_FILE_MACHINE_ARMV7 = 0x1c4, +IMAGE_FILE_MACHINE_CEE = 0xc0ee, +IMAGE_FILE_MACHINE_EBC = 0xebc, +IMAGE_FILE_MACHINE_I386 = 0x14c, +
    +  IMAGE_FILE_MACHINE_IA64 = 0x200, +IMAGE_FILE_MACHINE_M32R = 0x9041, +IMAGE_FILE_MACHINE_MIPS16 = 0x266, +IMAGE_FILE_MACHINE_MIPSFPU = 0x366, +
    +  IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466, +IMAGE_FILE_MACHINE_POWERPC = 0x1f0, +IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1, +IMAGE_FILE_MACHINE_R4000 = 0x166, +
    +  IMAGE_FILE_MACHINE_SH3 = 0x1a2, +IMAGE_FILE_MACHINE_SH3DSP = 0x1a3, +IMAGE_FILE_MACHINE_SH4 = 0x1a6, +IMAGE_FILE_MACHINE_SH5 = 0x1a8, +
    +  IMAGE_FILE_MACHINE_THUMB = 0x1c2, +IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169 +
    + }
     
    enum  ImageCharacteristics {
    +  IMAGE_FILE_RELOCS_STRIPPED = 0x0001, +IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002, +IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004, +IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008, +
    +  IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010, +IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020, +IMAGE_FILE_RESERVED = 0x0040, +IMAGE_FILE_BYTES_REVERSED_LO = 0x0080, +
    +  IMAGE_FILE_32BIT_MACHINE = 0x0100, +IMAGE_FILE_DEBUG_STRIPPED = 0x0200, +IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400, +IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800, +
    +  IMAGE_FILE_SYSTEM = 0x1000, +IMAGE_FILE_DLL = 0x2000, +IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000, +IMAGE_FILE_BYTES_REVERSED_HI = 0x8000 +
    + }
     
    enum  WindowsSubsystem {
    +  IMAGE_SUBSYSTEM_UNKNOWN = 0, +IMAGE_SUBSYSTEM_NATIVE = 1, +IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, +IMAGE_SUBSYSTEM_WINDOWS_CUI = 3, +
    +  IMAGE_SUBSYSTEM_OS2_CUI = 5, +IMAGE_SUBSYSTEM_POSIX_CUI = 7, +IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9, +IMAGE_SUBSYSTEM_EFI_APPLICATION = 10, +
    +  IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, +IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, +IMAGE_SUBSYSTEM_EFI_ROM = 13, +IMAGE_SUBSYSTEM_XBOX = 14, +
    +  IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 +
    + }
     
    enum  ImageDllCharacteristics {
    +  IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0x0040, +IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0x0080, +IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0x0100, +IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200, +
    +  IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400, +IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800, +IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000, +IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000 +
    + }
     
    enum  opt_type_e { MAGIC_ROM = 0x107, +MAGIC_PE32 = 0x10b, +MAGIC_PE64 = 0x20b + }
     
    enum  SectionCharacteristics {
    +  IMAGE_SCN_TYPE_NO_PAD = 0x00000008, +IMAGE_SCN_CNT_CODE = 0x00000020, +IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040, +IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080, +
    +  IMAGE_SCN_LNK_OTHER = 0x00000100, +IMAGE_SCN_LNK_INFO = 0x00000200, +IMAGE_SCN_LNK_REMOVE = 0x00000800, +IMAGE_SCN_LNK_COMDAT = 0x00001000, +
    +  IMAGE_SCN_NO_DEFER_SPEC_EXC = 0x00004000, +IMAGE_SCN_GPREL = 0x00008000, +IMAGE_SCN_MEM_PURGEABLE = 0x00020000, +IMAGE_SCN_MEM_LOCKED = 0x00040000, +
    +  IMAGE_SCN_MEM_PRELOAD = 0x00080000, +IMAGE_SCN_ALIGN_1BYTES = 0x00100000, +IMAGE_SCN_ALIGN_2BYTES = 0x00200000, +IMAGE_SCN_ALIGN_4BYTES = 0x00300000, +
    +  IMAGE_SCN_ALIGN_8BYTES = 0x00400000, +IMAGE_SCN_ALIGN_16BYTES = 0x00500000, +IMAGE_SCN_ALIGN_32BYTES = 0x00600000, +IMAGE_SCN_ALIGN_64BYTES = 0x00700000, +
    +  IMAGE_SCN_ALIGN_128BYTES = 0x00800000, +IMAGE_SCN_ALIGN_256BYTES = 0x00900000, +IMAGE_SCN_ALIGN_512BYTES = 0x00A00000, +IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000, +
    +  IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000, +IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000, +IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000, +IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000, +
    +  IMAGE_SCN_MEM_DISCARDABLE = 0x02000000, +IMAGE_SCN_MEM_NOT_CACHED = 0x04000000, +IMAGE_SCN_MEM_NOT_PAGED = 0x08000000, +IMAGE_SCN_MEM_SHARED = 0x10000000, +
    +  IMAGE_SCN_MEM_EXECUTE = 0x20000000, +IMAGE_SCN_MEM_READ = 0x40000000, +IMAGE_SCN_MEM_WRITE = -2147483648 +
    + }
     
    +

    Detailed Description

    +

    the binlex namespace

    +
    +
    + + + + diff --git a/docs/html/namespacebinlex.js b/docs/html/namespacebinlex.js new file mode 100644 index 00000000..e177ad7f --- /dev/null +++ b/docs/html/namespacebinlex.js @@ -0,0 +1,21 @@ +var namespacebinlex = +[ + [ "Args", "classbinlex_1_1Args.html", "classbinlex_1_1Args" ], + [ "Common", "classbinlex_1_1Common.html", "classbinlex_1_1Common" ], + [ "Decompiler", "classbinlex_1_1Decompiler.html", "classbinlex_1_1Decompiler" ], + [ "DecompilerREV", "classbinlex_1_1DecompilerREV.html", "classbinlex_1_1DecompilerREV" ], + [ "Elf", "classbinlex_1_1Elf.html", "classbinlex_1_1Elf" ], + [ "IMAGE_DATA_DIRECTORY", "structbinlex_1_1IMAGE__DATA__DIRECTORY.html", "structbinlex_1_1IMAGE__DATA__DIRECTORY" ], + [ "IMAGE_DOS_HEADER", "structbinlex_1_1IMAGE__DOS__HEADER.html", "structbinlex_1_1IMAGE__DOS__HEADER" ], + [ "IMAGE_EXPORT_DIRECTORY", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY" ], + [ "IMAGE_FILE_HEADER", "structbinlex_1_1IMAGE__FILE__HEADER.html", "structbinlex_1_1IMAGE__FILE__HEADER" ], + [ "IMAGE_OPTIONAL_HEADER", "structbinlex_1_1IMAGE__OPTIONAL__HEADER.html", "structbinlex_1_1IMAGE__OPTIONAL__HEADER" ], + [ "IMAGE_OPTIONAL_HEADER_32", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32" ], + [ "IMAGE_OPTIONAL_HEADER_64", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64" ], + [ "IMAGE_ROM_OPTIONAL_HEADER", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER" ], + [ "IMAGE_SECTION_HEADER", "structbinlex_1_1IMAGE__SECTION__HEADER.html", "structbinlex_1_1IMAGE__SECTION__HEADER" ], + [ "IMAGE_TLS_DIRECTORY32", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html", "structbinlex_1_1IMAGE__TLS__DIRECTORY32" ], + [ "IMAGE_TLS_DIRECTORY64", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html", "structbinlex_1_1IMAGE__TLS__DIRECTORY64" ], + [ "Pe", "classbinlex_1_1Pe.html", "classbinlex_1_1Pe" ], + [ "Raw", "classbinlex_1_1Raw.html", "classbinlex_1_1Raw" ] +]; \ No newline at end of file diff --git a/docs/html/namespaces.html b/docs/html/namespaces.html new file mode 100644 index 00000000..6d16d116 --- /dev/null +++ b/docs/html/namespaces.html @@ -0,0 +1,105 @@ + + + + + + + +binlex: Namespace List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    Namespace List
    +
    +
    +
    Here is a list of all documented namespaces with brief descriptions:
    + + +
     NbinlexBinlex namespace
    +
    +
    +
    + + + + diff --git a/docs/html/namespaces_dup.js b/docs/html/namespaces_dup.js new file mode 100644 index 00000000..0cf80e3e --- /dev/null +++ b/docs/html/namespaces_dup.js @@ -0,0 +1,4 @@ +var namespaces_dup = +[ + [ "binlex", "namespacebinlex.html", null ] +]; \ No newline at end of file diff --git a/docs/html/nav_f.png b/docs/html/nav_f.png new file mode 100644 index 00000000..4b24ffcb --- /dev/null +++ b/docs/html/nav_f.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bdc6a72666e1b300fdfc5ecf102714c9fd57df76fdf47139f8dbf8ae5986364 +size 153 diff --git a/docs/html/nav_g.png b/docs/html/nav_g.png new file mode 100644 index 00000000..34942a13 --- /dev/null +++ b/docs/html/nav_g.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3171164c16baa5953c17821a7ce5feac673c05a56b287453ce3a0bf5048f0999 +size 95 diff --git a/docs/html/nav_h.png b/docs/html/nav_h.png new file mode 100644 index 00000000..5e2fe5d1 --- /dev/null +++ b/docs/html/nav_h.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7711604d6cdeaf3cdfd661fa21fc5bf18de929671c801f00415eaecd35abda3 +size 98 diff --git a/docs/html/navtree.css b/docs/html/navtree.css new file mode 100644 index 00000000..33341a67 --- /dev/null +++ b/docs/html/navtree.css @@ -0,0 +1,146 @@ +#nav-tree .children_ul { + margin:0; + padding:4px; +} + +#nav-tree ul { + list-style:none outside none; + margin:0px; + padding:0px; +} + +#nav-tree li { + white-space:nowrap; + margin:0px; + padding:0px; +} + +#nav-tree .plus { + margin:0px; +} + +#nav-tree .selected { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +#nav-tree img { + margin:0px; + padding:0px; + border:0px; + vertical-align: middle; +} + +#nav-tree a { + text-decoration:none; + padding:0px; + margin:0px; + outline:none; +} + +#nav-tree .label { + margin:0px; + padding:0px; + font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; +} + +#nav-tree .label a { + padding:2px; +} + +#nav-tree .selected a { + text-decoration:none; + color:#fff; +} + +#nav-tree .children_ul { + margin:0px; + padding:0px; +} + +#nav-tree .item { + margin:0px; + padding:0px; +} + +#nav-tree { + padding: 0px 0px; + background-color: #FAFAFF; + font-size:14px; + overflow:auto; +} + +#doc-content { + overflow:auto; + display:block; + padding:0px; + margin:0px; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +#side-nav { + padding:0 6px 0 0; + margin: 0px; + display:block; + position: absolute; + left: 0px; + width: 250px; +} + +.ui-resizable .ui-resizable-handle { + display:block; +} + +.ui-resizable-e { + background-image:url("splitbar.png"); + background-size:100%; + background-repeat:repeat-y; + background-attachment: scroll; + cursor:ew-resize; + height:100%; + right:0; + top:0; + width:6px; +} + +.ui-resizable-handle { + display:none; + font-size:0.1px; + position:absolute; + z-index:1; +} + +#nav-tree-contents { + margin: 6px 0px 0px 0px; +} + +#nav-tree { + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +#nav-sync { + position:absolute; + top:5px; + right:24px; + z-index:0; +} + +#nav-sync img { + opacity:0.3; +} + +#nav-sync img:hover { + opacity:0.9; +} + +@media print +{ + #nav-tree { display: none; } + div.ui-resizable-handle { display: none; position: relative; } +} + diff --git a/docs/html/navtree.js b/docs/html/navtree.js new file mode 100644 index 00000000..edc31efc --- /dev/null +++ b/docs/html/navtree.js @@ -0,0 +1,544 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2019 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +var navTreeSubIndices = new Array(); +var arrowDown = '▼'; +var arrowRight = '►'; + +function getData(varName) +{ + var i = varName.lastIndexOf('/'); + var n = i>=0 ? varName.substring(i+1) : varName; + return eval(n.replace(/\-/g,'_')); +} + +function stripPath(uri) +{ + return uri.substring(uri.lastIndexOf('/')+1); +} + +function stripPath2(uri) +{ + var i = uri.lastIndexOf('/'); + var s = uri.substring(i+1); + var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); + return m ? uri.substring(i-6) : s; +} + +function hashValue() +{ + return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); +} + +function hashUrl() +{ + return '#'+hashValue(); +} + +function pathName() +{ + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); +} + +function localStorageSupported() +{ + try { + return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; + } + catch(e) { + return false; + } +} + +function storeLink(link) +{ + if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { + window.localStorage.setItem('navpath',link); + } +} + +function deleteLink() +{ + if (localStorageSupported()) { + window.localStorage.setItem('navpath',''); + } +} + +function cachedLink() +{ + if (localStorageSupported()) { + return window.localStorage.getItem('navpath'); + } else { + return ''; + } +} + +function getScript(scriptName,func,show) +{ + var head = document.getElementsByTagName("head")[0]; + var script = document.createElement('script'); + script.id = scriptName; + script.type = 'text/javascript'; + script.onload = func; + script.src = scriptName+'.js'; + head.appendChild(script); +} + +function createIndent(o,domNode,node,level) +{ + var level=-1; + var n = node; + while (n.parentNode) { level++; n=n.parentNode; } + if (node.childrenData) { + var imgNode = document.createElement("span"); + imgNode.className = 'arrow'; + imgNode.style.paddingLeft=(16*level).toString()+'px'; + imgNode.innerHTML=arrowRight; + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() { + if (node.expanded) { + $(node.getChildrenUL()).slideUp("fast"); + node.plus_img.innerHTML=arrowRight; + node.expanded = false; + } else { + expandNode(o, node, false, false); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } else { + var span = document.createElement("span"); + span.className = 'arrow'; + span.style.width = 16*(level+1)+'px'; + span.innerHTML = ' '; + domNode.appendChild(span); + } +} + +var animationInProgress = false; + +function gotoAnchor(anchor,aname,updateLocation) +{ + var pos, docContent = $('#doc-content'); + var ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || + ancParent.hasClass('memtitle') || + ancParent.hasClass('fieldname') || + ancParent.hasClass('fieldtype') || + ancParent.is(':header')) + { + pos = ancParent.position().top; + } else if (anchor.position()) { + pos = anchor.position().top; + } + if (pos) { + var dist = Math.abs(Math.min( + pos-docContent.offset().top, + docContent[0].scrollHeight- + docContent.height()-docContent.scrollTop())); + animationInProgress=true; + docContent.animate({ + scrollTop: pos + docContent.scrollTop() - docContent.offset().top + },Math.max(50,Math.min(500,dist)),function(){ + if (updateLocation) window.location.href=aname; + animationInProgress=false; + }); + } +} + +function newNode(o, po, text, link, childrenData, lastNode) +{ + var node = new Object(); + node.children = Array(); + node.childrenData = childrenData; + node.depth = po.depth + 1; + node.relpath = po.relpath; + node.isLast = lastNode; + + node.li = document.createElement("li"); + po.getChildrenUL().appendChild(node.li); + node.parentNode = po; + + node.itemDiv = document.createElement("div"); + node.itemDiv.className = "item"; + + node.labelSpan = document.createElement("span"); + node.labelSpan.className = "label"; + + createIndent(o,node.itemDiv,node,0); + node.itemDiv.appendChild(node.labelSpan); + node.li.appendChild(node.itemDiv); + + var a = document.createElement("a"); + node.labelSpan.appendChild(a); + node.label = document.createTextNode(text); + node.expanded = false; + a.appendChild(node.label); + if (link) { + var url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + link = url; + } else { + url = node.relpath+link; + } + a.className = stripPath(link.replace('#',':')); + if (link.indexOf('#')!=-1) { + var aname = '#'+link.split('#')[1]; + var srcPage = stripPath(pathName()); + var targetPage = stripPath(link.split('#')[0]); + a.href = srcPage!=targetPage ? url : "javascript:void(0)"; + a.onclick = function(){ + storeLink(link); + if (!$(a).parent().parent().hasClass('selected')) + { + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + $(a).parent().parent().addClass('selected'); + $(a).parent().parent().attr('id','selected'); + } + var anchor = $(aname); + gotoAnchor(anchor,aname,true); + }; + } else { + a.href = url; + a.onclick = function() { storeLink(link); } + } + } else { + if (childrenData != null) + { + a.className = "nolink"; + a.href = "javascript:void(0)"; + a.onclick = node.expandToggle.onclick; + } + } + + node.childrenUL = null; + node.getChildrenUL = function() { + if (!node.childrenUL) { + node.childrenUL = document.createElement("ul"); + node.childrenUL.className = "children_ul"; + node.childrenUL.style.display = "none"; + node.li.appendChild(node.childrenUL); + } + return node.childrenUL; + }; + + return node; +} + +function showRoot() +{ + var headerHeight = $("#top").height(); + var footerHeight = $("#nav-path").height(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + (function (){ // retry until we can scroll to the selected item + try { + var navtree=$('#nav-tree'); + navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); + } catch (err) { + setTimeout(arguments.callee, 0); + } + })(); +} + +function expandNode(o, node, imm, showRoot) +{ + if (node.childrenData && !node.expanded) { + if (typeof(node.childrenData)==='string') { + var varName = node.childrenData; + getScript(node.relpath+varName,function(){ + node.childrenData = getData(varName); + expandNode(o, node, imm, showRoot); + }, showRoot); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).slideDown("fast"); + node.plus_img.innerHTML = arrowDown; + node.expanded = true; + } + } +} + +function glowEffect(n,duration) +{ + n.addClass('glow').delay(duration).queue(function(next){ + $(this).removeClass('glow');next(); + }); +} + +function highlightAnchor() +{ + var aname = hashUrl(); + var anchor = $(aname); + if (anchor.parent().attr('class')=='memItemLeft'){ + var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); + glowEffect(rows.children(),300); // member without details + } else if (anchor.parent().attr('class')=='fieldname'){ + glowEffect(anchor.parent().parent(),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldtype'){ + glowEffect(anchor.parent().parent(),1000); // struct field + } else if (anchor.parent().is(":header")) { + glowEffect(anchor.parent(),1000); // section header + } else { + glowEffect(anchor.next(),1000); // normal member + } +} + +function selectAndHighlight(hash,n) +{ + var a; + if (hash) { + var link=stripPath(pathName())+':'+hash.substring(1); + a=$('.item a[class$="'+link+'"]'); + } + if (a && a.length) { + a.parent().parent().addClass('selected'); + a.parent().parent().attr('id','selected'); + highlightAnchor(); + } else if (n) { + $(n.itemDiv).addClass('selected'); + $(n.itemDiv).attr('id','selected'); + } + if ($('#nav-tree-contents .item:first').hasClass('selected')) { + $('#nav-sync').css('top','30px'); + } else { + $('#nav-sync').css('top','5px'); + } + showRoot(); +} + +function showNode(o, node, index, hash) +{ + if (node && node.childrenData) { + if (typeof(node.childrenData)==='string') { + var varName = node.childrenData; + getScript(node.relpath+varName,function(){ + node.childrenData = getData(varName); + showNode(o,node,index,hash); + },true); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).css({'display':'block'}); + node.plus_img.innerHTML = arrowDown; + node.expanded = true; + var n = node.children[o.breadcrumbs[index]]; + if (index+11) hash = '#'+parts[1].replace(/[^\w\-]/g,''); + else hash=''; + } + if (hash.match(/^#l\d+$/)) { + var anchor=$('a[name='+hash.substring(1)+']'); + glowEffect(anchor.parent(),1000); // line number + hash=''; // strip line number anchors + } + var url=root+hash; + var i=-1; + while (NAVTREEINDEX[i+1]<=url) i++; + if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath) + } else { + getScript(relpath+'navtreeindex'+i,function(){ + navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath); + } + },true); + } +} + +function showSyncOff(n,relpath) +{ + n.html(''); +} + +function showSyncOn(n,relpath) +{ + n.html(''); +} + +function toggleSyncButton(relpath) +{ + var navSync = $('#nav-sync'); + if (navSync.hasClass('sync')) { + navSync.removeClass('sync'); + showSyncOff(navSync,relpath); + storeLink(stripPath2(pathName())+hashUrl()); + } else { + navSync.addClass('sync'); + showSyncOn(navSync,relpath); + deleteLink(); + } +} + +var loadTriggered = false; +var readyTriggered = false; +var loadObject,loadToRoot,loadUrl,loadRelPath; + +$(window).on('load',function(){ + if (readyTriggered) { // ready first + navTo(loadObject,loadToRoot,loadUrl,loadRelPath); + showRoot(); + } + loadTriggered=true; +}); + +function initNavTree(toroot,relpath) +{ + var o = new Object(); + o.toroot = toroot; + o.node = new Object(); + o.node.li = document.getElementById("nav-tree-contents"); + o.node.childrenData = NAVTREE; + o.node.children = new Array(); + o.node.childrenUL = document.createElement("ul"); + o.node.getChildrenUL = function() { return o.node.childrenUL; }; + o.node.li.appendChild(o.node.childrenUL); + o.node.depth = 0; + o.node.relpath = relpath; + o.node.expanded = false; + o.node.isLast = true; + o.node.plus_img = document.createElement("span"); + o.node.plus_img.className = 'arrow'; + o.node.plus_img.innerHTML = arrowRight; + + if (localStorageSupported()) { + var navSync = $('#nav-sync'); + if (cachedLink()) { + showSyncOff(navSync,relpath); + navSync.removeClass('sync'); + } else { + showSyncOn(navSync,relpath); + } + navSync.click(function(){ toggleSyncButton(relpath); }); + } + + if (loadTriggered) { // load before ready + navTo(o,toroot,hashUrl(),relpath); + showRoot(); + } else { // ready before load + loadObject = o; + loadToRoot = toroot; + loadUrl = hashUrl(); + loadRelPath = relpath; + readyTriggered=true; + } + + $(window).bind('hashchange', function(){ + if (window.location.hash && window.location.hash.length>1){ + var a; + if ($(location).attr('hash')){ + var clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/ + + + + + + +binlex: include/pe.h Source File + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    pe.h
    +
    +
    +
    1 #include <stdio.h>
    +
    2 #include <stdlib.h>
    +
    3 #include <stdint.h>
    +
    4 
    +
    5 #ifndef PE_H
    +
    6 #define PE_H
    +
    7 
    +
    8 #define PE_MAGIC_PE 0x4550
    +
    9 #define PE_MAGIC_MZ 0x4d5a
    +
    10 #define PE_MAX_DLL_NAME 256
    +
    11 #define PE_MAX_FUNCTION_NAME 512
    +
    12 #define PE_MODE_UNSET 0
    +
    13 #define PE_MODE_X86 1
    +
    14 #define PE_MODE_X86_64 2
    +
    15 #define PE_MAX_SECTIONS 32
    +
    16 #define PE_SECTION_NAME_SIZE 8
    +
    17 #define PE_MAX_DIRECTORIES 16
    +
    18 
    +
    19 namespace binlex{
    +
    20 
    +
    21 typedef enum {
    +
    22  IMAGE_DIRECTORY_ENTRY_EXPORT = 0, // Export Table
    +
    23  IMAGE_DIRECTORY_ENTRY_IMPORT = 1, // Import Table
    +
    24  IMAGE_DIRECTORY_ENTRY_RESOURCE = 2, // Resource Table
    +
    25  IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3, // Exception Table
    +
    26  IMAGE_DIRECTORY_ENTRY_SECURITY = 4, // Certificate Table
    +
    27  IMAGE_DIRECTORY_ENTRY_BASERELOC = 5, // Base Relocation Table
    +
    28  IMAGE_DIRECTORY_ENTRY_DEBUG = 6, // Debug
    +
    29  //IMAGE_DIRECTORY_ENTRY_COPYRIGHT = 7, // (X86 usage)
    +
    30  IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7, // Architecture
    +
    31  IMAGE_DIRECTORY_ENTRY_GLOBALPTR = 8, // Global Ptr
    +
    32  IMAGE_DIRECTORY_ENTRY_TLS = 9, // TLS Table
    +
    33  IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10, // Load Config Table
    +
    34  IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11, // Bound Import
    +
    35  IMAGE_DIRECTORY_ENTRY_IAT = 12, // IAT
    +
    36  IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT = 13, // Delay Import Descriptor
    +
    37  IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR = 14, // CLR Runtime Header
    +
    38  IMAGE_DIRECTORY_RESERVED = 15 // Reserved, must be zero
    +
    39 } ImageDirectoryEntry;
    +
    40 
    +
    41 typedef struct {
    +
    42  uint32_t Characteristics;
    +
    43  uint32_t TimeDateStamp;
    +
    44  uint16_t MajorVersion;
    +
    45  uint16_t MinorVersion;
    +
    46  uint32_t Name;
    +
    47  uint32_t Base;
    +
    48  uint32_t NumberOfFunctions;
    +
    49  uint32_t NumberOfNames;
    +
    50  uint32_t AddressOfFunctions;
    +
    51  uint32_t AddressOfNames;
    +
    52  uint32_t AddressOfNameOrdinals;
    + +
    54 
    +
    55 typedef struct {
    +
    56  uint32_t StartAddressOfRawData;
    +
    57  uint32_t EndAddressOfRawData;
    +
    58  uint32_t AddressOfIndex;
    +
    59  uint32_t AddressOfCallBacks; // PIMAGE_TLS_CALLBACK
    +
    60  uint32_t SizeOfZeroFill;
    +
    61  uint32_t Characteristics; // reserved for future use
    + +
    63 
    +
    64 typedef struct {
    +
    65  uint64_t StartAddressOfRawData;
    +
    66  uint64_t EndAddressOfRawData;
    +
    67  uint64_t AddressOfIndex;
    +
    68  uint64_t AddressOfCallBacks;
    +
    69  uint32_t SizeOfZeroFill;
    +
    70  uint32_t Characteristics;
    + +
    72 
    +
    73 typedef struct {
    +
    74  uint32_t VirtualAddress;
    +
    75  uint32_t Size;
    + +
    77 
    +
    78 typedef enum {
    +
    79  IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
    +
    80  IMAGE_FILE_MACHINE_AM33 = 0x1d3,
    +
    81  IMAGE_FILE_MACHINE_AMD64 = 0x8664,
    +
    82  IMAGE_FILE_MACHINE_ARM = 0x1c0,
    +
    83  IMAGE_FILE_MACHINE_ARMV7 = 0x1c4,
    +
    84  IMAGE_FILE_MACHINE_CEE = 0xc0ee,
    +
    85  IMAGE_FILE_MACHINE_EBC = 0xebc,
    +
    86  IMAGE_FILE_MACHINE_I386 = 0x14c,
    +
    87  IMAGE_FILE_MACHINE_IA64 = 0x200,
    +
    88  IMAGE_FILE_MACHINE_M32R = 0x9041,
    +
    89  IMAGE_FILE_MACHINE_MIPS16 = 0x266,
    +
    90  IMAGE_FILE_MACHINE_MIPSFPU = 0x366,
    +
    91  IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466,
    +
    92  IMAGE_FILE_MACHINE_POWERPC = 0x1f0,
    +
    93  IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1,
    +
    94  IMAGE_FILE_MACHINE_R4000 = 0x166,
    +
    95  IMAGE_FILE_MACHINE_SH3 = 0x1a2,
    +
    96  IMAGE_FILE_MACHINE_SH3DSP = 0x1a3,
    +
    97  IMAGE_FILE_MACHINE_SH4 = 0x1a6,
    +
    98  IMAGE_FILE_MACHINE_SH5 = 0x1a8,
    +
    99  IMAGE_FILE_MACHINE_THUMB = 0x1c2,
    +
    100  IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
    +
    101 } MachineType;
    +
    102 
    +
    103 typedef enum {
    +
    104  // Image only, Windows CE, Windows NT and above. Indicates that the
    +
    105  // file does not contain base relocations and must therefore be
    +
    106  // loaded at its preferred base address. If the base address is not
    +
    107  // available, the loader reports an error. The default behavior of
    +
    108  // the linker is to strip base relocations from EXEs.
    +
    109  IMAGE_FILE_RELOCS_STRIPPED = 0x0001,
    +
    110 
    +
    111  // Image only. Indicates that the image file is valid and can be run.
    +
    112  // If this flag is not set, it indicates a linker error.
    +
    113  IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002,
    +
    114 
    +
    115  // COFF line numbers have been removed.
    +
    116  // Deprecated and should be zero.
    +
    117  IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004,
    +
    118 
    +
    119  // COFF symbol table entries for local symbols have been removed.
    +
    120  // Deprecated and should be zero.
    +
    121  IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008,
    +
    122 
    +
    123  // Obsolete. Aggressively trim working set.
    +
    124  // Deprecated in Windows 2000 and later. Must be zero.
    +
    125  IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010,
    +
    126 
    +
    127  // App can handle > 2gb addresses.
    +
    128  IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020,
    +
    129 
    +
    130  // Reserved for future use.
    +
    131  IMAGE_FILE_RESERVED = 0x0040,
    +
    132 
    +
    133  // Little endian: LSB precedes MSB in memory.
    +
    134  // Deprecated and should be zero.
    +
    135  IMAGE_FILE_BYTES_REVERSED_LO = 0x0080,
    +
    136 
    +
    137  // Machine based on 32-bit-word architecture.
    +
    138  IMAGE_FILE_32BIT_MACHINE = 0x0100,
    +
    139 
    +
    140  // Debugging information removed from image file.
    +
    141  IMAGE_FILE_DEBUG_STRIPPED = 0x0200,
    +
    142 
    +
    143  // If image is on removable media, fully load it and copy it to the
    +
    144  // swap file.
    +
    145  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400,
    +
    146 
    +
    147  // If image is on network media, fully load it and copy it to the
    +
    148  // swap file.
    +
    149  IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800,
    +
    150 
    +
    151  // The image file is a system file, not a user program.
    +
    152  IMAGE_FILE_SYSTEM = 0x1000,
    +
    153 
    +
    154  // The image file is a dynamic-link library (DLL). Such files are
    +
    155  // considered executable files for almost all purposes, although
    +
    156  // they cannot be directly run.
    +
    157  IMAGE_FILE_DLL = 0x2000,
    +
    158 
    +
    159  // File should be run only on a UP machine.
    +
    160  IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000,
    +
    161 
    +
    162  // Big endian: MSB precedes LSB in memory.
    +
    163  // Deprecated and should be zero.
    +
    164  IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
    +
    165 } ImageCharacteristics;
    +
    166 
    +
    167 typedef struct {
    +
    168  uint32_t Signature;
    +
    169  uint16_t Machine; // MachineType
    +
    170  uint16_t NumberOfSections;
    +
    171  uint32_t TimeDateStamp;
    +
    172  uint32_t PointerToSymbolTable;
    +
    173  uint32_t NumberOfSymbols;
    +
    174  uint16_t SizeOfOptionalHeader;
    +
    175  uint16_t Characteristics; // ImageCharacteristics
    + +
    177 
    +
    178 typedef struct {
    +
    179  uint16_t e_magic;
    +
    180  uint16_t e_cblp;
    +
    181  uint16_t e_cp;
    +
    182  uint16_t e_crlc;
    +
    183  uint16_t e_cparhdr;
    +
    184  uint16_t e_minalloc;
    +
    185  uint16_t e_maxalloc;
    +
    186  uint16_t e_ss;
    +
    187  uint16_t e_sp;
    +
    188  uint16_t e_csum;
    +
    189  uint16_t e_ip;
    +
    190  uint16_t e_cs;
    +
    191  uint16_t e_lfarlc;
    +
    192  uint16_t e_ovno;
    +
    193  uint16_t e_res[4];
    +
    194  uint16_t e_oemid;
    +
    195  uint16_t e_oeminfo;
    +
    196  uint16_t e_res2[10];
    +
    197  uint32_t e_lfanew; // sizeof(IMAGE_DOS_HEADER) + size of MS-DOS stub
    + +
    199 
    +
    200 // REFERENCE: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
    +
    201 typedef enum {
    +
    202  // Unknown subsystem
    +
    203  IMAGE_SUBSYSTEM_UNKNOWN = 0,
    +
    204  // No subsystem required (device drivers and native system processes)
    +
    205  IMAGE_SUBSYSTEM_NATIVE = 1,
    +
    206  // Windows graphical user interface (GUI) subsystem
    +
    207  IMAGE_SUBSYSTEM_WINDOWS_GUI = 2,
    +
    208  // Windows character-mode user interface (CUI) subsystem
    +
    209  IMAGE_SUBSYSTEM_WINDOWS_CUI = 3,
    +
    210  // OS/2 CUI subsystem
    +
    211  IMAGE_SUBSYSTEM_OS2_CUI = 5,
    +
    212  // POSIX CUI subsystem
    +
    213  IMAGE_SUBSYSTEM_POSIX_CUI = 7,
    +
    214  // Windows CE system
    +
    215  IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9,
    +
    216  // Extensible Firmware Interface (EFI) application
    +
    217  IMAGE_SUBSYSTEM_EFI_APPLICATION = 10,
    +
    218  // EFI driver with boot services
    +
    219  IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11,
    +
    220  // EFI driver with run-time services
    +
    221  IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12,
    +
    222  // EFI ROM image
    +
    223  IMAGE_SUBSYSTEM_EFI_ROM = 13,
    +
    224  // Xbox system
    +
    225  IMAGE_SUBSYSTEM_XBOX = 14,
    +
    226  // Boot application.
    +
    227  IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
    +
    228 } WindowsSubsystem;
    +
    229 
    +
    230 // REFERENCE: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
    +
    231 typedef enum {
    +
    232  // IMAGE_DLLCHARACTERISTICS_RESERVED_1 = 0x0001,
    +
    233  // IMAGE_DLLCHARACTERISTICS_RESERVED_2 = 0x0002,
    +
    234  // IMAGE_DLLCHARACTERISTICS_RESERVED_4 = 0x0004,
    +
    235  // IMAGE_DLLCHARACTERISTICS_RESERVED_8 = 0x0008,
    +
    236  // The DLL can be relocated at load time.
    +
    237  IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE = 0x0040,
    +
    238  // Code integrity checks are forced.
    +
    239  IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
    +
    240  // The image is compatible with data execution prevention (DEP).
    +
    241  IMAGE_DLLCHARACTERISTICS_NX_COMPAT = 0x0100,
    +
    242  // The image is isolation aware, but should not be isolated.
    +
    243  IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200,
    +
    244  // The image does not use structured exception handling (SEH).
    +
    245  // No handlers can be called in this image.
    +
    246  IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400,
    +
    247  // Do not bind the image.
    +
    248  IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800,
    +
    249  // IMAGE_DLLCHARACTERISTICS_RESERVED_1000 = 0x1000,
    +
    250  // A WDM driver.
    +
    251  IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000,
    +
    252  // IMAGE_DLLCHARACTERISTICS_RESERVED_4000 = 0x4000,
    +
    253  // The image is terminal server aware.
    +
    254  IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
    +
    255 } ImageDllCharacteristics;
    +
    256 
    +
    257 typedef enum {
    +
    258  MAGIC_ROM = 0x107,
    +
    259  MAGIC_PE32 = 0x10b,
    +
    260  MAGIC_PE64 = 0x20b // PE32+
    +
    261 } opt_type_e;
    +
    262 
    +
    263 typedef struct {
    +
    264  uint16_t Magic;
    +
    265  uint8_t MajorLinkerVersion;
    +
    266  uint8_t MinorLinkerVersion;
    +
    267  uint32_t SizeOfCode;
    +
    268  uint32_t SizeOfInitializedData;
    +
    269  uint32_t SizeOfUninitializedData;
    +
    270  uint32_t AddressOfEntryPoint;
    +
    271  uint32_t BaseOfCode;
    +
    272  uint32_t BaseOfData;
    +
    273  uint32_t BaseOfBss;
    +
    274  uint32_t GprMask;
    +
    275  uint32_t CprMask[4];
    +
    276  uint32_t GpValue;
    + +
    278 
    +
    279 // REFERENCE: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
    +
    280 typedef struct {
    +
    281  uint16_t Magic;
    +
    282  uint8_t MajorLinkerVersion;
    +
    283  uint8_t MinorLinkerVersion;
    +
    284  uint32_t SizeOfCode;
    +
    285  uint32_t SizeOfInitializedData;
    +
    286  uint32_t SizeOfUninitializedData;
    +
    287  uint32_t AddressOfEntryPoint;
    +
    288  uint32_t BaseOfCode;
    +
    289  uint32_t BaseOfData; // only in PE32
    +
    290  uint32_t ImageBase;
    +
    291  uint32_t SectionAlignment;
    +
    292  uint32_t FileAlignment;
    +
    293  uint16_t MajorOperatingSystemVersion;
    +
    294  uint16_t MinorOperatingSystemVersion;
    +
    295  uint16_t MajorImageVersion;
    +
    296  uint16_t MinorImageVersion;
    +
    297  uint16_t MajorSubsystemVersion;
    +
    298  uint16_t MinorSubsystemVersion;
    +
    299  uint32_t Reserved1;
    +
    300  uint32_t SizeOfImage;
    +
    301  uint32_t SizeOfHeaders;
    +
    302  uint32_t CheckSum;
    +
    303  uint16_t Subsystem; // WindowsSubsystem
    +
    304  uint16_t DllCharacteristics;
    +
    305  uint32_t SizeOfStackReserve;
    +
    306  uint32_t SizeOfStackCommit;
    +
    307  uint32_t SizeOfHeapReserve;
    +
    308  uint32_t SizeOfHeapCommit;
    +
    309  uint32_t LoaderFlags;
    +
    310  uint32_t NumberOfRvaAndSizes;
    +
    311  IMAGE_DATA_DIRECTORY DataDirectory[PE_MAX_DIRECTORIES];
    + +
    313 
    +
    314 // REFERENCE: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx
    +
    315 typedef struct {
    +
    316  uint16_t Magic;
    +
    317  uint8_t MajorLinkerVersion;
    +
    318  uint8_t MinorLinkerVersion;
    +
    319  uint32_t SizeOfCode;
    +
    320  uint32_t SizeOfInitializedData;
    +
    321  uint32_t SizeOfUninitializedData;
    +
    322  uint32_t AddressOfEntryPoint;
    +
    323  uint32_t BaseOfCode;
    +
    324  uint64_t ImageBase;
    +
    325  uint32_t SectionAlignment;
    +
    326  uint32_t FileAlignment;
    +
    327  uint16_t MajorOperatingSystemVersion;
    +
    328  uint16_t MinorOperatingSystemVersion;
    +
    329  uint16_t MajorImageVersion;
    +
    330  uint16_t MinorImageVersion;
    +
    331  uint16_t MajorSubsystemVersion;
    +
    332  uint16_t MinorSubsystemVersion;
    +
    333  uint32_t Reserved1;
    +
    334  uint32_t SizeOfImage;
    +
    335  uint32_t SizeOfHeaders;
    +
    336  uint32_t CheckSum;
    +
    337  uint16_t Subsystem; // WindowsSubsystem
    +
    338  uint16_t DllCharacteristics;
    +
    339  uint64_t SizeOfStackReserve;
    +
    340  uint64_t SizeOfStackCommit;
    +
    341  uint64_t SizeOfHeapReserve;
    +
    342  uint64_t SizeOfHeapCommit;
    +
    343  uint32_t LoaderFlags; /* must be zero */
    +
    344  uint32_t NumberOfRvaAndSizes;
    +
    345  IMAGE_DATA_DIRECTORY DataDirectory[PE_MAX_DIRECTORIES];
    + +
    347 
    +
    348 typedef struct {
    +
    349  uint16_t type; // opt_type_e
    +
    350  size_t length;
    + + + +
    354 
    +
    355 typedef enum {
    +
    356  IMAGE_SCN_TYPE_NO_PAD = 0x00000008, // Obsolete. Replaced by IMAGE_SCN_ALIGN_1BYTES
    +
    357  IMAGE_SCN_CNT_CODE = 0x00000020,
    +
    358  IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
    +
    359  IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080,
    +
    360  IMAGE_SCN_LNK_OTHER = 0x00000100, // Reserved.
    +
    361  IMAGE_SCN_LNK_INFO = 0x00000200, // Valid only for object files.
    +
    362  IMAGE_SCN_LNK_REMOVE = 0x00000800, // Valid only for object files.
    +
    363  IMAGE_SCN_LNK_COMDAT = 0x00001000, // Valid only for object files.
    +
    364  IMAGE_SCN_NO_DEFER_SPEC_EXC = 0x00004000,
    +
    365  IMAGE_SCN_GPREL = 0x00008000,
    +
    366  IMAGE_SCN_MEM_PURGEABLE = 0x00020000, // Reserved.
    +
    367  IMAGE_SCN_MEM_LOCKED = 0x00040000, // Reserved.
    +
    368  IMAGE_SCN_MEM_PRELOAD = 0x00080000, // Reserved.
    +
    369  IMAGE_SCN_ALIGN_1BYTES = 0x00100000, // Valid only for object files.
    +
    370  IMAGE_SCN_ALIGN_2BYTES = 0x00200000, // Valid only for object files.
    +
    371  IMAGE_SCN_ALIGN_4BYTES = 0x00300000, // Valid only for object files.
    +
    372  IMAGE_SCN_ALIGN_8BYTES = 0x00400000, // Valid only for object files.
    +
    373  IMAGE_SCN_ALIGN_16BYTES = 0x00500000, // Valid only for object files.
    +
    374  IMAGE_SCN_ALIGN_32BYTES = 0x00600000, // Valid only for object files.
    +
    375  IMAGE_SCN_ALIGN_64BYTES = 0x00700000, // Valid only for object files.
    +
    376  IMAGE_SCN_ALIGN_128BYTES = 0x00800000, // Valid only for object files.
    +
    377  IMAGE_SCN_ALIGN_256BYTES = 0x00900000, // Valid only for object files.
    +
    378  IMAGE_SCN_ALIGN_512BYTES = 0x00A00000, // Valid only for object files.
    +
    379  IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000, // Valid only for object files.
    +
    380  IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000, // Valid only for object files.
    +
    381  IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000, // Valid only for object files.
    +
    382  IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000, // Valid only for object files.
    +
    383  IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000,
    +
    384  IMAGE_SCN_MEM_DISCARDABLE = 0x02000000,
    +
    385  IMAGE_SCN_MEM_NOT_CACHED = 0x04000000,
    +
    386  IMAGE_SCN_MEM_NOT_PAGED = 0x08000000,
    +
    387  IMAGE_SCN_MEM_SHARED = 0x10000000,
    +
    388  IMAGE_SCN_MEM_EXECUTE = 0x20000000,
    +
    389  IMAGE_SCN_MEM_READ = 0x40000000,
    +
    390  IMAGE_SCN_MEM_WRITE = -2147483648 // Same as 0x80000000
    +
    391 } SectionCharacteristics;
    +
    392 
    +
    393 typedef struct {
    +
    394  uint8_t Name[PE_SECTION_NAME_SIZE]; // TODO: Should we use char instead?
    +
    395  union {
    +
    396  uint32_t PhysicalAddress; // same value as next field
    +
    397  uint32_t VirtualSize;
    +
    398  } Misc;
    +
    399  uint32_t VirtualAddress;
    +
    400  uint32_t SizeOfRawData;
    +
    401  uint32_t PointerToRawData;
    +
    402  uint32_t PointerToRelocations; // always zero in executables
    +
    403  uint32_t PointerToLinenumbers; // deprecated
    +
    404  uint16_t NumberOfRelocations;
    +
    405  uint16_t NumberOfLinenumbers; // deprecated
    +
    406  uint32_t Characteristics; // SectionCharacteristics
    + +
    408 
    +
    409 class Pe{
    +
    410  private:
    +
    411  struct Section {
    +
    412  uint offset;
    +
    413  int size;
    +
    414  void *data;
    +
    415  };
    +
    416  bool is_pe();
    +
    417  public:
    +
    418  char magic_mz[2] = {0x5a, 0x4d};
    +
    419  char magic_pe[4] = {0x00, 0x00, 0x45, 0x50};
    +
    420  FILE *fd = NULL;
    +
    421  PIMAGE_DOS_HEADER dos_header = NULL;
    +
    422  PIMAGE_COFF_HEADER coff_header = NULL;
    +
    423  uint32_t pe_header_ptr = 0;
    +
    424  PIMAGE_OPTIONAL_HEADER_32 optional_header_32 = NULL;
    +
    425  PIMAGE_OPTIONAL_HEADER_64 optional_header_64 = NULL;
    +
    426  PIMAGE_SECTION_HEADER section_header = NULL;
    +
    427  int mode = PE_MODE_UNSET;
    +
    428  struct Section sections[PE_MAX_SECTIONS];
    +
    429  Pe();
    +
    430  bool Setup(int input_mode);
    +
    431  bool ReadFile(char *file_path);
    +
    432  ~Pe();
    +
    433 };
    +
    434 
    +
    435 }
    +
    436 #endif
    +
    +
    +
    Definition: pe.h:167
    + +
    Definition: pe.h:348
    + +
    Definition: pe.h:409
    +
    Definition: pe.h:393
    +
    Definition: pe.h:73
    + +
    Definition: pe.h:178
    + +
    the binlex namespace
    + + + + + + diff --git a/docs/html/raw_8h_source.html b/docs/html/raw_8h_source.html new file mode 100644 index 00000000..82da442d --- /dev/null +++ b/docs/html/raw_8h_source.html @@ -0,0 +1,129 @@ + + + + + + + +binlex: include/raw.h Source File + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    raw.h
    +
    +
    +
    1 #include <stdio.h>
    +
    2 #include <stdlib.h>
    +
    3 
    +
    4 #ifndef RAW_H
    +
    5 #define RAW_H
    +
    6 
    +
    7 #define RAW_MAX_SECTIONS 128
    +
    8 
    +
    9 namespace binlex{
    +
    10  class Raw{
    +
    11  private:
    +
    12  struct Section {
    +
    13  void *data;
    +
    14  int size;
    +
    15  uint offset;
    +
    16  };
    +
    17  int GetFileSize(FILE *fd);
    +
    18  public:
    +
    19  struct Section sections[RAW_MAX_SECTIONS];
    +
    20  Raw();
    +
    21  bool ReadFile(char *file_path, int section_index);
    +
    22  ~Raw();
    +
    23  };
    +
    24 }
    +
    25 
    +
    26 #endif
    +
    +
    +
    Definition: raw.h:10
    +
    the binlex namespace
    + + + + diff --git a/docs/html/resize.js b/docs/html/resize.js new file mode 100644 index 00000000..a0bb5f45 --- /dev/null +++ b/docs/html/resize.js @@ -0,0 +1,137 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +function initResizable() +{ + var cookie_namespace = 'doxygen'; + var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight; + + function readCookie(cookie) + { + var myCookie = cookie_namespace+"_"+cookie+"="; + if (document.cookie) { + var index = document.cookie.indexOf(myCookie); + if (index != -1) { + var valStart = index + myCookie.length; + var valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + var val = document.cookie.substring(valStart, valEnd); + return val; + } + } + return 0; + } + + function writeCookie(cookie, val, expiration) + { + if (val==undefined) return; + if (expiration == null) { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week + expiration = date.toGMTString(); + } + document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; + } + + function resizeWidth() + { + var windowWidth = $(window).width() + "px"; + var sidenavWidth = $(sidenav).outerWidth(); + content.css({marginLeft:parseInt(sidenavWidth)+"px"}); + writeCookie('width',sidenavWidth-barWidth, null); + } + + function restoreWidth(navWidth) + { + var windowWidth = $(window).width() + "px"; + content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); + sidenav.css({width:navWidth + "px"}); + } + + function resizeHeight() + { + var headerHeight = header.outerHeight(); + var footerHeight = footer.outerHeight(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + content.css({height:windowHeight + "px"}); + navtree.css({height:windowHeight + "px"}); + sidenav.css({height:windowHeight + "px"}); + var width=$(window).width(); + if (width!=collapsedWidth) { + if (width=desktop_vp) { + if (!collapsed) { + collapseExpand(); + } + } else if (width>desktop_vp && collapsedWidth0) { + restoreWidth(0); + collapsed=true; + } + else { + var width = readCookie('width'); + if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); } + collapsed=false; + } + } + + header = $("#top"); + sidenav = $("#side-nav"); + content = $("#doc-content"); + navtree = $("#nav-tree"); + footer = $("#nav-path"); + $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); + $(sidenav).resizable({ minWidth: 0 }); + $(window).resize(function() { resizeHeight(); }); + var device = navigator.userAgent.toLowerCase(); + var touch_device = device.match(/(iphone|ipod|ipad|android)/); + if (touch_device) { /* wider split bar for touch only devices */ + $(sidenav).css({ paddingRight:'20px' }); + $('.ui-resizable-e').css({ width:'20px' }); + $('#nav-sync').css({ right:'34px' }); + barWidth=20; + } + var width = readCookie('width'); + if (width) { restoreWidth(width); } else { resizeWidth(); } + resizeHeight(); + var url = location.href; + var i=url.indexOf("#"); + if (i>=0) window.location.hash=url.substr(i); + var _preventDefault = function(evt) { evt.preventDefault(); }; + $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); + $(".ui-resizable-handle").dblclick(collapseExpand); + $(window).on('load',resizeHeight); +} +/* @license-end */ diff --git a/docs/html/search/all_0.html b/docs/html/search/all_0.html new file mode 100644 index 00000000..26dd244f --- /dev/null +++ b/docs/html/search/all_0.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_0.js b/docs/html/search/all_0.js new file mode 100644 index 00000000..8bf9d8cc --- /dev/null +++ b/docs/html/search/all_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['args_0',['Args',['../classbinlex_1_1Args.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_1.html b/docs/html/search/all_1.html new file mode 100644 index 00000000..8eb215b9 --- /dev/null +++ b/docs/html/search/all_1.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_1.js b/docs/html/search/all_1.js new file mode 100644 index 00000000..af555331 --- /dev/null +++ b/docs/html/search/all_1.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['binlex_1',['binlex',['../namespacebinlex.html',1,'']]], + ['binlex_2',['binlex',['../index.html',1,'']]] +]; diff --git a/docs/html/search/all_2.html b/docs/html/search/all_2.html new file mode 100644 index 00000000..b26d9165 --- /dev/null +++ b/docs/html/search/all_2.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_2.js b/docs/html/search/all_2.js new file mode 100644 index 00000000..7a110038 --- /dev/null +++ b/docs/html/search/all_2.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['common_3',['Common',['../classbinlex_1_1Common.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_3.html b/docs/html/search/all_3.html new file mode 100644 index 00000000..b61b96f8 --- /dev/null +++ b/docs/html/search/all_3.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_3.js b/docs/html/search/all_3.js new file mode 100644 index 00000000..7fa7cfc5 --- /dev/null +++ b/docs/html/search/all_3.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['decompiler_4',['Decompiler',['../classbinlex_1_1Decompiler.html',1,'binlex']]], + ['decompilerrev_5',['DecompilerREV',['../classbinlex_1_1DecompilerREV.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_4.html b/docs/html/search/all_4.html new file mode 100644 index 00000000..06de1550 --- /dev/null +++ b/docs/html/search/all_4.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_4.js b/docs/html/search/all_4.js new file mode 100644 index 00000000..59673365 --- /dev/null +++ b/docs/html/search/all_4.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['elf_6',['Elf',['../classbinlex_1_1Elf.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_5.html b/docs/html/search/all_5.html new file mode 100644 index 00000000..2544c4e5 --- /dev/null +++ b/docs/html/search/all_5.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_5.js b/docs/html/search/all_5.js new file mode 100644 index 00000000..6359ad23 --- /dev/null +++ b/docs/html/search/all_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['getbytesize_7',['GetByteSize',['../classbinlex_1_1Common.html#a537f95841cada660f148930c2d4e4f8d',1,'binlex::Common']]] +]; diff --git a/docs/html/search/all_6.html b/docs/html/search/all_6.html new file mode 100644 index 00000000..43f14eab --- /dev/null +++ b/docs/html/search/all_6.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_6.js b/docs/html/search/all_6.js new file mode 100644 index 00000000..45806201 --- /dev/null +++ b/docs/html/search/all_6.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['hexdump_8',['Hexdump',['../classbinlex_1_1Common.html#a8b07ec710b5a4f3c1d83084aec16b9f3',1,'binlex::Common']]], + ['hexdumpbe_9',['HexdumpBE',['../classbinlex_1_1Common.html#a94c338b55668ea0ebc430b9047fd3742',1,'binlex::Common']]] +]; diff --git a/docs/html/search/all_7.html b/docs/html/search/all_7.html new file mode 100644 index 00000000..af52f82a --- /dev/null +++ b/docs/html/search/all_7.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_7.js b/docs/html/search/all_7.js new file mode 100644 index 00000000..9efd70ed --- /dev/null +++ b/docs/html/search/all_7.js @@ -0,0 +1,14 @@ +var searchData= +[ + ['image_5fdata_5fdirectory_10',['IMAGE_DATA_DIRECTORY',['../structbinlex_1_1IMAGE__DATA__DIRECTORY.html',1,'binlex']]], + ['image_5fdos_5fheader_11',['IMAGE_DOS_HEADER',['../structbinlex_1_1IMAGE__DOS__HEADER.html',1,'binlex']]], + ['image_5fexport_5fdirectory_12',['IMAGE_EXPORT_DIRECTORY',['../structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html',1,'binlex']]], + ['image_5ffile_5fheader_13',['IMAGE_FILE_HEADER',['../structbinlex_1_1IMAGE__FILE__HEADER.html',1,'binlex']]], + ['image_5foptional_5fheader_14',['IMAGE_OPTIONAL_HEADER',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER.html',1,'binlex']]], + ['image_5foptional_5fheader_5f32_15',['IMAGE_OPTIONAL_HEADER_32',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html',1,'binlex']]], + ['image_5foptional_5fheader_5f64_16',['IMAGE_OPTIONAL_HEADER_64',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html',1,'binlex']]], + ['image_5from_5foptional_5fheader_17',['IMAGE_ROM_OPTIONAL_HEADER',['../structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html',1,'binlex']]], + ['image_5fsection_5fheader_18',['IMAGE_SECTION_HEADER',['../structbinlex_1_1IMAGE__SECTION__HEADER.html',1,'binlex']]], + ['image_5ftls_5fdirectory32_19',['IMAGE_TLS_DIRECTORY32',['../structbinlex_1_1IMAGE__TLS__DIRECTORY32.html',1,'binlex']]], + ['image_5ftls_5fdirectory64_20',['IMAGE_TLS_DIRECTORY64',['../structbinlex_1_1IMAGE__TLS__DIRECTORY64.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_8.html b/docs/html/search/all_8.html new file mode 100644 index 00000000..cf2b5df9 --- /dev/null +++ b/docs/html/search/all_8.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_8.js b/docs/html/search/all_8.js new file mode 100644 index 00000000..638bfb8e --- /dev/null +++ b/docs/html/search/all_8.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pe_21',['Pe',['../classbinlex_1_1Pe.html',1,'binlex']]] +]; diff --git a/docs/html/search/all_9.html b/docs/html/search/all_9.html new file mode 100644 index 00000000..690785a5 --- /dev/null +++ b/docs/html/search/all_9.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_9.js b/docs/html/search/all_9.js new file mode 100644 index 00000000..428b08e3 --- /dev/null +++ b/docs/html/search/all_9.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['raw_22',['Raw',['../classbinlex_1_1Raw.html',1,'binlex']]], + ['removespaces_23',['RemoveSpaces',['../classbinlex_1_1Common.html#a4b271f6ac9e939b8bb1133bab81b3ac1',1,'binlex::Common']]], + ['removewildcards_24',['RemoveWildcards',['../classbinlex_1_1Common.html#ae5c095392a25d1805cfe09d5b9623831',1,'binlex::Common']]] +]; diff --git a/docs/html/search/all_a.html b/docs/html/search/all_a.html new file mode 100644 index 00000000..f2f3d3a3 --- /dev/null +++ b/docs/html/search/all_a.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_a.js b/docs/html/search/all_a.js new file mode 100644 index 00000000..d85d8b48 --- /dev/null +++ b/docs/html/search/all_a.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['section_25',['Section',['../structbinlex_1_1DecompilerREV_1_1Section.html',1,'binlex::DecompilerREV']]], + ['sha256_26',['SHA256',['../classbinlex_1_1Common.html#ad8e308be16a7d66383c5ed66deb88329',1,'binlex::Common']]] +]; diff --git a/docs/html/search/all_b.html b/docs/html/search/all_b.html new file mode 100644 index 00000000..14f34036 --- /dev/null +++ b/docs/html/search/all_b.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_b.js b/docs/html/search/all_b.js new file mode 100644 index 00000000..6afc9ef6 --- /dev/null +++ b/docs/html/search/all_b.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['traittochar_27',['TraitToChar',['../classbinlex_1_1Common.html#ae31b773b28542c1b5a20e460750d9058',1,'binlex::Common']]], + ['trimright_28',['TrimRight',['../classbinlex_1_1Common.html#a12b0c27bc88357bd3027cc0033279cb9',1,'binlex::Common']]] +]; diff --git a/docs/html/search/all_c.html b/docs/html/search/all_c.html new file mode 100644 index 00000000..da60ab8d --- /dev/null +++ b/docs/html/search/all_c.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/all_c.js b/docs/html/search/all_c.js new file mode 100644 index 00000000..df286451 --- /dev/null +++ b/docs/html/search/all_c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['wildcardtrait_29',['WildcardTrait',['../classbinlex_1_1Common.html#a6869d240d567e4e678a90d31133521ff',1,'binlex::Common']]] +]; diff --git a/docs/html/search/classes_0.html b/docs/html/search/classes_0.html new file mode 100644 index 00000000..f7e4c14e --- /dev/null +++ b/docs/html/search/classes_0.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_0.js b/docs/html/search/classes_0.js new file mode 100644 index 00000000..ebafcdda --- /dev/null +++ b/docs/html/search/classes_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['args_30',['Args',['../classbinlex_1_1Args.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_1.html b/docs/html/search/classes_1.html new file mode 100644 index 00000000..c7ff4b31 --- /dev/null +++ b/docs/html/search/classes_1.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_1.js b/docs/html/search/classes_1.js new file mode 100644 index 00000000..fc526460 --- /dev/null +++ b/docs/html/search/classes_1.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['common_31',['Common',['../classbinlex_1_1Common.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_2.html b/docs/html/search/classes_2.html new file mode 100644 index 00000000..0d1e8a0c --- /dev/null +++ b/docs/html/search/classes_2.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_2.js b/docs/html/search/classes_2.js new file mode 100644 index 00000000..5bf1d535 --- /dev/null +++ b/docs/html/search/classes_2.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['decompiler_32',['Decompiler',['../classbinlex_1_1Decompiler.html',1,'binlex']]], + ['decompilerrev_33',['DecompilerREV',['../classbinlex_1_1DecompilerREV.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_3.html b/docs/html/search/classes_3.html new file mode 100644 index 00000000..21025456 --- /dev/null +++ b/docs/html/search/classes_3.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_3.js b/docs/html/search/classes_3.js new file mode 100644 index 00000000..9a22efa9 --- /dev/null +++ b/docs/html/search/classes_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['elf_34',['Elf',['../classbinlex_1_1Elf.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_4.html b/docs/html/search/classes_4.html new file mode 100644 index 00000000..095ab595 --- /dev/null +++ b/docs/html/search/classes_4.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_4.js b/docs/html/search/classes_4.js new file mode 100644 index 00000000..b3432748 --- /dev/null +++ b/docs/html/search/classes_4.js @@ -0,0 +1,14 @@ +var searchData= +[ + ['image_5fdata_5fdirectory_35',['IMAGE_DATA_DIRECTORY',['../structbinlex_1_1IMAGE__DATA__DIRECTORY.html',1,'binlex']]], + ['image_5fdos_5fheader_36',['IMAGE_DOS_HEADER',['../structbinlex_1_1IMAGE__DOS__HEADER.html',1,'binlex']]], + ['image_5fexport_5fdirectory_37',['IMAGE_EXPORT_DIRECTORY',['../structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html',1,'binlex']]], + ['image_5ffile_5fheader_38',['IMAGE_FILE_HEADER',['../structbinlex_1_1IMAGE__FILE__HEADER.html',1,'binlex']]], + ['image_5foptional_5fheader_39',['IMAGE_OPTIONAL_HEADER',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER.html',1,'binlex']]], + ['image_5foptional_5fheader_5f32_40',['IMAGE_OPTIONAL_HEADER_32',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html',1,'binlex']]], + ['image_5foptional_5fheader_5f64_41',['IMAGE_OPTIONAL_HEADER_64',['../structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html',1,'binlex']]], + ['image_5from_5foptional_5fheader_42',['IMAGE_ROM_OPTIONAL_HEADER',['../structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html',1,'binlex']]], + ['image_5fsection_5fheader_43',['IMAGE_SECTION_HEADER',['../structbinlex_1_1IMAGE__SECTION__HEADER.html',1,'binlex']]], + ['image_5ftls_5fdirectory32_44',['IMAGE_TLS_DIRECTORY32',['../structbinlex_1_1IMAGE__TLS__DIRECTORY32.html',1,'binlex']]], + ['image_5ftls_5fdirectory64_45',['IMAGE_TLS_DIRECTORY64',['../structbinlex_1_1IMAGE__TLS__DIRECTORY64.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_5.html b/docs/html/search/classes_5.html new file mode 100644 index 00000000..fc9cdc99 --- /dev/null +++ b/docs/html/search/classes_5.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_5.js b/docs/html/search/classes_5.js new file mode 100644 index 00000000..f00bbd34 --- /dev/null +++ b/docs/html/search/classes_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pe_46',['Pe',['../classbinlex_1_1Pe.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_6.html b/docs/html/search/classes_6.html new file mode 100644 index 00000000..1ecfdddf --- /dev/null +++ b/docs/html/search/classes_6.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_6.js b/docs/html/search/classes_6.js new file mode 100644 index 00000000..eaaacad3 --- /dev/null +++ b/docs/html/search/classes_6.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['raw_47',['Raw',['../classbinlex_1_1Raw.html',1,'binlex']]] +]; diff --git a/docs/html/search/classes_7.html b/docs/html/search/classes_7.html new file mode 100644 index 00000000..0fc6fc3e --- /dev/null +++ b/docs/html/search/classes_7.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/classes_7.js b/docs/html/search/classes_7.js new file mode 100644 index 00000000..b2b3d2f1 --- /dev/null +++ b/docs/html/search/classes_7.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['section_48',['Section',['../structbinlex_1_1DecompilerREV_1_1Section.html',1,'binlex::DecompilerREV']]] +]; diff --git a/docs/html/search/close.png b/docs/html/search/close.png new file mode 100644 index 00000000..2f6e5cac --- /dev/null +++ b/docs/html/search/close.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6eb1d3449c4157f13cba9fea540652efca373c12cbec11d43e7e458364e747e +size 273 diff --git a/docs/html/search/functions_0.html b/docs/html/search/functions_0.html new file mode 100644 index 00000000..e17c7111 --- /dev/null +++ b/docs/html/search/functions_0.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js new file mode 100644 index 00000000..04fe19fe --- /dev/null +++ b/docs/html/search/functions_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['getbytesize_50',['GetByteSize',['../classbinlex_1_1Common.html#a537f95841cada660f148930c2d4e4f8d',1,'binlex::Common']]] +]; diff --git a/docs/html/search/functions_1.html b/docs/html/search/functions_1.html new file mode 100644 index 00000000..0ddac0a4 --- /dev/null +++ b/docs/html/search/functions_1.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_1.js b/docs/html/search/functions_1.js new file mode 100644 index 00000000..2bcab4fa --- /dev/null +++ b/docs/html/search/functions_1.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['hexdump_51',['Hexdump',['../classbinlex_1_1Common.html#a8b07ec710b5a4f3c1d83084aec16b9f3',1,'binlex::Common']]], + ['hexdumpbe_52',['HexdumpBE',['../classbinlex_1_1Common.html#a94c338b55668ea0ebc430b9047fd3742',1,'binlex::Common']]] +]; diff --git a/docs/html/search/functions_2.html b/docs/html/search/functions_2.html new file mode 100644 index 00000000..2737c5ac --- /dev/null +++ b/docs/html/search/functions_2.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_2.js b/docs/html/search/functions_2.js new file mode 100644 index 00000000..4792ef69 --- /dev/null +++ b/docs/html/search/functions_2.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['removespaces_53',['RemoveSpaces',['../classbinlex_1_1Common.html#a4b271f6ac9e939b8bb1133bab81b3ac1',1,'binlex::Common']]], + ['removewildcards_54',['RemoveWildcards',['../classbinlex_1_1Common.html#ae5c095392a25d1805cfe09d5b9623831',1,'binlex::Common']]] +]; diff --git a/docs/html/search/functions_3.html b/docs/html/search/functions_3.html new file mode 100644 index 00000000..6da86e7d --- /dev/null +++ b/docs/html/search/functions_3.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_3.js b/docs/html/search/functions_3.js new file mode 100644 index 00000000..1b109df7 --- /dev/null +++ b/docs/html/search/functions_3.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['sha256_55',['SHA256',['../classbinlex_1_1Common.html#ad8e308be16a7d66383c5ed66deb88329',1,'binlex::Common']]] +]; diff --git a/docs/html/search/functions_4.html b/docs/html/search/functions_4.html new file mode 100644 index 00000000..911304e6 --- /dev/null +++ b/docs/html/search/functions_4.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_4.js b/docs/html/search/functions_4.js new file mode 100644 index 00000000..51f8aded --- /dev/null +++ b/docs/html/search/functions_4.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['traittochar_56',['TraitToChar',['../classbinlex_1_1Common.html#ae31b773b28542c1b5a20e460750d9058',1,'binlex::Common']]], + ['trimright_57',['TrimRight',['../classbinlex_1_1Common.html#a12b0c27bc88357bd3027cc0033279cb9',1,'binlex::Common']]] +]; diff --git a/docs/html/search/functions_5.html b/docs/html/search/functions_5.html new file mode 100644 index 00000000..61b920db --- /dev/null +++ b/docs/html/search/functions_5.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/functions_5.js b/docs/html/search/functions_5.js new file mode 100644 index 00000000..c4703871 --- /dev/null +++ b/docs/html/search/functions_5.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['wildcardtrait_58',['WildcardTrait',['../classbinlex_1_1Common.html#a6869d240d567e4e678a90d31133521ff',1,'binlex::Common']]] +]; diff --git a/docs/html/search/mag_sel.png b/docs/html/search/mag_sel.png new file mode 100644 index 00000000..d2a4a0e7 --- /dev/null +++ b/docs/html/search/mag_sel.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4f4b2ca8687c4f9389cf9e4f032639c474413193de6cae8e6f90e2fdeecb3f3 +size 465 diff --git a/docs/html/search/namespaces_0.html b/docs/html/search/namespaces_0.html new file mode 100644 index 00000000..76996d1c --- /dev/null +++ b/docs/html/search/namespaces_0.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/namespaces_0.js b/docs/html/search/namespaces_0.js new file mode 100644 index 00000000..619962be --- /dev/null +++ b/docs/html/search/namespaces_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['binlex_49',['binlex',['../namespacebinlex.html',1,'']]] +]; diff --git a/docs/html/search/nomatches.html b/docs/html/search/nomatches.html new file mode 100644 index 00000000..43773208 --- /dev/null +++ b/docs/html/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
    +
    No Matches
    +
    + + diff --git a/docs/html/search/pages_0.html b/docs/html/search/pages_0.html new file mode 100644 index 00000000..9a6a29ad --- /dev/null +++ b/docs/html/search/pages_0.html @@ -0,0 +1,30 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/docs/html/search/pages_0.js b/docs/html/search/pages_0.js new file mode 100644 index 00000000..085c6076 --- /dev/null +++ b/docs/html/search/pages_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['binlex_59',['binlex',['../index.html',1,'']]] +]; diff --git a/docs/html/search/search.css b/docs/html/search/search.css new file mode 100644 index 00000000..3cf9df94 --- /dev/null +++ b/docs/html/search/search.css @@ -0,0 +1,271 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#MSearchBox { + white-space : nowrap; + float: none; + margin-top: 8px; + right: 0px; + width: 170px; + height: 24px; + z-index: 102; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:115px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; + -webkit-border-radius: 0px; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:8px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 10001; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; + z-index:10000; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} + +/*---------------- External search page results */ + +.searchresult { + background-color: #F0F3F8; +} + +.pages b { + color: white; + padding: 5px 5px 3px 5px; + background-image: url("../tab_a.png"); + background-repeat: repeat-x; + text-shadow: 0 1px 1px #000000; +} + +.pages { + line-height: 17px; + margin-left: 4px; + text-decoration: none; +} + +.hl { + font-weight: bold; +} + +#searchresults { + margin-bottom: 20px; +} + +.searchpages { + margin-top: 10px; +} + diff --git a/docs/html/search/search.js b/docs/html/search/search.js new file mode 100644 index 00000000..a554ab9c --- /dev/null +++ b/docs/html/search/search.js @@ -0,0 +1,814 @@ +/* + @licstart The following is the entire license notice for the + JavaScript code in this file. + + Copyright (C) 1997-2017 by Dimitri van Heesch + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + @licend The above is the entire license notice + for the JavaScript code in this file + */ +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair + { + idxChar = searchValue.substr(0, 2); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) + { + var hexCode=idx.toString(16); + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} + +function setKeyActions(elem,action) +{ + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); +} + +function setClassAttr(elem,attr) +{ + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); +} + +function createResults() +{ + var results = document.getElementById("SRResults"); + for (var e=0; e + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::DecompilerREV::Section Member List
    +
    +
    + +

    This is the complete list of members for binlex::DecompilerREV::Section, including all inherited members.

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    b_bytes (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    b_count (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    b_edges (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    b_end (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    b_insn_count (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    b_trait (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    blocks (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    code (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    code_size (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    data (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    data_offset (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    data_size (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    f_bytes (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    f_edges (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    f_end (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    f_insn_count (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    f_trait (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    functions (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    handle (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    offset (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    pc (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    status (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    traits (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    visited (defined in binlex::DecompilerREV::Section)binlex::DecompilerREV::Section
    +
    + + + + diff --git a/docs/html/structbinlex_1_1DecompilerREV_1_1Section.html b/docs/html/structbinlex_1_1DecompilerREV_1_1Section.html new file mode 100644 index 00000000..b6324b04 --- /dev/null +++ b/docs/html/structbinlex_1_1DecompilerREV_1_1Section.html @@ -0,0 +1,183 @@ + + + + + + + +binlex: binlex::DecompilerREV::Section Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::DecompilerREV::Section Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +csh handle
     
    +cs_err status
     
    +json traits
     
    +uint offset
     
    +uint64_t pc
     
    +size_t code_size
     
    +size_t data_size
     
    +size_t data_offset
     
    +void * data
     
    +const uint8_t * code
     
    +uint b_edges
     
    +uint f_edges
     
    +bool b_end
     
    +bool f_end
     
    +uint b_count
     
    +uint b_insn_count
     
    +uint f_insn_count
     
    +string b_trait
     
    +string b_bytes
     
    +string f_trait
     
    +string f_bytes
     
    +vector< uint64_t > blocks
     
    +vector< uint64_t > functions
     
    +vector< uint64_t > visited
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1DecompilerREV_1_1Section.js b/docs/html/structbinlex_1_1DecompilerREV_1_1Section.js new file mode 100644 index 00000000..51acba31 --- /dev/null +++ b/docs/html/structbinlex_1_1DecompilerREV_1_1Section.js @@ -0,0 +1,27 @@ +var structbinlex_1_1DecompilerREV_1_1Section = +[ + [ "b_bytes", "structbinlex_1_1DecompilerREV_1_1Section.html#a9b0ed89828942c93968920cad9d2b7c6", null ], + [ "b_count", "structbinlex_1_1DecompilerREV_1_1Section.html#a17976d5c66a4ec7b22c0d191023042ae", null ], + [ "b_edges", "structbinlex_1_1DecompilerREV_1_1Section.html#a5834f578b2bfcbb0ec29d5e93bcfc076", null ], + [ "b_end", "structbinlex_1_1DecompilerREV_1_1Section.html#a2271bfd8f569ff0b4d73ccb05b2b356c", null ], + [ "b_insn_count", "structbinlex_1_1DecompilerREV_1_1Section.html#aa7439943ed740c911f94db7d9f49e36a", null ], + [ "b_trait", "structbinlex_1_1DecompilerREV_1_1Section.html#ac87a38b4e7e4cee3347b136734403a0f", null ], + [ "blocks", "structbinlex_1_1DecompilerREV_1_1Section.html#ab66e164df30f6a66997ce34394833097", null ], + [ "code", "structbinlex_1_1DecompilerREV_1_1Section.html#a37a88d3eb5aae5cb1653ac7f215213ff", null ], + [ "code_size", "structbinlex_1_1DecompilerREV_1_1Section.html#a7f640db8252ff8d49c4fc686c6b8f8ce", null ], + [ "data", "structbinlex_1_1DecompilerREV_1_1Section.html#a4a293561474052c8720e8ab0f70652be", null ], + [ "data_offset", "structbinlex_1_1DecompilerREV_1_1Section.html#a3bab8c9dde308ade5e58a9f97bba9f49", null ], + [ "data_size", "structbinlex_1_1DecompilerREV_1_1Section.html#a68d60b9035b2798e010e2caec0d22b89", null ], + [ "f_bytes", "structbinlex_1_1DecompilerREV_1_1Section.html#a567f8fb3ed670e934c45183bb61e2334", null ], + [ "f_edges", "structbinlex_1_1DecompilerREV_1_1Section.html#a536360179b680888b13be22977ba10d7", null ], + [ "f_end", "structbinlex_1_1DecompilerREV_1_1Section.html#a3f3f180e7e240408791980e42d46b854", null ], + [ "f_insn_count", "structbinlex_1_1DecompilerREV_1_1Section.html#a0730d6a718261b51724f8859b0485cc5", null ], + [ "f_trait", "structbinlex_1_1DecompilerREV_1_1Section.html#a8b1eb086206f3fb87b55cc7b1e3c9116", null ], + [ "functions", "structbinlex_1_1DecompilerREV_1_1Section.html#a35e3346a1001a2a5a9a7d1f32f6bdc19", null ], + [ "handle", "structbinlex_1_1DecompilerREV_1_1Section.html#ad9be6b342d9ef10cd2e518a0b2632d74", null ], + [ "offset", "structbinlex_1_1DecompilerREV_1_1Section.html#a896445f54882ead388364f768b5ac69c", null ], + [ "pc", "structbinlex_1_1DecompilerREV_1_1Section.html#ae200e886d7213486a50577455ebb5339", null ], + [ "status", "structbinlex_1_1DecompilerREV_1_1Section.html#a006ac296317d866b41ef82df46e2a680", null ], + [ "traits", "structbinlex_1_1DecompilerREV_1_1Section.html#a3ddd9f277b8ca71c969e9b263b347f49", null ], + [ "visited", "structbinlex_1_1DecompilerREV_1_1Section.html#af12445db66a7ddbaae0cd52636596599", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY-members.html b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY-members.html new file mode 100644 index 00000000..cbb1dad0 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY-members.html @@ -0,0 +1,105 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_DATA_DIRECTORY Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_DATA_DIRECTORY, including all inherited members.

    + + + +
    Size (defined in binlex::IMAGE_DATA_DIRECTORY)binlex::IMAGE_DATA_DIRECTORY
    VirtualAddress (defined in binlex::IMAGE_DATA_DIRECTORY)binlex::IMAGE_DATA_DIRECTORY
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.html b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.html new file mode 100644 index 00000000..53534c6a --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.html @@ -0,0 +1,117 @@ + + + + + + + +binlex: binlex::IMAGE_DATA_DIRECTORY Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_DATA_DIRECTORY Struct Reference
    +
    +
    + + + + + + +

    +Public Attributes

    +uint32_t VirtualAddress
     
    +uint32_t Size
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.js b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.js new file mode 100644 index 00000000..b744d6f1 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DATA__DIRECTORY.js @@ -0,0 +1,5 @@ +var structbinlex_1_1IMAGE__DATA__DIRECTORY = +[ + [ "Size", "structbinlex_1_1IMAGE__DATA__DIRECTORY.html#af0771efe457ae1855652001d89ea8ab0", null ], + [ "VirtualAddress", "structbinlex_1_1IMAGE__DATA__DIRECTORY.html#ae16d87220b83805c1f9277e4596b0854", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__DOS__HEADER-members.html b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER-members.html new file mode 100644 index 00000000..d73a71e0 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER-members.html @@ -0,0 +1,122 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_DOS_HEADER Member List
    +
    + +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.html b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.html new file mode 100644 index 00000000..2f24a34a --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.html @@ -0,0 +1,168 @@ + + + + + + + +binlex: binlex::IMAGE_DOS_HEADER Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_DOS_HEADER Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint16_t e_magic
     
    +uint16_t e_cblp
     
    +uint16_t e_cp
     
    +uint16_t e_crlc
     
    +uint16_t e_cparhdr
     
    +uint16_t e_minalloc
     
    +uint16_t e_maxalloc
     
    +uint16_t e_ss
     
    +uint16_t e_sp
     
    +uint16_t e_csum
     
    +uint16_t e_ip
     
    +uint16_t e_cs
     
    +uint16_t e_lfarlc
     
    +uint16_t e_ovno
     
    +uint16_t e_res [4]
     
    +uint16_t e_oemid
     
    +uint16_t e_oeminfo
     
    +uint16_t e_res2 [10]
     
    +uint32_t e_lfanew
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.js b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.js new file mode 100644 index 00000000..af1c9cd1 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__DOS__HEADER.js @@ -0,0 +1,22 @@ +var structbinlex_1_1IMAGE__DOS__HEADER = +[ + [ "e_cblp", "structbinlex_1_1IMAGE__DOS__HEADER.html#af7868564f48f602f444fcdc59d6251f2", null ], + [ "e_cp", "structbinlex_1_1IMAGE__DOS__HEADER.html#a672d92029b33f02dc6d70727aa4e2634", null ], + [ "e_cparhdr", "structbinlex_1_1IMAGE__DOS__HEADER.html#a56b2da140f59afb2708eb471d5928e95", null ], + [ "e_crlc", "structbinlex_1_1IMAGE__DOS__HEADER.html#a4e091c84f1460ae1cd73f6c373136c8f", null ], + [ "e_cs", "structbinlex_1_1IMAGE__DOS__HEADER.html#a271afff1bfb0ed300552f2e663d49cae", null ], + [ "e_csum", "structbinlex_1_1IMAGE__DOS__HEADER.html#a0fe3aa235d91fe39e88e3714e9389580", null ], + [ "e_ip", "structbinlex_1_1IMAGE__DOS__HEADER.html#acc345b28cbbdefa566b6bf57f66e770b", null ], + [ "e_lfanew", "structbinlex_1_1IMAGE__DOS__HEADER.html#a8a76672b17d306f5398a4a74eecf1abd", null ], + [ "e_lfarlc", "structbinlex_1_1IMAGE__DOS__HEADER.html#a140a66d93b904394ddb946318f363ea7", null ], + [ "e_magic", "structbinlex_1_1IMAGE__DOS__HEADER.html#ad4fad2528d4c925597ca2022790bd545", null ], + [ "e_maxalloc", "structbinlex_1_1IMAGE__DOS__HEADER.html#aba10f0390bd392582ab24df7ec011f22", null ], + [ "e_minalloc", "structbinlex_1_1IMAGE__DOS__HEADER.html#a6ba8e613752478c1562e80687dd1c89a", null ], + [ "e_oemid", "structbinlex_1_1IMAGE__DOS__HEADER.html#ab72a4c3b5105f93c1428b5b9f48f30a4", null ], + [ "e_oeminfo", "structbinlex_1_1IMAGE__DOS__HEADER.html#aa258156c4a3af8f46f29ce705126d1ac", null ], + [ "e_ovno", "structbinlex_1_1IMAGE__DOS__HEADER.html#a63b523a28aaff92cb681d1dcea57c8c1", null ], + [ "e_res", "structbinlex_1_1IMAGE__DOS__HEADER.html#ae9314a8ba8a883c08edcb07878b84dfb", null ], + [ "e_res2", "structbinlex_1_1IMAGE__DOS__HEADER.html#a51516bed58ad26271b7185fa11015532", null ], + [ "e_sp", "structbinlex_1_1IMAGE__DOS__HEADER.html#a224f8d1d885316042e5939125b378e87", null ], + [ "e_ss", "structbinlex_1_1IMAGE__DOS__HEADER.html#ac8982fce0319f9045fa2e81bf90618b2", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY-members.html b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY-members.html new file mode 100644 index 00000000..ca6724c6 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY-members.html @@ -0,0 +1,114 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_EXPORT_DIRECTORY Member List
    +
    + +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html new file mode 100644 index 00000000..a6e8b2af --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html @@ -0,0 +1,144 @@ + + + + + + + +binlex: binlex::IMAGE_EXPORT_DIRECTORY Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_EXPORT_DIRECTORY Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint32_t Characteristics
     
    +uint32_t TimeDateStamp
     
    +uint16_t MajorVersion
     
    +uint16_t MinorVersion
     
    +uint32_t Name
     
    +uint32_t Base
     
    +uint32_t NumberOfFunctions
     
    +uint32_t NumberOfNames
     
    +uint32_t AddressOfFunctions
     
    +uint32_t AddressOfNames
     
    +uint32_t AddressOfNameOrdinals
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.js b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.js new file mode 100644 index 00000000..cd40108c --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__EXPORT__DIRECTORY.js @@ -0,0 +1,14 @@ +var structbinlex_1_1IMAGE__EXPORT__DIRECTORY = +[ + [ "AddressOfFunctions", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#ab85589bb13b1779c9e1de0b5af29df8d", null ], + [ "AddressOfNameOrdinals", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a3d4dbcb2caa2bdd9ca4f1d2db2fccaa4", null ], + [ "AddressOfNames", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#ad1951a77bf787e5703d2b9480f698b1b", null ], + [ "Base", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a39bf9e7067ba70c46f66ff251acfb04e", null ], + [ "Characteristics", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#ab982fa5cf3a771b1a89d571f850c9318", null ], + [ "MajorVersion", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#ade402405f3798af3f14e27d73855ebaa", null ], + [ "MinorVersion", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a2a9838e07193bb6a3980becdb050dd98", null ], + [ "Name", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a15be1bf6723c94a85df7f15b79914a18", null ], + [ "NumberOfFunctions", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a09e979edfab5f7a44a6c53f342b21698", null ], + [ "NumberOfNames", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a8f18e7cddae81b7b8fae941e27e56b2f", null ], + [ "TimeDateStamp", "structbinlex_1_1IMAGE__EXPORT__DIRECTORY.html#a45303633084b25e56900caa1a2ceb143", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__FILE__HEADER-members.html b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER-members.html new file mode 100644 index 00000000..7b2dee99 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER-members.html @@ -0,0 +1,111 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_FILE_HEADER Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_FILE_HEADER, including all inherited members.

    + + + + + + + + + +
    Characteristics (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    Machine (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    NumberOfSections (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    NumberOfSymbols (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    PointerToSymbolTable (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    Signature (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    SizeOfOptionalHeader (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    TimeDateStamp (defined in binlex::IMAGE_FILE_HEADER)binlex::IMAGE_FILE_HEADER
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.html b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.html new file mode 100644 index 00000000..1d4ebc1f --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.html @@ -0,0 +1,135 @@ + + + + + + + +binlex: binlex::IMAGE_FILE_HEADER Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_FILE_HEADER Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint32_t Signature
     
    +uint16_t Machine
     
    +uint16_t NumberOfSections
     
    +uint32_t TimeDateStamp
     
    +uint32_t PointerToSymbolTable
     
    +uint32_t NumberOfSymbols
     
    +uint16_t SizeOfOptionalHeader
     
    +uint16_t Characteristics
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.js b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.js new file mode 100644 index 00000000..8300a243 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__FILE__HEADER.js @@ -0,0 +1,11 @@ +var structbinlex_1_1IMAGE__FILE__HEADER = +[ + [ "Characteristics", "structbinlex_1_1IMAGE__FILE__HEADER.html#a29a5544781e4ec7913b58b18fdb27200", null ], + [ "Machine", "structbinlex_1_1IMAGE__FILE__HEADER.html#ab737704ed5130cb261112734c7ddd5a8", null ], + [ "NumberOfSections", "structbinlex_1_1IMAGE__FILE__HEADER.html#ac58448e987de5b4e1d040c46261e6793", null ], + [ "NumberOfSymbols", "structbinlex_1_1IMAGE__FILE__HEADER.html#a2c6cdb8201c87f94913acbbbf957712f", null ], + [ "PointerToSymbolTable", "structbinlex_1_1IMAGE__FILE__HEADER.html#a5e66b1288b85f163502704b1d555e86e", null ], + [ "Signature", "structbinlex_1_1IMAGE__FILE__HEADER.html#a64667803fbc815b07fc328308ee213b7", null ], + [ "SizeOfOptionalHeader", "structbinlex_1_1IMAGE__FILE__HEADER.html#a617f9f46f04f2d67d846d4dcefd9e3a5", null ], + [ "TimeDateStamp", "structbinlex_1_1IMAGE__FILE__HEADER.html#afb54a6b27a416f987c343da4935a90da", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER-members.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER-members.html new file mode 100644 index 00000000..0ea6b280 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER-members.html @@ -0,0 +1,107 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_OPTIONAL_HEADER Member List
    +
    + +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.html new file mode 100644 index 00000000..79dbda09 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.html @@ -0,0 +1,123 @@ + + + + + + + +binlex: binlex::IMAGE_OPTIONAL_HEADER Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_OPTIONAL_HEADER Struct Reference
    +
    +
    + + + + + + + + + + +

    +Public Attributes

    +uint16_t type
     
    +size_t length
     
    +IMAGE_OPTIONAL_HEADER_32_32
     
    +IMAGE_OPTIONAL_HEADER_64_64
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.js b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.js new file mode 100644 index 00000000..a03440af --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER.js @@ -0,0 +1,7 @@ +var structbinlex_1_1IMAGE__OPTIONAL__HEADER = +[ + [ "_32", "structbinlex_1_1IMAGE__OPTIONAL__HEADER.html#a1a948c7de0d43b412ffcb82de944bce3", null ], + [ "_64", "structbinlex_1_1IMAGE__OPTIONAL__HEADER.html#a7317e4a5ac3bc5b132c018e14a6e2807", null ], + [ "length", "structbinlex_1_1IMAGE__OPTIONAL__HEADER.html#ac0985d55f92e6ba2174dd572e75b0189", null ], + [ "type", "structbinlex_1_1IMAGE__OPTIONAL__HEADER.html#a4a1290e50cd3af79276f1dbaa314865c", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32-members.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32-members.html new file mode 100644 index 00000000..ffab4c4f --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32-members.html @@ -0,0 +1,134 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_OPTIONAL_HEADER_32 Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_OPTIONAL_HEADER_32, including all inherited members.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    AddressOfEntryPoint (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    BaseOfCode (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    BaseOfData (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    CheckSum (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    DataDirectory (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    DllCharacteristics (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    FileAlignment (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    ImageBase (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    LoaderFlags (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    Magic (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MajorImageVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MajorLinkerVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MajorOperatingSystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MajorSubsystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MinorImageVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MinorLinkerVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MinorOperatingSystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    MinorSubsystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    NumberOfRvaAndSizes (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    Reserved1 (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SectionAlignment (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfCode (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfHeaders (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfHeapCommit (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfHeapReserve (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfImage (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfInitializedData (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfStackCommit (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfStackReserve (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    SizeOfUninitializedData (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    Subsystem (defined in binlex::IMAGE_OPTIONAL_HEADER_32)binlex::IMAGE_OPTIONAL_HEADER_32
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html new file mode 100644 index 00000000..425719ce --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html @@ -0,0 +1,204 @@ + + + + + + + +binlex: binlex::IMAGE_OPTIONAL_HEADER_32 Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_OPTIONAL_HEADER_32 Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint16_t Magic
     
    +uint8_t MajorLinkerVersion
     
    +uint8_t MinorLinkerVersion
     
    +uint32_t SizeOfCode
     
    +uint32_t SizeOfInitializedData
     
    +uint32_t SizeOfUninitializedData
     
    +uint32_t AddressOfEntryPoint
     
    +uint32_t BaseOfCode
     
    +uint32_t BaseOfData
     
    +uint32_t ImageBase
     
    +uint32_t SectionAlignment
     
    +uint32_t FileAlignment
     
    +uint16_t MajorOperatingSystemVersion
     
    +uint16_t MinorOperatingSystemVersion
     
    +uint16_t MajorImageVersion
     
    +uint16_t MinorImageVersion
     
    +uint16_t MajorSubsystemVersion
     
    +uint16_t MinorSubsystemVersion
     
    +uint32_t Reserved1
     
    +uint32_t SizeOfImage
     
    +uint32_t SizeOfHeaders
     
    +uint32_t CheckSum
     
    +uint16_t Subsystem
     
    +uint16_t DllCharacteristics
     
    +uint32_t SizeOfStackReserve
     
    +uint32_t SizeOfStackCommit
     
    +uint32_t SizeOfHeapReserve
     
    +uint32_t SizeOfHeapCommit
     
    +uint32_t LoaderFlags
     
    +uint32_t NumberOfRvaAndSizes
     
    +IMAGE_DATA_DIRECTORY DataDirectory [PE_MAX_DIRECTORIES]
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.js b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.js new file mode 100644 index 00000000..4beb3cd3 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.js @@ -0,0 +1,34 @@ +var structbinlex_1_1IMAGE__OPTIONAL__HEADER__32 = +[ + [ "AddressOfEntryPoint", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a1d73038bef4af4b646dad4bf9322a2ed", null ], + [ "BaseOfCode", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a7be070e891ce95b1613ee51e07680922", null ], + [ "BaseOfData", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#abe929605fa738ceb3d540d2bd1e9678b", null ], + [ "CheckSum", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#ac5fc2c51bdb07a11e40b78c69d6c1c3d", null ], + [ "DataDirectory", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a3db717d2cc38e989f9ce8f4cdccb97bd", null ], + [ "DllCharacteristics", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a2e1315e0ef977b7e63bf84c04ba93ef5", null ], + [ "FileAlignment", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a72b22e22d22d82f6aa4e6123c96d23a2", null ], + [ "ImageBase", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a30e52c2151ec402103f114b3bf702076", null ], + [ "LoaderFlags", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a764ce9d1f7eb723c99e61398840cb9cb", null ], + [ "Magic", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a0c9f50ab3a825a7eb8e7f859fa5dd42c", null ], + [ "MajorImageVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#ac446e211526160ff3389fcdc7820562e", null ], + [ "MajorLinkerVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#aeaf04d29ceef3ad58c4fcf11c58917eb", null ], + [ "MajorOperatingSystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a0d68e26d4d2b8eb188bff046d0a03ef8", null ], + [ "MajorSubsystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a056cde3afde77c0d90cebb79e21e8b00", null ], + [ "MinorImageVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a2de1cbf5403553ec92ecbedd4947491e", null ], + [ "MinorLinkerVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a94fc33ee1ebc0a603b5b30eafc4d8cff", null ], + [ "MinorOperatingSystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#ab8c34f01959702a5fd72481f5130efd1", null ], + [ "MinorSubsystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a6c13b0ba18bed85a94d16c0270915c03", null ], + [ "NumberOfRvaAndSizes", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a410ab6317e4e042d4f9799685e272992", null ], + [ "Reserved1", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a85d2e2dc3833ab5c1228e0d43684b97f", null ], + [ "SectionAlignment", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a45c1eed325df1575e3f38bb258f6ccd1", null ], + [ "SizeOfCode", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#ada99e114a366d0f0b31e238116609a2b", null ], + [ "SizeOfHeaders", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a2c46b4fa345c94d1d8996ef1ee2c2322", null ], + [ "SizeOfHeapCommit", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a5ea6e438e924e076b3b019887dc49eb8", null ], + [ "SizeOfHeapReserve", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a4a520456ab407eec1cd1324c35d88a4d", null ], + [ "SizeOfImage", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a9fd42ac8d94e923fdaea690a4b661811", null ], + [ "SizeOfInitializedData", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a3348c487c09e0b8f8effc6e79401a9cd", null ], + [ "SizeOfStackCommit", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#ac63ce3bd870d2dcdbcf5afff983e1ce8", null ], + [ "SizeOfStackReserve", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a733ca93e6a79a742c40b45f47dd22b11", null ], + [ "SizeOfUninitializedData", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a49ccdafd39018d337feaa4f3ac3d84a9", null ], + [ "Subsystem", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__32.html#a01e5767481f27a25c21d30ffcdb2c3f6", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64-members.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64-members.html new file mode 100644 index 00000000..0eaf3ee1 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64-members.html @@ -0,0 +1,133 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_OPTIONAL_HEADER_64 Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_OPTIONAL_HEADER_64, including all inherited members.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    AddressOfEntryPoint (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    BaseOfCode (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    CheckSum (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    DataDirectory (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    DllCharacteristics (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    FileAlignment (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    ImageBase (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    LoaderFlags (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    Magic (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MajorImageVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MajorLinkerVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MajorOperatingSystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MajorSubsystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MinorImageVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MinorLinkerVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MinorOperatingSystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    MinorSubsystemVersion (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    NumberOfRvaAndSizes (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    Reserved1 (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SectionAlignment (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfCode (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfHeaders (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfHeapCommit (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfHeapReserve (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfImage (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfInitializedData (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfStackCommit (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfStackReserve (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    SizeOfUninitializedData (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    Subsystem (defined in binlex::IMAGE_OPTIONAL_HEADER_64)binlex::IMAGE_OPTIONAL_HEADER_64
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html new file mode 100644 index 00000000..08df12df --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html @@ -0,0 +1,201 @@ + + + + + + + +binlex: binlex::IMAGE_OPTIONAL_HEADER_64 Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_OPTIONAL_HEADER_64 Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint16_t Magic
     
    +uint8_t MajorLinkerVersion
     
    +uint8_t MinorLinkerVersion
     
    +uint32_t SizeOfCode
     
    +uint32_t SizeOfInitializedData
     
    +uint32_t SizeOfUninitializedData
     
    +uint32_t AddressOfEntryPoint
     
    +uint32_t BaseOfCode
     
    +uint64_t ImageBase
     
    +uint32_t SectionAlignment
     
    +uint32_t FileAlignment
     
    +uint16_t MajorOperatingSystemVersion
     
    +uint16_t MinorOperatingSystemVersion
     
    +uint16_t MajorImageVersion
     
    +uint16_t MinorImageVersion
     
    +uint16_t MajorSubsystemVersion
     
    +uint16_t MinorSubsystemVersion
     
    +uint32_t Reserved1
     
    +uint32_t SizeOfImage
     
    +uint32_t SizeOfHeaders
     
    +uint32_t CheckSum
     
    +uint16_t Subsystem
     
    +uint16_t DllCharacteristics
     
    +uint64_t SizeOfStackReserve
     
    +uint64_t SizeOfStackCommit
     
    +uint64_t SizeOfHeapReserve
     
    +uint64_t SizeOfHeapCommit
     
    +uint32_t LoaderFlags
     
    +uint32_t NumberOfRvaAndSizes
     
    +IMAGE_DATA_DIRECTORY DataDirectory [PE_MAX_DIRECTORIES]
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.js b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.js new file mode 100644 index 00000000..fdb4fcc3 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.js @@ -0,0 +1,33 @@ +var structbinlex_1_1IMAGE__OPTIONAL__HEADER__64 = +[ + [ "AddressOfEntryPoint", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#aeb76850325eb5080ff7972da7a3674eb", null ], + [ "BaseOfCode", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#adcc2d19d025718f030828832a0fb3bd3", null ], + [ "CheckSum", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a4e7be40c506ee8bb29f43137197bbf5c", null ], + [ "DataDirectory", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ac0a12f2e31f8ba44399d561dfa891f5a", null ], + [ "DllCharacteristics", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a8a13fdb4527df06d08b90eca3c72254c", null ], + [ "FileAlignment", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ab3de6d20800c87de69f323cfa58eaecc", null ], + [ "ImageBase", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a957fbc1c32f9bf0c3667e859144dba05", null ], + [ "LoaderFlags", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a6bab36ff1dd0bf0c24fe886781133f18", null ], + [ "Magic", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ab0b44c1967b1dc764899d591d4e309ae", null ], + [ "MajorImageVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a76ba7d292683a04ae921f041056ca9c3", null ], + [ "MajorLinkerVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a38a48c8f6e1856b3b80ff05fa803bec9", null ], + [ "MajorOperatingSystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ad62e0ac6b0e8891be7611ff362ea6d50", null ], + [ "MajorSubsystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ac89f65e610fbca1a9f7305335e95e219", null ], + [ "MinorImageVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#aa622e6260138c1311544112269ba19f4", null ], + [ "MinorLinkerVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ab344c503ca8c6a26d7a4dc68fe0f18f5", null ], + [ "MinorOperatingSystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ae4d98b972ab16bb8255f7a69cd142144", null ], + [ "MinorSubsystemVersion", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a6cc10e61dd3e40c7bba65394e35d7b6d", null ], + [ "NumberOfRvaAndSizes", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a37a273a62dcd53e22c1ef6d14d5ea31a", null ], + [ "Reserved1", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a614ef338e04e015c86c02f19672f9c25", null ], + [ "SectionAlignment", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#ab31e872dfe1ef138c5528a7fd12d0658", null ], + [ "SizeOfCode", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a74630eaaab6d3e79b487b0af5a46a01c", null ], + [ "SizeOfHeaders", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a2d31a71936365ad0c609f57e14a112f3", null ], + [ "SizeOfHeapCommit", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a84b67ab92941859e6a728151e9229360", null ], + [ "SizeOfHeapReserve", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a1d5f10703bd7d34858fc3891c4c17ca3", null ], + [ "SizeOfImage", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#aa89083b65c914ece8f348ccdecd2b625", null ], + [ "SizeOfInitializedData", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#aca48ab3ee68a7a9ad763ba0ab40754ac", null ], + [ "SizeOfStackCommit", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a4086fdee92658df806fab62ad9b0b14c", null ], + [ "SizeOfStackReserve", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a245f21abbf0a13efe05b925fcb0f688c", null ], + [ "SizeOfUninitializedData", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a2f3fdc8bcfc58bf9e38a9f0e76014a98", null ], + [ "Subsystem", "structbinlex_1_1IMAGE__OPTIONAL__HEADER__64.html#a1ae63e9ac319669f163c98683037c87f", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER-members.html b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER-members.html new file mode 100644 index 00000000..446f1087 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER-members.html @@ -0,0 +1,116 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + + + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html new file mode 100644 index 00000000..c5ac4a3e --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html @@ -0,0 +1,150 @@ + + + + + + + +binlex: binlex::IMAGE_ROM_OPTIONAL_HEADER Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_ROM_OPTIONAL_HEADER Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint16_t Magic
     
    +uint8_t MajorLinkerVersion
     
    +uint8_t MinorLinkerVersion
     
    +uint32_t SizeOfCode
     
    +uint32_t SizeOfInitializedData
     
    +uint32_t SizeOfUninitializedData
     
    +uint32_t AddressOfEntryPoint
     
    +uint32_t BaseOfCode
     
    +uint32_t BaseOfData
     
    +uint32_t BaseOfBss
     
    +uint32_t GprMask
     
    +uint32_t CprMask [4]
     
    +uint32_t GpValue
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.js b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.js new file mode 100644 index 00000000..e3f20c1c --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.js @@ -0,0 +1,16 @@ +var structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER = +[ + [ "AddressOfEntryPoint", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a5b1b391ff7eea9cda13297915ead07d5", null ], + [ "BaseOfBss", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a16e08fcbbd44166f942ebdd3b4c56fe9", null ], + [ "BaseOfCode", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#aa676243bc9b58016dbbcf4776aeae13d", null ], + [ "BaseOfData", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#ac238f764b283651e30b5ee5c3f3b49d6", null ], + [ "CprMask", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a920e8a8023205885ab0fccc6873b8fab", null ], + [ "GprMask", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#aa4bc1e5d17b8f9ff7e2772b608630347", null ], + [ "GpValue", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a1132b9f3200280a02f3a90d502c315a4", null ], + [ "Magic", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a36677460600ddae786e0a5a955daede5", null ], + [ "MajorLinkerVersion", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a14bae8f2ce98d4c42119b1909be6ce0b", null ], + [ "MinorLinkerVersion", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a01e4728265f1bd463118efe7fddc6a61", null ], + [ "SizeOfCode", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a5da66b259c3c8be8ed5104ad870499f1", null ], + [ "SizeOfInitializedData", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a9eeb0a30cf74c26bc71f66155b9a74c0", null ], + [ "SizeOfUninitializedData", "structbinlex_1_1IMAGE__ROM__OPTIONAL__HEADER.html#a2b3a9d7942a881743e9c2ca982886ee3", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER-members.html b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER-members.html new file mode 100644 index 00000000..9150b28a --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER-members.html @@ -0,0 +1,115 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_SECTION_HEADER Member List
    +
    + +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.html b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.html new file mode 100644 index 00000000..a2f90ec3 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.html @@ -0,0 +1,148 @@ + + + + + + + +binlex: binlex::IMAGE_SECTION_HEADER Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_SECTION_HEADER Struct Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Public Attributes

    +uint8_t Name [PE_SECTION_NAME_SIZE]
     
    +union {
    +   uint32_t   PhysicalAddress
     
    +   uint32_t   VirtualSize
     
    Misc
     
    +uint32_t VirtualAddress
     
    +uint32_t SizeOfRawData
     
    +uint32_t PointerToRawData
     
    +uint32_t PointerToRelocations
     
    +uint32_t PointerToLinenumbers
     
    +uint16_t NumberOfRelocations
     
    +uint16_t NumberOfLinenumbers
     
    +uint32_t Characteristics
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.js b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.js new file mode 100644 index 00000000..01402b01 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__SECTION__HEADER.js @@ -0,0 +1,15 @@ +var structbinlex_1_1IMAGE__SECTION__HEADER = +[ + [ "Characteristics", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a74584ee8934daafa40688fcdf788aee6", null ], + [ "Misc", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a5af29d5cb9dce2afce7579afe19c018b", null ], + [ "Name", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a6080f7deac4d7aac3024484ef2345e33", null ], + [ "NumberOfLinenumbers", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a3e0ed00ddff242a7ce35ae3f71303760", null ], + [ "NumberOfRelocations", "structbinlex_1_1IMAGE__SECTION__HEADER.html#ab357852916de571a8d8525f9608cdf46", null ], + [ "PhysicalAddress", "structbinlex_1_1IMAGE__SECTION__HEADER.html#ad2e3ca7781f564588610634bba1aa643", null ], + [ "PointerToLinenumbers", "structbinlex_1_1IMAGE__SECTION__HEADER.html#abcb943c84427f0e65986c175c0f8e234", null ], + [ "PointerToRawData", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a0a95d13efde8f0c0048b10374773f14e", null ], + [ "PointerToRelocations", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a1c5c472cb2b4cabf3c82c3ab487b07c9", null ], + [ "SizeOfRawData", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a249070d354ed04786e115c9ac6d0872f", null ], + [ "VirtualAddress", "structbinlex_1_1IMAGE__SECTION__HEADER.html#ad4f3adab47ba4fbbff7967334a55c77e", null ], + [ "VirtualSize", "structbinlex_1_1IMAGE__SECTION__HEADER.html#a84096c237b02932873c84af2c3470105", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32-members.html b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32-members.html new file mode 100644 index 00000000..c5e0a6e4 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32-members.html @@ -0,0 +1,109 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_TLS_DIRECTORY32 Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_TLS_DIRECTORY32, including all inherited members.

    + + + + + + + +
    AddressOfCallBacks (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    AddressOfIndex (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    Characteristics (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    EndAddressOfRawData (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    SizeOfZeroFill (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    StartAddressOfRawData (defined in binlex::IMAGE_TLS_DIRECTORY32)binlex::IMAGE_TLS_DIRECTORY32
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.html b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.html new file mode 100644 index 00000000..b53c4efb --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.html @@ -0,0 +1,129 @@ + + + + + + + +binlex: binlex::IMAGE_TLS_DIRECTORY32 Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_TLS_DIRECTORY32 Struct Reference
    +
    +
    + + + + + + + + + + + + + + +

    +Public Attributes

    +uint32_t StartAddressOfRawData
     
    +uint32_t EndAddressOfRawData
     
    +uint32_t AddressOfIndex
     
    +uint32_t AddressOfCallBacks
     
    +uint32_t SizeOfZeroFill
     
    +uint32_t Characteristics
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.js b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.js new file mode 100644 index 00000000..c57f9087 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY32.js @@ -0,0 +1,9 @@ +var structbinlex_1_1IMAGE__TLS__DIRECTORY32 = +[ + [ "AddressOfCallBacks", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#a83fc9eea32d4679c23cef86a413d0b0c", null ], + [ "AddressOfIndex", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#ac65076b2a36d1e0617d1dae341ff954f", null ], + [ "Characteristics", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#a7a2b56d015610f4d388c142b64d9da48", null ], + [ "EndAddressOfRawData", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#acac7dba33fdc5518de26e54abdac7031", null ], + [ "SizeOfZeroFill", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#a66becd44c7b39f78d94327df06abd4da", null ], + [ "StartAddressOfRawData", "structbinlex_1_1IMAGE__TLS__DIRECTORY32.html#a4b9680864de2fd27d337e3f1cdc4ced7", null ] +]; \ No newline at end of file diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64-members.html b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64-members.html new file mode 100644 index 00000000..80ad163a --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64-members.html @@ -0,0 +1,109 @@ + + + + + + + +binlex: Member List + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    binlex::IMAGE_TLS_DIRECTORY64 Member List
    +
    +
    + +

    This is the complete list of members for binlex::IMAGE_TLS_DIRECTORY64, including all inherited members.

    + + + + + + + +
    AddressOfCallBacks (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    AddressOfIndex (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    Characteristics (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    EndAddressOfRawData (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    SizeOfZeroFill (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    StartAddressOfRawData (defined in binlex::IMAGE_TLS_DIRECTORY64)binlex::IMAGE_TLS_DIRECTORY64
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.html b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.html new file mode 100644 index 00000000..2e4bc846 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.html @@ -0,0 +1,129 @@ + + + + + + + +binlex: binlex::IMAGE_TLS_DIRECTORY64 Struct Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    binlex +
    +
    +
    + + + + + + + +
    +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    + +
    +
    binlex::IMAGE_TLS_DIRECTORY64 Struct Reference
    +
    +
    + + + + + + + + + + + + + + +

    +Public Attributes

    +uint64_t StartAddressOfRawData
     
    +uint64_t EndAddressOfRawData
     
    +uint64_t AddressOfIndex
     
    +uint64_t AddressOfCallBacks
     
    +uint32_t SizeOfZeroFill
     
    +uint32_t Characteristics
     
    +
    The documentation for this struct was generated from the following file: +
    +
    + + + + diff --git a/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.js b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.js new file mode 100644 index 00000000..4dc074c3 --- /dev/null +++ b/docs/html/structbinlex_1_1IMAGE__TLS__DIRECTORY64.js @@ -0,0 +1,9 @@ +var structbinlex_1_1IMAGE__TLS__DIRECTORY64 = +[ + [ "AddressOfCallBacks", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#a964ff6a165b3909037aadb03655ea88d", null ], + [ "AddressOfIndex", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#a0c4b35df77306f36e4f36a8f1ac70c59", null ], + [ "Characteristics", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#a51aeaa162a91ad24c5825115b2fadedf", null ], + [ "EndAddressOfRawData", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#a6a3c0df0d6d7db1ce70543d55b4d88dd", null ], + [ "SizeOfZeroFill", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#a062ec03bd2669357902981a84032cd4a", null ], + [ "StartAddressOfRawData", "structbinlex_1_1IMAGE__TLS__DIRECTORY64.html#ab46854e2997df5e960068359792d2601", null ] +]; \ No newline at end of file diff --git a/docs/html/sync_off.png b/docs/html/sync_off.png new file mode 100644 index 00000000..9fc7d81b --- /dev/null +++ b/docs/html/sync_off.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39bcba0c183ec442cc90fe27a2dbafd4e1c791aff374b5326ba16880a16d9826 +size 853 diff --git a/docs/html/sync_on.png b/docs/html/sync_on.png new file mode 100644 index 00000000..c93c8e2d --- /dev/null +++ b/docs/html/sync_on.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9abb731904dd1f8eb00aaea66bfef72d5252931d84cc01cfabde3bea854b5b14 +size 845 diff --git a/docs/html/tab_a.png b/docs/html/tab_a.png new file mode 100644 index 00000000..2997353b --- /dev/null +++ b/docs/html/tab_a.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ddd37bdced843340e0679b6b4e7ed2fe318fd0cef76d160543722e0c3eac11f +size 142 diff --git a/docs/html/tab_b.png b/docs/html/tab_b.png new file mode 100644 index 00000000..97ef1fbe --- /dev/null +++ b/docs/html/tab_b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:901ae15db25905dca7a17b81c6d51869fd12ea569fc4b072d217786b4b4d73bd +size 169 diff --git a/docs/html/tab_h.png b/docs/html/tab_h.png new file mode 100644 index 00000000..62f82716 --- /dev/null +++ b/docs/html/tab_h.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4b9bd9425bc87b33d6b1911e6398673939aa2f15ac505b9a1ab029b8452dd08 +size 177 diff --git a/docs/html/tab_s.png b/docs/html/tab_s.png new file mode 100644 index 00000000..e7f57661 --- /dev/null +++ b/docs/html/tab_s.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69f392daa28adc942272615ff2db16bcf084f01ec9fcc2f7f6a632b2bba8c468 +size 184 diff --git a/docs/html/tabs.css b/docs/html/tabs.css new file mode 100644 index 00000000..7d45d36c --- /dev/null +++ b/docs/html/tabs.css @@ -0,0 +1 @@ +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0px/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0px 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0px 1px 1px rgba(255,255,255,0.9);color:#283A5D;outline:none}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a.current{color:#D23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media (min-width: 768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283A5D transparent transparent transparent;background:transparent;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0px 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox a:hover span.sub-arrow{border-color:#fff transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;border-radius:5px !important;box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:#fff;text-shadow:0px 1px 1px #000}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #fff}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #D23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#D23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..cfd32901 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,2 @@ + + diff --git a/docs/oalabs.pdf b/docs/oalabs.pdf new file mode 100644 index 00000000..efef457a Binary files /dev/null and b/docs/oalabs.pdf differ diff --git a/docs/theme b/docs/theme new file mode 160000 index 00000000..b6a33731 --- /dev/null +++ b/docs/theme @@ -0,0 +1 @@ +Subproject commit b6a337311ec3bbc5603fa2ce541850a603844e58 diff --git a/include/args.h b/include/args.h new file mode 100644 index 00000000..dba60e5c --- /dev/null +++ b/include/args.h @@ -0,0 +1,40 @@ +#ifndef ARGS_H +#define ARGS_H + +#define ARGS_MODE_COUNT 7 + +#define ARGS_IO_TYPE_UNKNOWN 0 +#define ARGS_IO_TYPE_FILE 1 +#define ARGS_IO_TYPE_DIR 2 + +/** +* @namespace binlex +* @brief the binlex namespace +*/ +namespace binlex{ + class Args { + public: + char version[7] = "v1.1.0"; + const char *modes[ARGS_MODE_COUNT] = {"elf:x86", "elf:x86_64", "pe:x86", "pe:x86_64", "raw:x86", "raw:x86_64", "raw:cil"}; + struct{ + char *input; + int io_type; + char *output; + unsigned int threads; + bool help; + bool list_modes; + char *mode; + bool pretty; + } options; + Args(); + void SetDefault(); + bool check_mode(char *mode); + int is_file(const char *path); + int is_dir(const char *path); + void set_io_type(char *input); + void print_help(); + void parse(int argc, char **argv); + ~Args(); + }; +} +#endif diff --git a/include/blelf.h b/include/blelf.h new file mode 100644 index 00000000..ab56fbbd --- /dev/null +++ b/include/blelf.h @@ -0,0 +1,42 @@ +#include +#include + +#ifndef ELF_H +#define ELF_H + +#define ELF_MAX_SECTIONS 32 + +#define ELF_MODE_UNSET 0 +#define ELF_MODE_X86 1 +#define ELF_MODE_X86_64 2 + +namespace binlex{ + class Elf{ + private: + struct Section { + uint offset; + int size; + void *data; + }; + bool is_arch(int arch); + bool is_elf(); + void SetSectionsDefault(); + unsigned int GetSectionTableSize(); + bool ReadSectionHeaders(); + bool GetExecutableData(); + public: + char magic[4] = {0x7F, 0x45, 0x4C, 0x46}; + FILE *fd = NULL; + void *header = NULL; + void *sh_table = NULL; + char *sh_str = NULL; + int mode = ELF_MODE_UNSET; + struct Section sections[ELF_MAX_SECTIONS]; + Elf(); + bool Setup(int input_mode); + bool ReadFile(char *file_path); + ~Elf(); + }; + /*! @} End of Doxygen Groups*/ +} +#endif diff --git a/src/parser.h b/include/cil.h similarity index 100% rename from src/parser.h rename to include/cil.h diff --git a/include/common.h b/include/common.h new file mode 100644 index 00000000..8032c1b0 --- /dev/null +++ b/include/common.h @@ -0,0 +1,75 @@ +#include +#include + +#ifndef COMMON_H +#define COMMON_H + +using namespace std; + +namespace binlex { + class Common{ + /** + This class contains methods common to binlex. + */ + public: + /** + This method takes an input string and returns its sha256 hash. + @param trait input string. + @return Returns the sha256 hash of the trait string + */ + string SHA256(const char *trait); + /** + This method takes an input trait string and returns a char vector of bytes (ignores wildcards). + @param trait input string. + @return Returns char vector of bytes + */ + vector TraitToChar(string trait); + /** + This method removes wildcards from a trait string. + @param trait input trait string. + @return Returns trait without wildcards + */ + string RemoveWildcards(string trait); + /** + This method gets the size in bytes of a trait string (includes wildcards). + @param trait input trait string. + @return Returns uint size of bytes + */ + uint GetByteSize(string s); + /** + This method removes spaces from a string. + @param s input string + @return Returns string without spaces + */ + string RemoveSpaces(string s); + /** + This method wildcards byte strings for traits. + @param trait input trait string + @param bytes byte string to wildcard + @return Returns wildcarded trait string + */ + string WildcardTrait(string trait, string bytes); + /** + This method removes whitespace on the right. + @param s input string + @return Returns string with whitespace on right trimmed + */ + string TrimRight(const std::string &s); + /** + This method creates a byte string based on a pointer and its size. + @param data A pointer to the data + @param size The size of the data to collect + @return Returns a byte string of the selected data + */ + string HexdumpBE(const void *data, size_t size); + /** + This method prints hexdump to stdout. + @param desc A description of the data. + @param data A pointer to the data + @param size The size of the data to collect + */ + void Hexdump(const char * desc, const void * addr, const int len); + }; +} + +#endif diff --git a/include/decompiler.h b/include/decompiler.h new file mode 100644 index 00000000..e128d5e1 --- /dev/null +++ b/include/decompiler.h @@ -0,0 +1,49 @@ +#include +#include "json.h" + +#ifndef DECOMPILER_H +#define DECOMPILER_H + +#define DECOMPILER_TYPE_FUNCS 0 +#define DECOMPILER_TYPE_BLCKS 1 +#define DECOMPILER_TYPE_UNSET 2 +#define DECOMPILER_TYPE_ALL 3 + +#define DECOMPILER_MAX_SECTIONS 256 + +using namespace std; +using json = nlohmann::json; + +namespace binlex{ + class Decompiler{ + private: + struct Section { + json traits; + vector visited; + }; + string sha256(const char *trait); + float entropy(string trait); + vector t2c(string trait); + string rs(string s); + string rwc(string s); + uint trait_size(string s); + string rtrim(const std::string &s); + string hexdump_be(const void *data, size_t size, bool cont); + string hexdump_mem_disp(uint64_t disp); + string wildcard_bytes(string bytes, string sub_bytes); + string wildcard_all(string bytes); + json GetTraits(); + public: + csh handle; + cs_err status; + uint64_t pc; + struct Section sections[DECOMPILER_MAX_SECTIONS]; + Decompiler(); + bool Setup(cs_arch arch, cs_mode mode); + int x86_64(void *data, size_t data_size, size_t data_offset, uint index); + void PrintTraits(bool pretty); + void WriteTraits(char *file_path, bool pretty); + ~Decompiler(); + }; +} +#endif diff --git a/include/decompiler_rev.h b/include/decompiler_rev.h new file mode 100644 index 00000000..db8edaf6 --- /dev/null +++ b/include/decompiler_rev.h @@ -0,0 +1,61 @@ +#include +#include +#include "common.h" + +#ifndef DECOMPILER_REV_H +#define DECOMPILER_REV_H + +#define DECOMPILER_REV_MAX_SECTIONS 256 + +using namespace std; +using json = nlohmann::json; + +namespace binlex { + class DecompilerREV{ + private: + json GetTraits(); + public: + struct Section { + csh handle; + cs_err status; + json traits; + uint offset; + uint64_t pc; + size_t code_size; + size_t data_size; + size_t data_offset; + void *data; + const uint8_t *code; + uint b_edges; + uint f_edges; + bool b_end; + bool f_end; + uint b_count; + uint b_insn_count; + uint f_insn_count; + string b_trait; + string b_bytes; + string f_trait; + string f_bytes; + vector blocks; + vector functions; + vector visited; + }; + struct Section sections[DECOMPILER_REV_MAX_SECTIONS]; + Common common; + DecompilerREV(); + bool Setup(cs_arch arch, cs_mode mode, uint index); + void ClearBlock(uint index); + void ClearTrait(uint index); + void AddEdges(uint count, uint index); + void CollectBlockTrait(uint index); + void CollectFunctionTrait(uint index); + void PrintTraits(bool pretty); + void WriteTraits(char *file_path, bool pretty); + uint Decompile(void *data, size_t data_size, size_t data_offset, uint index); + void Seek(uint offset, uint index); + ~DecompilerREV(); + + }; +} +#endif diff --git a/src/json.h b/include/json.h similarity index 100% rename from src/json.h rename to include/json.h diff --git a/include/jvm.h b/include/jvm.h new file mode 100644 index 00000000..e69de29b diff --git a/src/pe.h b/include/pe.h similarity index 69% rename from src/pe.h rename to include/pe.h index 22edbe14..bc5ca0d6 100644 --- a/src/pe.h +++ b/include/pe.h @@ -1,9 +1,6 @@ #include -#include #include -#include #include -#include "common.h" #ifndef PE_H #define PE_H @@ -19,6 +16,8 @@ #define PE_SECTION_NAME_SIZE 8 #define PE_MAX_DIRECTORIES 16 +namespace binlex{ + typedef enum { IMAGE_DIRECTORY_ENTRY_EXPORT = 0, // Export Table IMAGE_DIRECTORY_ENTRY_IMPORT = 1, // Import Table @@ -407,167 +406,31 @@ typedef struct { uint32_t Characteristics; // SectionCharacteristics } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; -// typedef struct { -// IMAGE_DOS_HEADER dos_hdr; -// uint32_t signature; -// IMAGE_COFF_HEADER coff_hdr; -// void *optional_hdr_ptr; -// IMAGE_OPTIONAL_HEADER optional_hdr; -// uint32_t num_directories; -// void *directories_ptr; -// IMAGE_DATA_DIRECTORY **directories; -// uint16_t num_sections; -// void *sections_ptr; -// IMAGE_SECTION_HEADER **sections; -// uint64_t entrypoint; -// uint64_t imagebase; -// } PE_HEADER, *PPE_HEADER; - -class Pe { +class Pe{ private: struct Section { - int offset; + uint offset; int size; void *data; }; - bool is_pe(){ - if (dos_header->e_magic != 23117 || - coff_header->Signature != 17744){ - return false; - } - return true; - } + bool is_pe(); public: - char magic_mz[2] = {0x5a, 0x4d}; - char magic_pe[4] = {0x00, 0x00, 0x45, 0x50}; - FILE *fd = NULL; - PIMAGE_DOS_HEADER dos_header = NULL; + char magic_mz[2] = {0x5a, 0x4d}; + char magic_pe[4] = {0x00, 0x00, 0x45, 0x50}; + FILE *fd = NULL; + PIMAGE_DOS_HEADER dos_header = NULL; PIMAGE_COFF_HEADER coff_header = NULL; - uint32_t pe_header_ptr = 0; + uint32_t pe_header_ptr = 0; PIMAGE_OPTIONAL_HEADER_32 optional_header_32 = NULL; PIMAGE_OPTIONAL_HEADER_64 optional_header_64 = NULL; PIMAGE_SECTION_HEADER section_header = NULL; - int mode = PE_MODE_UNSET; + int mode = PE_MODE_UNSET; struct Section sections[PE_MAX_SECTIONS]; - Pe(){ - for (int i = 0; i < PE_MAX_SECTIONS; i++){ - sections[i].size = 0; - sections[i].offset = 0; - sections[i].data = NULL; - } - } - bool Setup(int input_mode){ - dos_header = (PIMAGE_DOS_HEADER)malloc(sizeof(IMAGE_DOS_HEADER)); - coff_header = (PIMAGE_COFF_HEADER)malloc(sizeof(IMAGE_COFF_HEADER)); - section_header = (PIMAGE_SECTION_HEADER)malloc(sizeof(IMAGE_SECTION_HEADER)); - switch(input_mode){ - case PE_MODE_X86: - mode = PE_MODE_X86; - break; - case PE_MODE_X86_64: - mode = PE_MODE_X86_64; - break; - default: - fprintf(stderr, "[x] unsupported elf executable mode\n"); - mode = PE_MODE_UNSET; - return false; - } - return true; - } - bool ReadFile(char *file_path){ - fd = fopen(file_path, "rb"); - if (fd == NULL){ - fprintf(stderr, "[x] failed to open %s\n", file_path); - return false; - } - fread(dos_header, sizeof(IMAGE_DOS_HEADER), 1, fd); - fseek(fd, dos_header->e_lfanew, SEEK_SET); - fread(coff_header, sizeof(IMAGE_COFF_HEADER), 1, fd); - if (is_pe() == false){ - fprintf(stderr, "[x] %s is not a valid pe file\n", file_path); - return false; - } - if (mode == PE_MODE_X86 && coff_header->Machine != IMAGE_FILE_MACHINE_I386){ - fprintf(stderr, "[x] %s is not a valid x86 pe file\n", file_path); - return false; - } - if (mode == PE_MODE_X86_64 && coff_header->Machine != IMAGE_FILE_MACHINE_AMD64){ - fprintf(stderr, "[x] %s is not a valid x86_64 pe file\n", file_path); - return false; - } - if (mode == PE_MODE_X86 && coff_header->Machine == IMAGE_FILE_MACHINE_I386){ - optional_header_32 = (PIMAGE_OPTIONAL_HEADER_32)malloc(sizeof(IMAGE_OPTIONAL_HEADER_32)); - if (fread(optional_header_32, sizeof(IMAGE_OPTIONAL_HEADER_32), 1, fd) <= 0){ - fprintf(stderr, "[x] failed to read %s optional_header_64\n", file_path); - return false; - } - } - if (mode == PE_MODE_X86_64 && coff_header->Machine == IMAGE_FILE_MACHINE_AMD64){ - optional_header_64 = (PIMAGE_OPTIONAL_HEADER_64)malloc(sizeof(IMAGE_OPTIONAL_HEADER_64)); - if (fread(optional_header_64, sizeof(IMAGE_OPTIONAL_HEADER_64), 1, fd) <= 0){ - fprintf(stderr, "[x] failed to read %s optional_header_64\n", file_path); - return false; - } - } - for (int i = 0; i < coff_header->NumberOfSections; i++){ - if (fread(section_header, sizeof(IMAGE_SECTION_HEADER), 1, fd) <= 0){ - fprintf(stderr, "[x] failed to read %s section_header\n", file_path); - return false; - } - if (section_header->Characteristics & IMAGE_SCN_MEM_EXECUTE){ - int set = ftell(fd); - fseek(fd, section_header->PointerToRawData, SEEK_SET); - sections[i].offset = section_header->PointerToRawData; - sections[i].size = section_header->SizeOfRawData; - sections[i].data = malloc(section_header->SizeOfRawData); - if (sections[i].data == NULL){ - fprintf(stderr, "[x] failed to allocate section memory\n"); - return false; - } - memset(sections[i].data, 0, sections[i].size); - if (fread(sections[i].data, sections[i].size, 1, fd) <= 0){ - fprintf(stderr, "[x] failed to read %s executable section\n", file_path); - return false; - } - //printf("PointerToRawData: %x\n", section_header->PointerToRawData); - //printf("SizeofRawData : %d\n", section_header->SizeOfRawData); - //common_hex_dump((char *)"section", sections[i].data, sections[i].size); - fseek(fd, set, SEEK_SET); - } - - } - return true; - } - ~Pe(){ - if (dos_header != NULL){ - free(dos_header); - dos_header = NULL; - } - if (coff_header != NULL){ - free(coff_header); - coff_header = NULL; - } - if (optional_header_32 != NULL){ - free(optional_header_32); - optional_header_32 = NULL; - } - if (optional_header_64 != NULL){ - free(optional_header_64); - optional_header_64 = NULL; - } - if (section_header != NULL){ - free(section_header); - section_header = NULL; - } - for (int i = 0; i < PE_MAX_SECTIONS; i++){ - if (sections[i].data != NULL){ - free(sections[i].data); - sections[i].size = 0; - sections[i].offset = 0; - sections[i].data = NULL; - } - } - } + Pe(); + bool Setup(int input_mode); + bool ReadFile(char *file_path); + ~Pe(); }; +} #endif diff --git a/include/raw.h b/include/raw.h new file mode 100644 index 00000000..7df57d5b --- /dev/null +++ b/include/raw.h @@ -0,0 +1,26 @@ +#include +#include + +#ifndef RAW_H +#define RAW_H + +#define RAW_MAX_SECTIONS 128 + +namespace binlex{ + class Raw{ + private: + struct Section { + void *data; + int size; + uint offset; + }; + int GetFileSize(FILE *fd); + public: + struct Section sections[RAW_MAX_SECTIONS]; + Raw(); + bool ReadFile(char *file_path, int section_index); + ~Raw(); + }; +} + +#endif diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 42ad8630..00000000 --- a/main.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "src/elf.h" -#include "src/pe.h" -#include "src/raw.h" -#include "src/macho.h" -#include "src/decompiler.h" -#include "src/args.h" -#include "src/cil.h" -#include "src/json.h" - -using json = nlohmann::json; -using namespace std; - -int main(int argc, char **argv){ - Args args; - args.parse(argc, argv); - if (strcmp(args.options.mode, (char *)"elf:x86_64") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - Elf elf64; - - if (elf64.Setup(ELF_MODE_X86_64) == false){ - return 1; - } - if (elf64.ReadFile(args.options.input) == false){ - return 1; - } - if (elf64.GetExecutableData() == false){ - return 1; - } - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_64); - for (int i = 0; i < ELF_MAX_SECTIONS; i++){ - if (elf64.sections[i].data != NULL){ - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, elf64.sections[i].data, elf64.sections[i].size, i); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, elf64.sections[i].data, elf64.sections[i].size, i); - } - } - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - if (strcmp(args.options.mode, (char *)"elf:x86") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - int result = false; - Elf elf32; - if (elf32.Setup(ELF_MODE_X86) == false){ - return 1; - } - if (elf32.ReadFile(args.options.input) == false){ - return 1; - } - if (elf32.GetExecutableData() == false){ - return 1; - } - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_32); - for (int i = 0; i < ELF_MAX_SECTIONS; i++){ - if (elf32.sections[i].data != NULL){ - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, elf32.sections[i].data, elf32.sections[i].size, i); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, elf32.sections[i].data, elf32.sections[i].size, i); - } - } - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - if (strcmp(args.options.mode, (char *)"pe:x86") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - int result = false; - Pe pe32; - if (pe32.Setup(PE_MODE_X86) == false){ - return 1; - } - if (pe32.ReadFile(args.options.input) == false){ - return 1; - } - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_32); - for (int i = 0; i < PE_MAX_SECTIONS; i++){ - if (pe32.sections[i].data != NULL){ - //common_hex_dump((char *)"section", pe32.sections[i].data, pe32.sections[i].size); - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, pe32.sections[i].data, pe32.sections[i].size, i); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, pe32.sections[i].data, pe32.sections[i].size, i); - } - } - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - if (strcmp(args.options.mode, (char *)"pe:x86_64") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - int result = false; - Pe pe64; - if (pe64.Setup(PE_MODE_X86_64) == false){ - return 1; - } - if (pe64.ReadFile(args.options.input) == false){ - return 1; - } - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_64); - for (int i = 0; i < PE_MAX_SECTIONS; i++){ - if (pe64.sections[i].data != NULL){ - //common_hex_dump((char *)"section", pe64.sections[i].data, pe64.sections[i].size); - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, pe64.sections[i].data, pe64.sections[i].size, i); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, pe64.sections[i].data, pe64.sections[i].size, i); - } - } - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - if (strcmp(args.options.mode, (char *)"raw:x86") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - Raw rawx86; - rawx86.ReadFile(args.options.input, 0); - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_32); - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, rawx86.sections[0].data, rawx86.sections[0].size, 0); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, rawx86.sections[0].data, rawx86.sections[0].size, 0); - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - if (strcmp(args.options.mode, (char *)"raw:x86_64") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - Raw rawx86_64; - rawx86_64.ReadFile(args.options.input, 0); - Decompiler decompiler; - decompiler.Setup(CS_ARCH_X86, CS_MODE_64); - decompiler.x86_64(DECOMPILER_TYPE_FUNCS, rawx86_64.sections[0].data, rawx86_64.sections[0].size, 0); - decompiler.x86_64(DECOMPILER_TYPE_BLCKS, rawx86_64.sections[0].data, rawx86_64.sections[0].size, 0); - if (args.options.output == NULL){ - decompiler.PrintTraits(DECOMPILER_TYPE_ALL); - } else { - decompiler.WriteTraits(args.options.output); - } - return 0; - } - // if (strcmp(args.options.mode, (char *)"macho:x86_64") == 0 && - // args.options.io_type == ARGS_IO_TYPE_FILE){ - // Macho machox86_64; - // machox86_64.Setup(MACHO_MODE_X86_64); - // machox86_64.ReadFile(args.options.input, 0); - // } - if (strcmp(args.options.mode, (char *)"raw:cil") == 0 && - args.options.io_type == ARGS_IO_TYPE_FILE){ - Raw raw_cil; - if (raw_cil.ReadFile(args.options.input, 0) == false){ - return 1; - } - CILDecompiler cil_decompiler; - if (cil_decompiler.Setup(CIL_DECOMPILER_TYPE_BLCKS) == false){ - return 1; - } - if (cil_decompiler.Decompile(raw_cil.sections[0].data, raw_cil.sections[0].size, 0) == false){ - return 1; - } - if (cil_decompiler.Setup(CIL_DECOMPILER_TYPE_FUNCS) == false){ - return 1; - } - if (cil_decompiler.Decompile(raw_cil.sections[0].data, raw_cil.sections[0].size, 0) == false){ - return 1; - } - if (args.options.output == NULL){ - cil_decompiler.PrintTraits(); - } else { - cil_decompiler.WriteTraits(args.options.output); - } - return 0; - } - args.print_help(); - return 0; -} diff --git a/src/args.cpp b/src/args.cpp new file mode 100644 index 00000000..81e63b1e --- /dev/null +++ b/src/args.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include +#include "args.h" + +using namespace binlex; + +Args::Args(){ + SetDefault(); +} + +void Args::SetDefault(){ + options.input = NULL; + options.threads = 1; + options.help = false; + options.output = NULL; + options.list_modes = false; + options.mode = NULL; + options.io_type = ARGS_IO_TYPE_UNKNOWN; + options.pretty = false; +} + +bool Args::check_mode(char *mode){ + for (int i = 0; i < ARGS_MODE_COUNT; i++){ + if (strcmp(modes[i], mode) == 0){ + return true; + } + } + return false; +} + +int Args::is_file(const char *path){ + struct stat path_stat; + if (stat(path, &path_stat) != 0){ + return 0; + } + return S_ISREG(path_stat.st_mode); +} + +int Args::is_dir(const char *path) { + struct stat statbuf; + if (stat(path, &statbuf) != 0){ + return 0; + } + return S_ISDIR(statbuf.st_mode); +} + +void Args::set_io_type(char *input){ + if (is_file(input) != 0){ + options.io_type = ARGS_IO_TYPE_FILE; + } else if (is_dir(input) != 0){ + options.io_type = ARGS_IO_TYPE_DIR; + } else{ + options.io_type = ARGS_IO_TYPE_UNKNOWN; + fprintf(stderr, "unknown input type\n"); + exit(1); + } +} + +void Args::print_help(){ + printf( + "binlex %s - A Binary Genetic Traits Lexer\n" + " -i --input\t\tinput file\t\t(required)\n" + " -m --mode\t\tset mode\t\t(required)\n" + " -lm --list-modes\tlist modes\n" + " -h --help\t\tdisplay help\n" + " -o --output\t\toutput file\t\t(optional)\n" + " -p --pretty\t\tpretty output\t\t(optional)\n" + " -v --version\t\tdisplay version\n" + "Author: @c3rb3ru5d3d53c\n", + version + ); +} + +void Args::parse(int argc, char **argv){ + if (argc < 2){ + print_help(); + exit(0); + } + for (int i = 0; i < argc; i++){ + if (strcmp(argv[i], (char *)"-h") == 0 || + strcmp(argv[i], (char *)"--help") == 0){ + options.help = true; + print_help(); + exit(0); + } + if (strcmp(argv[i], (char *)"-v") == 0 || + strcmp(argv[i], (char *)"--version") == 0){ + options.help = true; + printf("%s\n", version); + exit(0); + } + if (strcmp(argv[i], (char *)"-lm") == 0 || + strcmp(argv[i], (char *)"--list-modes") == 0){ + options.list_modes = true; + for (int j = 0; j < ARGS_MODE_COUNT; j++){ + printf("%s\n", modes[j]); + } + exit(0); + } + if (strcmp(argv[i], (char *)"-i") == 0 || + strcmp(argv[i], (char *)"--input") == 0){ + options.input = argv[i+1]; + set_io_type(options.input); + } + if (strcmp(argv[i], (char *)"-p") == 0 || + strcmp(argv[i], (char *)"--pretty") == 0){ + options.pretty = true; + } + if (strcmp(argv[i], (char *)"-o") == 0 || + strcmp(argv[i], (char *)"--output") == 0){ + options.output = argv[i+1]; + } + if (strcmp(argv[i], (char *)"-m") == 0 || + strcmp(argv[i], (char *)"--mode") == 0){ + options.mode = argv[i+1]; + if (check_mode(options.mode) == false){ + fprintf(stderr, "%s is an invalid mode\n", options.mode); + exit(1); + } + } + } +} + +Args::~Args(){ + SetDefault(); +} diff --git a/src/args.h b/src/args.h deleted file mode 100644 index 07580c1f..00000000 --- a/src/args.h +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#ifndef ARGS_H -#define ARGS_H - -#define ARGS_MODE_COUNT 7 - -#define ARGS_IO_TYPE_UNKNOWN 0 -#define ARGS_IO_TYPE_FILE 1 -#define ARGS_IO_TYPE_DIR 2 - -class Args{ - private: - void SetDefault(){ - options.input = NULL; - options.threads = 1; - options.help = false; - options.output = NULL; - options.list_modes = false; - options.mode = NULL; - options.io_type = ARGS_IO_TYPE_UNKNOWN; - } - bool check_mode(char *mode){ - for (int i = 0; i < ARGS_MODE_COUNT; i++){ - if (strcmp(modes[i], mode) == 0){ - return true; - } - } - return false; - } - int is_file(const char *path){ - struct stat path_stat; - if (stat(path, &path_stat) != 0){ - return 0; - } - return S_ISREG(path_stat.st_mode); - } - int is_dir(const char *path) { - struct stat statbuf; - if (stat(path, &statbuf) != 0){ - return 0; - } - return S_ISDIR(statbuf.st_mode); - } - void set_io_type(char *input){ - if (is_file(input) != 0){ - options.io_type = ARGS_IO_TYPE_FILE; - } else if (is_dir(input) != 0){ - options.io_type = ARGS_IO_TYPE_DIR; - } else{ - options.io_type = ARGS_IO_TYPE_UNKNOWN; - fprintf(stderr, "unknown input type\n"); - exit(1); - } - } - public: - char version[7] = "v1.0.1"; - const char *modes[ARGS_MODE_COUNT] = {"elf:x86", "elf:x86_64", "pe:x86", "pe:x86_64", "raw:x86", "raw:x86_64", "raw:cil"}; - struct{ - char *input; - int io_type; - char *output; - unsigned int threads; - bool help; - bool list_modes; - char *mode; - } options; - Args(){ - SetDefault(); - } - void print_help(){ - printf( - "binlex %s - A Binary Genetic Traits Lexer\n" - " -i --input\t\tinput file\t\t(required)\n" - " -m --mode\t\tset mode\t\t(required)\n" - " -lm --list-modes\tlist modes\n" - " -h --help\t\tdisplay help\n" - " -o --output\t\toutput file\t\t(optional)\n" - " -v --version\t\tdisplay version\n" - "Author: @c3rb3ru5d3d53c\n", - version - ); - } - - void parse(int argc, char **argv){ - if (argc < 2){ - print_help(); - exit(0); - } - for (int i = 0; i < argc; i++){ - if (strcmp(argv[i], (char *)"-h") == 0 || - strcmp(argv[i], (char *)"--help") == 0){ - options.help = true; - print_help(); - exit(0); - } - if (strcmp(argv[i], (char *)"-v") == 0 || - strcmp(argv[i], (char *)"--version") == 0){ - options.help = true; - printf("%s\n", version); - exit(0); - } - if (strcmp(argv[i], (char *)"-lm") == 0 || - strcmp(argv[i], (char *)"--list-modes") == 0){ - options.list_modes = true; - for (int j = 0; j < ARGS_MODE_COUNT; j++){ - printf("%s\n", modes[j]); - } - exit(0); - } - if (strcmp(argv[i], (char *)"-i") == 0 || - strcmp(argv[i], (char *)"--input") == 0){ - options.input = argv[i+1]; - set_io_type(options.input); - } - if (strcmp(argv[i], (char *)"-t") == 0 || - strcmp(argv[i], (char *)"--threads") == 0){ - options.threads = atoi(argv[i+1]); - } - if (strcmp(argv[i], (char *)"-o") == 0 || - strcmp(argv[i], (char *)"--output") == 0){ - options.output = argv[i+1]; - } - if (strcmp(argv[i], (char *)"-m") == 0 || - strcmp(argv[i], (char *)"--mode") == 0){ - options.mode = argv[i+1]; - if (check_mode(options.mode) == false){ - fprintf(stderr, "%s is an invalid mode\n", options.mode); - exit(1); - } - } - } - } - ~Args(){ - SetDefault(); - } -}; - -#endif diff --git a/src/binlex.cpp b/src/binlex.cpp new file mode 100644 index 00000000..974b0b2c --- /dev/null +++ b/src/binlex.cpp @@ -0,0 +1,147 @@ +#include +#include +#include "args.h" +#include "decompiler.h" +#include "raw.h" +#include "pe.h" +#include "blelf.h" +#include "common.h" + +using namespace binlex; + +int main(int argc, char **argv){ + Args args; + Common common; + args.parse(argc, argv); + if (args.options.mode == NULL){ + args.print_help(); + return 1; + } + if (strcmp(args.options.mode, (char *)"elf:x86_64") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Elf elfx86_64; + if (elfx86_64.Setup(ELF_MODE_X86_64) == false){ + return 1; + } + if (elfx86_64.ReadFile(args.options.input) == false){ + return 1; + } + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_64); + for (int i = 0; i < ELF_MAX_SECTIONS; i++){ + if (elfx86_64.sections[i].data != NULL){ + decompiler.x86_64(elfx86_64.sections[i].data, elfx86_64.sections[i].size, elfx86_64.sections[i].offset, i); + } + } + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"elf:x86") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Elf elfx86; + if (elfx86.Setup(ELF_MODE_X86) == false){ + return 1; + } + if (elfx86.ReadFile(args.options.input) == false){ + return 1; + } + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_32); + for (int i = 0; i < ELF_MAX_SECTIONS; i++){ + if (elfx86.sections[i].data != NULL){ + decompiler.x86_64(elfx86.sections[i].data, elfx86.sections[i].size, elfx86.sections[i].offset, i); + } + } + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"pe:x86") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Pe pe32; + if (pe32.Setup(PE_MODE_X86) == false){ + return 1; + } + if (pe32.ReadFile(args.options.input) == false){ + return 1; + } + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_32); + for (int i = 0; i < PE_MAX_SECTIONS; i++){ + if (pe32.sections[i].data != NULL){ + decompiler.x86_64(pe32.sections[i].data, pe32.sections[i].size, pe32.sections[i].offset, i); + } + } + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"pe:x86_64") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Pe pe64; + if (pe64.Setup(PE_MODE_X86_64) == false){ + return 1; + } + if (pe64.ReadFile(args.options.input) == false){ + return 1; + } + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_64); + for (int i = 0; i < PE_MAX_SECTIONS; i++){ + if (pe64.sections[i].data != NULL){ + decompiler.x86_64(pe64.sections[i].data, pe64.sections[i].size, pe64.sections[i].offset, i); + } + } + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"raw:x86") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Raw rawx86; + rawx86.ReadFile(args.options.input, 0); + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_32); + decompiler.x86_64(rawx86.sections[0].data, rawx86.sections[0].size, rawx86.sections[0].offset, 0); + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"raw:x86_64") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + Raw rawx86_64; + rawx86_64.ReadFile(args.options.input, 0); + Decompiler decompiler; + decompiler.Setup(CS_ARCH_X86, CS_MODE_64); + decompiler.x86_64(rawx86_64.sections[0].data, rawx86_64.sections[0].size, rawx86_64.sections[0].offset, 0); + if (args.options.output == NULL){ + decompiler.PrintTraits(args.options.pretty); + } else { + decompiler.WriteTraits(args.options.output, args.options.pretty); + } + return 0; + } + if (strcmp(args.options.mode, (char *)"raw:cil") == 0 && + args.options.io_type == ARGS_IO_TYPE_FILE){ + printf("comming soon...\n"); + return 0; + } + args.print_help(); + return 0; +} diff --git a/src/blelf.cpp b/src/blelf.cpp new file mode 100644 index 00000000..e41058f9 --- /dev/null +++ b/src/blelf.cpp @@ -0,0 +1,215 @@ +#include +#include +#include +#include +#include +#include +#include +#include "blelf.h" + +using namespace binlex; + +Elf::Elf(){ + SetSectionsDefault(); +} + +void Elf::SetSectionsDefault(){ + for (int i = 0; i < ELF_MAX_SECTIONS; i++){ + sections[i].data = NULL; + sections[i].offset = 0; + sections[i].size = 0; + } +} + +bool Elf::is_arch(int arch){ + if (mode == ELF_MODE_X86){ + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + if (header_local->e_machine == arch){ + return true; + } + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + if (header_local->e_machine == arch){ + return true; + } + } + return false; +} + +bool Elf::is_elf(){ + int result = 1; + if (mode == ELF_MODE_X86){ + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + result = memcmp(header_local->e_ident, magic, sizeof(magic)); + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + result = memcmp(header_local->e_ident, magic, sizeof(magic)); + } + if (result == 1){ + return false; + } + return true; +} + +unsigned int Elf::GetSectionTableSize(){ + if (mode == ELF_MODE_X86){ + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + return header_local->e_shentsize * header_local->e_shnum; + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + return header_local->e_shentsize * header_local->e_shnum; + } + return 0; +} + +bool Elf::Setup(int input_mode){ + switch(input_mode){ + case ELF_MODE_X86: + header = (Elf32_Ehdr *)malloc(sizeof(Elf32_Ehdr)); + mode = ELF_MODE_X86; + break; + case ELF_MODE_X86_64: + header = (Elf64_Ehdr *)malloc(sizeof(Elf64_Ehdr)); + mode = ELF_MODE_X86_64; + break; + default: + fprintf(stderr, "[x] unsupported elf executable mode\n"); + mode = ELF_MODE_UNSET; + return false; + } + return true; +} + +bool Elf::ReadSectionHeaders(){ + if (mode == ELF_MODE_X86){ + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + Elf32_Shdr *sh_table_local = (Elf32_Shdr *)sh_table; + fseek(fd, header_local->e_shoff, SEEK_SET); + fread(sh_table_local, 1, GetSectionTableSize(), fd); + sh_str = (char *)malloc(sh_table_local[header_local->e_shstrndx].sh_size); + if (sh_str == NULL){ + return false; + } + fseek(fd, sh_table_local[header_local->e_shstrndx].sh_offset, SEEK_SET); + fread(sh_str, 1, sh_table_local[header_local->e_shstrndx].sh_size, fd); + return true; + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + Elf64_Shdr *sh_table_local = (Elf64_Shdr *)sh_table; + fseek(fd, header_local->e_shoff, SEEK_SET); + fread(sh_table_local, 1, GetSectionTableSize(), fd); + sh_str = (char *)malloc(sh_table_local[header_local->e_shstrndx].sh_size); + if (sh_str == NULL){ + return false; + } + fseek(fd, sh_table_local[header_local->e_shstrndx].sh_offset, SEEK_SET); + fread(sh_str, 1, sh_table_local[header_local->e_shstrndx].sh_size, fd); + return true; + } + return false; +} + +bool Elf::ReadFile(char *file_path){ + fd = fopen(file_path, "rb"); + if (fd == NULL){ + fprintf(stderr, "[x] failed to open %s\n", file_path); + return false; + } + fseek(fd, 0, SEEK_SET); + if (mode == ELF_MODE_X86){ + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + fread(header_local, sizeof(Elf32_Ehdr), 1, fd); + if (is_arch(EM_386) == false){ + fprintf(stderr, "[x] the file %s is not an x86 binary\n", file_path); + return false; + } + sh_table = (Elf32_Shdr *)malloc(GetSectionTableSize()); + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + fread(header_local, sizeof(Elf64_Ehdr), 1, fd); + if (is_arch(EM_X86_64) == false){ + fprintf(stderr, "[x] the file %s is not an x86_64 binary\n", file_path); + return false; + } + sh_table = (Elf64_Shdr *)malloc(GetSectionTableSize()); + } + if (is_elf() == false){ + fprintf(stderr, "[x] the file %s is not a valid ELF executable\n", file_path); + return false; + } + ReadSectionHeaders(); + GetExecutableData(); + return true; +} + +bool Elf::GetExecutableData(){ + if (mode == ELF_MODE_X86){ + int section_index = 0; + Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; + Elf32_Shdr *sh_table_local = (Elf32_Shdr *)sh_table; + for(int i = 0; i < header_local->e_shnum; i++){ + if (sh_table_local[i].sh_flags & SHF_EXECINSTR){ + sections[section_index].offset = sh_table_local[i].sh_offset; + sections[section_index].size = sh_table_local[i].sh_size; + sections[section_index].data = malloc(sh_table_local[i].sh_size); + if (sections[section_index].data == NULL){ + return false; + } + fseek(fd, sections[section_index].offset, SEEK_SET); + fread(sections[section_index].data, sh_table_local[i].sh_size, 1, fd); + section_index++; + } + } + return true; + } + if (mode == ELF_MODE_X86_64){ + Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; + Elf64_Shdr *sh_table_local = (Elf64_Shdr *)sh_table; + int section_index = 0; + for(int i = 0; i < header_local->e_shnum; i++){ + if (sh_table_local[i].sh_flags & SHF_EXECINSTR){ + sections[section_index].offset = sh_table_local[i].sh_offset; + sections[section_index].size = sh_table_local[i].sh_size; + sections[section_index].data = malloc(sh_table_local[i].sh_size); + if (sections[section_index].data == NULL){ + return false; + } + fseek(fd, sections[section_index].offset, SEEK_SET); + fread(sections[section_index].data, sh_table_local[i].sh_size, 1, fd); + section_index++; + } + } + return true; + } + return false; +} + +Elf::~Elf(){ + if (header != NULL){ + free(header); + header = NULL; + } + if (sh_table != NULL){ + free(sh_table); + sh_table = NULL; + } + if (sh_str != NULL){ + free(sh_str); + sh_str = NULL; + } + if (fd != NULL){ + fclose(fd); + fd = NULL; + } + for (int i = 0; i < ELF_MAX_SECTIONS; i++){ + if (sections[i].data != NULL){ + free(sections[i].data); + } + } + SetSectionsDefault(); +} diff --git a/src/blyara.cpp b/src/blyara.cpp new file mode 100644 index 00000000..fe0a68f2 --- /dev/null +++ b/src/blyara.cpp @@ -0,0 +1,174 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "json.h" + +using namespace std; +using json = nlohmann::json; + +class Args{ + public: + char version[7] = "v1.1.0"; + struct { + json metadata; + json traits; + char *input; + char *name; + char *output; + bool version; + bool help; + int count; + } options; + Args(){ + SetDefault(); + } + void PrintHelp(){ + printf( + "blyara %s - Binlex Yara Generator Utility\n" + " -i --input\t\tinput file\t\t(optional)\n" + " -m --metadata\tset metadata\t\t(optional)\n" + " -n --name\t\tsignature name\n" + " -c --count\t\tcount\t\t\t(optional)\n" + " -h --help\t\tdisplay help\n" + " -o --output\t\toutput file\t\t(optional)\n" + " -v --version\t\tdisplay version\n" + "Author: @c3rb3ru5d3d53c\n", + version + ); + } + void Parse(int argc, char **argv){ + for (int i = 0; i < argc; i++){ + if (strcmp(argv[i], (char *)"-h") == 0 || + strcmp(argv[i], (char *)"--help") == 0){ + options.help = true; + PrintHelp(); + exit(0); + } + if (strcmp(argv[i], (char *)"-v") == 0 || + strcmp(argv[i], (char *)"--version") == 0){ + options.version = true; + printf("%s\n", version); + exit(0); + } + if (strcmp(argv[i], (char *)"-i") == 0 || + strcmp(argv[i], (char *)"--input") == 0){ + if (argc < i+2){ + fprintf(stderr, "[x] input requires 1 parameter\n"); + exit(1); + } + options.input = argv[i+1]; + } + if (strcmp(argv[i], (char *)"-o") == 0 || + strcmp(argv[i], (char *)"--output") == 0){ + if (argc < i+2){ + fprintf(stderr, "[x] input requires 1 parameter\n"); + exit(1); + } + options.output = argv[i+1]; + } + if (strcmp(argv[i], (char *)"-n") == 0 || + strcmp(argv[i], (char *)"--name") == 0){ + if (argc < i+2){ + fprintf(stderr, "[x] name requires 1 parameter\n"); + exit(1); + } + options.name = argv[i+1]; + } + if (strcmp(argv[i], (char *)"-c") == 0 || + strcmp(argv[i], (char *)"--count") == 0){ + if (argc < i+2){ + fprintf(stderr, "[x] count requires 1 parameter\n"); + exit(1); + } + options.count = atoi(argv[i+1]); + if (options.count < 1){ + fprintf(stderr, "[x] count must be greater or equal to 1\n"); + exit(1); + } + } + if (strcmp(argv[i], (char *)"-m") == 0 || + strcmp(argv[i], (char *)"--metadata") == 0){ + if (argc < i+3){ + fprintf(stderr, "[x] metadata requires 2 parameters\n"); + exit(1); + } + options.metadata[argv[i+1]] = argv[i+2]; + i = i + 2; + } + } + if (options.name == NULL){ + fprintf(stderr, "[x] name parameter is required\n"); + exit(1); + } + if (options.input == NULL){ + CollectStdinTraits(); + } else { + CollectInputTraits(); + } + } + void CollectStdinTraits(){ + int count = 0; + for (string line; getline(cin, line);) { + options.traits["trait_" + to_string(count)] = "{" + line + "}"; + count++; + } + } + void CollectInputTraits(){ + fstream input_file; + input_file.open(options.input, ios::in); + if (input_file.is_open()) { + string line; + int count = 0; + while (getline(input_file, line)) { + options.traits["trait_" + to_string(count)] = "{" + line + "}"; + count++; + } + input_file.close(); + } + } + void SetDefault(){ + options.count = 1; + options.name = NULL; + options.input = NULL; + options.output = NULL; + options.help = false; + } + ~Args(){ + SetDefault(); + } +}; + +int main(int argc, char **argv){ + Args args; + args.Parse(argc, argv); + if (args.options.traits.is_null() == false){ + stringstream signature; + signature << "rule " << args.options.name << " {" << endl; + if (args.options.metadata.is_null() == false){ + signature << " " << "meta:" << endl; + for (json::iterator it = args.options.metadata.begin(); it != args.options.metadata.end(); ++it){ + signature << " " << it.key() << " = " << it.value() << endl; + } + } + signature << " " << "strings:" << endl; + for (json::iterator it = args.options.traits.begin(); it != args.options.traits.end(); ++it){ + signature << " $" << it.key() << " = " << it.value().get() << endl; + } + signature << " " << "condition:" << endl; + signature << " " << to_string(args.options.count) << " of them" << endl; + signature << "}" << endl; + if (args.options.output == NULL){ + cout << signature.str(); + } else { + FILE *fd = fopen(args.options.output, "w"); + fwrite(signature.str().c_str(), sizeof(char), signature.str().length(), fd); + fclose(fd); + } + } + return 0; +} diff --git a/src/cil.h b/src/cil.cpp similarity index 100% rename from src/cil.h rename to src/cil.cpp diff --git a/src/common.cpp b/src/common.cpp new file mode 100644 index 00000000..c92585ce --- /dev/null +++ b/src/common.cpp @@ -0,0 +1,114 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "common.h" + +using namespace std; +using namespace binlex; + +string Common::SHA256(const char *trait){ + unsigned char hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX ctx; + SHA256_Init(&ctx); + SHA256_Update(&ctx, trait, strlen(trait)); + SHA256_Final(hash, &ctx); + string bytes = HexdumpBE(&hash, SHA256_DIGEST_LENGTH); + return TrimRight(bytes); +} + +vector Common::TraitToChar(string trait){ + trait = RemoveSpaces(RemoveWildcards(trait)); + vector bytes; + for (int i = 0; i < trait.length(); i = i + 2){ + const char *s_byte = trait.substr(i, 2).c_str(); + unsigned char byte = (char)strtol(s_byte, NULL, 16); + bytes.push_back(byte); + } + return bytes; +} + +string Common::RemoveWildcards(string trait){ + string::iterator end_pos = remove(trait.begin(), trait.end(), '?'); + trait.erase(end_pos, trait.end()); + return trait; +} + +uint Common::GetByteSize(string s){ + return RemoveSpaces(s).length() / 2; +} + +string Common::RemoveSpaces(string s){ + string::iterator end_pos = remove(s.begin(), s.end(), ' '); + s.erase(end_pos, s.end()); + return s; +} + +string Common::WildcardTrait(string trait, string bytes){ + size_t index = trait.find(bytes, 0); + if (index == string::npos){ + return bytes; + } + for (int i = index; i < trait.length(); i = i + 3){ + trait.replace(i, 2, "??"); + } + return bytes; +} + +string Common::HexdumpBE(const void *data, size_t size){ + stringstream bytes; + bytes << ""; + const unsigned char *local_pc = (const unsigned char *)data; + for (int i = 0; i < size; i++){ + bytes << hex << setfill('0') << setw(2) << (unsigned uint32_t)local_pc[i] << " "; + } + return TrimRight(bytes.str()); +} + +string Common::TrimRight(const string &s){ + const string whitespace = " \n\r\t\f\v"; + size_t end = s.find_last_not_of(whitespace); + return (end == std::string::npos) ? "" : s.substr(0, end + 1); +} + +void Common::Hexdump(const char * desc, const void * addr, const int len){ + int i; + unsigned char buff[17]; + const unsigned char * pc = (const unsigned char *)addr; + if (desc != NULL) + printf ("%s:\n", desc); + if (len == 0) { + printf(" ZERO LENGTH\n"); + return; + } + else if (len < 0) { + printf(" NEGATIVE LENGTH: %d\n", len); + return; + } + for (i = 0; i < len; i++) { + if ((i % 16) == 0) { + if (i != 0) + printf (" %s\n", buff); + printf (" %04x ", i); + } + printf (" %02x", pc[i]); + if ((pc[i] < 0x20) || (pc[i] > 0x7e)) + buff[i % 16] = '.'; + else + buff[i % 16] = pc[i]; + buff[(i % 16) + 1] = '\0'; + } + while ((i % 16) != 0) { + printf (" "); + i++; + } + printf (" %s\n", buff); +} diff --git a/src/common.h b/src/common.h deleted file mode 100644 index f9cf57e0..00000000 --- a/src/common.h +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include -#include - -#ifndef COMMON_H -#define COMMON_H - -void common_hex_dump(const char * desc, const void * addr, const int len) { - int i; - unsigned char buff[17]; - const unsigned char * pc = (const unsigned char *)addr; - - // Output description if given. - - if (desc != NULL) - printf ("%s:\n", desc); - - // Length checks. - - if (len == 0) { - printf(" ZERO LENGTH\n"); - return; - } - else if (len < 0) { - printf(" NEGATIVE LENGTH: %d\n", len); - return; - } - - // Process every byte in the data. - - for (i = 0; i < len; i++) { - // Multiple of 16 means new line (with line offset). - - if ((i % 16) == 0) { - // Don't print ASCII buffer for the "zeroth" line. - - if (i != 0) - printf (" %s\n", buff); - - // Output the offset. - - printf (" %04x ", i); - } - - // Now the hex code for the specific character. - printf (" %02x", pc[i]); - - // And buffer a printable ASCII character for later. - - if ((pc[i] < 0x20) || (pc[i] > 0x7e)) // isprint() may be better. - buff[i % 16] = '.'; - else - buff[i % 16] = pc[i]; - buff[(i % 16) + 1] = '\0'; - } - - // Pad out last line if not exactly 16 characters. - - while ((i % 16) != 0) { - printf (" "); - i++; - } - - // And print the final ASCII buffer. - - printf (" %s\n", buff); -} - -#endif diff --git a/src/decompiler.cpp b/src/decompiler.cpp new file mode 100644 index 00000000..e2a45114 --- /dev/null +++ b/src/decompiler.cpp @@ -0,0 +1,511 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "json.h" +#include "decompiler.h" + +using namespace std; +using json = nlohmann::json; +using namespace binlex; + +Decompiler::Decompiler(){ + pc = 0; +} + +string Decompiler::sha256(const char *trait){ + unsigned char hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX ctx; + SHA256_Init(&ctx); + SHA256_Update(&ctx, trait, strlen(trait)); + SHA256_Final(hash, &ctx); + string bytes = hexdump_be(&hash, SHA256_DIGEST_LENGTH, false); + return rs(bytes); +} + +float Decompiler::entropy(string trait){ + vector bytes = t2c(trait); + float result = 0; + map frequencies; + for (char c : bytes){ + frequencies[c]++; + } + for (pair p : frequencies) { + float freq = static_cast( p.second ) / bytes.size(); + result -= freq * log2(freq) ; + } + return result; +} + +vector Decompiler::t2c(string trait){ + trait = rs(rwc(trait)); + vector bytes; + for (int i = 0; i < trait.length(); i = i + 2){ + const char *s_byte = trait.substr(i, 2).c_str(); + unsigned char byte = (char)strtol(s_byte, NULL, 16); + bytes.push_back(byte); + } + return bytes; +} + +string Decompiler::rs(string s){ + // remove space + string::iterator end_pos = remove(s.begin(), s.end(), ' '); + s.erase(end_pos, s.end()); + return s; +} + +string Decompiler::rwc(string s){ + // Remove Wildcard + string::iterator end_pos = remove(s.begin(), s.end(), '?'); + s.erase(end_pos, s.end()); + return s; +} + +uint Decompiler::trait_size(string s){ + return rs(s).length() / 2; +} + +string Decompiler::rtrim(const std::string &s){ + const string whitespace = " \n\r\t\f\v"; + size_t end = s.find_last_not_of(whitespace); + return (end == std::string::npos) ? "" : s.substr(0, end + 1); +} + +string Decompiler::hexdump_be(const void *data, size_t size, bool cont){ + stringstream bytes; + bytes << ""; + const unsigned char *local_pc = (const unsigned char *)data; + for (int i = 0; i < size; i++){ + bytes << hex << setfill('0') << setw(2) << (unsigned uint32_t)local_pc[i] << " "; + } + if (cont == true){ + bytes << " "; + } + return bytes.str(); +} + +string Decompiler::hexdump_mem_disp(uint64_t disp){ + stringstream bytes; + const unsigned char *local_pc = (const unsigned char *)&disp; + for (int i = 0; i < sizeof(disp) -1 ; i++){ + if (local_pc[i] != 0 && local_pc[i] != 255){ + bytes << hex << setfill('0') << setw(2) << (unsigned uint32_t)local_pc[i] << " "; + } + } + return rtrim(bytes.str()); +} + +string Decompiler::wildcard_bytes(string bytes, string sub_bytes){ + bytes = rtrim(bytes); + size_t index = bytes.find(sub_bytes, 0); + if (index == string::npos){ + return bytes; + } + for (int i = index; i < bytes.length(); i = i + 3){ + bytes.replace(i, 2, "??"); + } + return bytes; +} + +string Decompiler::wildcard_all(string bytes){ + bytes = rtrim(bytes); + for (int i = 0; i < bytes.length(); i = i + 3){ + bytes.replace(i, 2, "??"); + } + return bytes + " "; +} + +json Decompiler::GetTraits(){ + json result; + for (int i = 0; i < DECOMPILER_MAX_SECTIONS; i++){ + if (sections[i].traits.is_null() == false){ + if (sections[i].traits.is_null() == false){ + for (int j = 0; j < sections[i].traits.size(); j++){ + result.push_back(sections[i].traits[j]); + } + } + } + } + return result; +} + +bool Decompiler::Setup(cs_arch arch, cs_mode mode){ + status = cs_open(arch, mode, &handle); + if (status != CS_ERR_OK){ + return false; + } + status = cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); + if (status != CS_ERR_OK){ + return false; + } + return true; +} + +int Decompiler::x86_64(void *data, size_t data_size, size_t data_offset, uint index){ + const uint8_t *code = (uint8_t *)data; + json trait; + size_t code_size = data_size; + uint f_edges = 0; + uint b_edges = 0; + uint insn_size = 0; + bool f_end = false; + uint f_count = 0; + uint f_insn_count = 0; + string f_bytes; + string f_trait; + bool b_end = false; + uint b_count = 0; + uint b_insn_count = 0; + string b_bytes; + string b_trait; + bool disasm = false; + string o_trait; + cs_insn *insn = cs_malloc(handle); + while (true){ + bool wildcard_insn = false; + disasm = cs_disasm_iter(handle, &code, &code_size, &pc, insn); + if (disasm == false && pc >= data_size){ + break; + } + if (disasm == false && pc < data_size){ + // realign code and data for decompiler + pc++; + code_size = data_size - pc + 1; + memmove(data, code+1, code_size); + code = (uint8_t *)data; + f_trait.clear(); + f_bytes.clear(); + f_end = false; + f_edges = 0; + f_insn_count = 0; + b_count = 0; + o_trait.clear(); + if (b_bytes.length() > 0){ + goto collect_block; + } + b_trait.clear(); + b_bytes.clear(); + b_end = false; + b_insn_count = 0; + b_edges = 0; + continue; + } + switch(insn->id){ + case X86_INS_JMP: + // non-conditional + f_edges++; + b_edges++; + b_count++; + b_end = true; + break; + case X86_INS_JNE: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JNO: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JNP: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JL: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JLE: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JG: + // conditional + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JGE: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JE: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JECXZ: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JCXZ: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JB: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JBE: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JA: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JAE: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JNS: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JO: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JP: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JRCXZ: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_JS: + f_edges = f_edges + 2; + b_edges = b_edges + 2; + b_count++; + b_end = true; + break; + case X86_INS_RET: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_RETF: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_RETFQ: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_IRET: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_IRETD: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_IRETQ: + f_count++; + f_end = true; + b_end = true; + break; + case X86_INS_NOP: + wildcard_insn = true; + break; + case X86_INS_INVALID: + b_end = true; + f_end = true; + wildcard_insn = true; + break; + default: + break; + } + + // Parse Operands + for (int j = 0; j < insn->detail->x86.op_count; j++){ + cs_x86_op operand = insn->detail->x86.operands[j]; + switch(operand.type){ + case X86_OP_MEM: + // Wildcard Memory Operands + { + if (operand.mem.disp != 0){ + o_trait = wildcard_bytes(hexdump_be(insn->bytes, insn->size, false), + hexdump_mem_disp(operand.mem.disp)); + } + break; + } + + case X86_OP_IMM: + // Wildcard Immutable Operands / Scalars + { + string imm = hexdump_mem_disp(operand.imm); + string instr = hexdump_be(insn->bytes, insn->size, false); + if (imm.length() > 0){ + o_trait = wildcard_bytes(instr, imm); + } + break; + } + default: + break; + } + } + if (wildcard_insn == true){ + b_trait = b_trait + wildcard_all(hexdump_be(insn->bytes, insn->size, false)); + f_trait = f_trait + wildcard_all(hexdump_be(insn->bytes, insn->size, false)); + wildcard_insn = false; + } else if (o_trait.length() > 0){ + o_trait = rtrim(o_trait); + b_trait = b_trait + o_trait + " "; + f_trait = f_trait + o_trait + " "; + o_trait.clear(); + } else { + b_trait = b_trait + hexdump_be(insn->bytes, insn->size, false); + f_trait = f_trait + hexdump_be(insn->bytes, insn->size, false); + } + b_bytes = b_bytes + hexdump_be(insn->bytes, insn->size, false); + b_insn_count++; + f_bytes = f_bytes + hexdump_be(insn->bytes, insn->size, false); + f_insn_count++; + insn_size = insn->size; + if (b_end == true && b_bytes.length() > 0){ + collect_block: + trait["type"] = "block"; + trait["bytes_sha256"] = sha256(rtrim(b_bytes).c_str()); + trait["bytes"] = rtrim(b_bytes); + trait["size"] = trait_size(trait["bytes"]); + trait["instructions"] = b_insn_count; + trait["blocks"] = 1; + if (disasm == false){ + trait["offset"] = data_offset + pc - (uint)trait["size"] - 1; + } else { + trait["offset"] = data_offset + pc - (uint)trait["size"]; + } + trait["average_instructions_per_block"] = b_insn_count / 1; + trait["edges"] = b_edges; + trait["cyclomatic_complexity"] = b_edges - 1 + 2; + trait["bytes_entropy"] = entropy(trait["bytes"].get()); + trait["trait"] = rtrim(b_trait); + trait["trait_entropy"] = entropy(trait["trait"].get()); + trait["trait_sha256"] = sha256(rtrim(b_trait).c_str()); + b_trait.clear(); + b_bytes.clear(); + b_end = false; + b_insn_count = 0; + b_edges = 0; + sections[index].traits.push_back(trait); + sections[index].visited.push_back(trait["offset"].get()); + trait.clear(); + } + if (f_end == true && f_bytes.length() > 0){ + trait["type"] = "function"; + trait["bytes_sha256"] = sha256(rtrim(f_bytes).c_str()); + trait["bytes"] = rtrim(f_bytes); + trait["bytes_entropy"] = entropy(trait["bytes"].get()); + trait["size"] = trait_size(trait["bytes"]); + trait["instructions"] = f_insn_count; + if (b_count == 0){ + trait["blocks"] = 1; + trait["average_instructions_per_block"] = f_insn_count / 1; + trait["cyclomatic_complexity"] = f_edges - 1 + 2; + } else { + trait["blocks"] = b_count; + trait["average_instructions_per_block"] = f_insn_count / b_count; + trait["cyclomatic_complexity"] = f_edges - b_count + 2; + } + trait["offset"] = data_offset + pc - (uint)trait["size"]; + trait["edges"] = f_edges; + trait["trait"] = rtrim(f_trait); + trait["trait_entropy"] = entropy(trait["trait"].get()); + trait["trait_sha256"] = sha256(rtrim(f_trait).c_str()); + f_trait.clear(); + sections[index].traits.push_back(trait); + sections[index].visited.push_back(trait["offset"].get()); + f_bytes.clear(); + f_end = false; + f_edges = 0; + f_insn_count = 0; + b_count = 0; + trait.clear(); + } + //printf("pos: %ld,%ld\n", pc, data_size); + } + cs_free(insn, 1); + return pc; +} + +void Decompiler::PrintTraits(bool pretty){ + json traits = GetTraits(); + if (pretty == false){ + cout << traits.dump() << endl; + } else { + cout << traits.dump(4) << endl; + } +} + +void Decompiler::WriteTraits(char *file_path, bool pretty){ + FILE *fd = fopen(file_path, "w"); + string traits; + if (pretty == false){ + traits = GetTraits().dump(); + } else { + traits = GetTraits().dump(4); + } + if (traits.length() > 0){ + traits = traits + '\n'; + } + fwrite(traits.c_str(), sizeof(char), traits.length(), fd); + fclose(fd); +} + +Decompiler::~Decompiler(){ + cs_close(&handle); + pc = 0; +} diff --git a/src/decompiler.h b/src/decompiler.h deleted file mode 100644 index e7832303..00000000 --- a/src/decompiler.h +++ /dev/null @@ -1,318 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#ifndef DECOMPILER_H -#define DECOMPILER_H - -#define DECOMPILER_TYPE_FUNCS 0 -#define DECOMPILER_TYPE_BLCKS 1 -#define DECOMPILER_TYPE_UNSET 2 -#define DECOMPILER_TYPE_ALL 3 - -#define DECOMPILER_MAX_SECTIONS 256 - -class Decompiler{ - private: - csh cs_handle; - char *temp = NULL; - struct Section { - char *function_traits; - char *block_traits; - }; - char * hexdump_le(const void *data, int size){ - int buffer_size = size * 2 + size; - char *buffer0 = (char *)malloc(buffer_size); - memset((void *)buffer0, 0, buffer_size); - const unsigned char * pc = (const unsigned char *)data; - int count = 0; - for (int i = size - 1; i >= 0; i--){ - if (count == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count++; - } - return buffer0; - } - char * hexdump_be(const void *data, int size){ - int buffer_size = size * 2 + size; - char *buffer0 = (char *)malloc(buffer_size); - memset((void *)buffer0, 0, buffer_size); - const unsigned char * pc = (const unsigned char *)data; - int count = 0; - for (int i = 0; i < size; i++){ - if (count == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count++; - } - return buffer0; - } - char * wildcard_bytes(char *str, char *wild){ - char wildcard[] = "??"; - char *offset = strstr(str, wild); - if (offset != 0){ - for (int i = 0; i < strlen(wild);){ - memcpy(offset + i, &wildcard, 2); - i = i + 3; - } - } - return offset; - } - void wildcard_null(char *bytes){ - char wildcard[] = "??"; - char *buffer0 = (char *)malloc(3); - memset(buffer0, 0, 3); - for (int i = strlen(bytes) + 1; i >= 0;){ - i = i - 3; - if (i < 0){ - break; - } - memcpy(buffer0, bytes + i, 2); - if (strcmp(buffer0, (char *)"00") == 0){ - memcpy(bytes + i, &wildcard, 2); - } else { - break; - } - } - free(buffer0); - } - char * hexdump_mem_disp(long int disp){ - int size = sizeof(disp) * 2 + sizeof(disp); - char *buffer0 = (char *)malloc(size); - memset((void *)buffer0, 0, size); - const unsigned char * pc = (const unsigned char *)&disp; - int count = 0; - for (int i = 0; i < sizeof(disp) -1 ; i++){ - if (pc[i] != 0 && pc[i] != 255){ - if (count == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count++; - } - } - return buffer0; - } - char * hexdump_mem_disp_rev(void *disp, int size){ - //int size = sizeof(disp) * 2 + sizeof(disp); - char *buffer0 = (char *)malloc(size); - memset((void *)buffer0, 0, size); - const unsigned char * pc = (const unsigned char *)&disp; - int count = 0; - for (int i = 0; i < size -1 ; i++){ - if (pc[i] != 0 && pc[i] != 255){ - if (count == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count++; - } - } - return buffer0; - } - void SetSectionsDefault(){ - for (int i = 0; i < DECOMPILER_MAX_SECTIONS; i++){ - sections[i].function_traits = NULL; - sections[i].block_traits = NULL; - } - } - public: - struct Section sections[DECOMPILER_MAX_SECTIONS]; - Decompiler(){ - SetSectionsDefault(); - } - void Setup(cs_arch arch, cs_mode mode){ - assert(cs_open(arch, mode, &cs_handle) == CS_ERR_OK); - cs_option(cs_handle, CS_OPT_DETAIL, CS_OPT_ON); - //cs_option(cs_handle, CS_OPT_SKIPDATA, CS_OPT_ON); - } - int x86_64_0(int decompiler_type, void *data, int data_size, int section_index){ - cs_insn *insn; - char *disp = NULL; - char *bytes = NULL; - int offset; - size_t count; - int op_mem_disp_size; - char *buffer0; - int count_rev; - const unsigned char * pc; - void *op_disp = NULL; - temp = (char *)malloc(data_size * 2 + data_size + 1); - memset((void *)temp, 0, data_size * 2 + data_size); - count = cs_disasm(cs_handle, (const uint8_t *)data, data_size, 0x0, 0, &insn); - if (count > 0) { - size_t j; - for (j = 0; j < count; j++) { - bytes = hexdump_be(insn[j].bytes, insn[j].size); - for (int k = 0; k < insn[j].detail->x86.op_count; k++) { - cs_x86_op *op = &(insn[j].detail->x86.operands[k]); - switch((int)op->type) { - case X86_OP_MEM: - if (op->mem.disp != 0) - disp = hexdump_mem_disp(op->mem.disp); - op_mem_disp_size = sizeof(op->mem.disp) * 2 + sizeof(op->mem.disp); - buffer0 = (char *)malloc(op_mem_disp_size); - memset((void *)buffer0, 0, op_mem_disp_size); - pc = (const unsigned char *)&op->mem.disp; - count_rev = 0; - for (int i = 0; i < sizeof(disp) -1 ; i++){ - if (pc[i] != 0 && pc[i] != 255){ - if (count_rev == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count_rev++; - } - } - wildcard_bytes(bytes, buffer0); - free(buffer0); - break; - default: - break; - } - } - wildcard_null(bytes); - if (decompiler_type == DECOMPILER_TYPE_FUNCS && - insn[j].id == X86_INS_RET){ - sprintf(temp + strlen(temp), "%s\n", bytes); - //printf("%s\n", bytes); - } else if (decompiler_type == DECOMPILER_TYPE_BLCKS && - (insn[j].id == X86_INS_JMP || - insn[j].id == X86_INS_JNE || - insn[j].id == X86_INS_JNO || - insn[j].id == X86_INS_JNP || - insn[j].id == X86_INS_JL || - insn[j].id == X86_INS_JLE || - insn[j].id == X86_INS_JG || - insn[j].id == X86_INS_JGE || - insn[j].id == X86_INS_JE || - insn[j].id == X86_INS_JECXZ || - insn[j].id == X86_INS_JCXZ || - insn[j].id == X86_INS_JB || - insn[j].id == X86_INS_JBE || - insn[j].id == X86_INS_JA || - insn[j].id == X86_INS_JAE || - insn[j].id == X86_INS_JNS || - insn[j].id == X86_INS_JO || - insn[j].id == X86_INS_JP || - insn[j].id == X86_INS_JRCXZ || - insn[j].id == X86_INS_JS)){ - sprintf(temp + strlen(temp), "%s\n", bytes); - //printf("%s\n", bytes); - } else { - if (j + 1 >= count){ - sprintf(temp + strlen(temp), "%s\n", bytes); - //printf("%s\n", bytes); - } else { - sprintf(temp + strlen(temp), "%s ", bytes); - //printf("%s ", bytes); - } - } - free(bytes); - if (j == count - 1){ - offset = insn[j].address + insn[j].size; - } - } - cs_free(insn, count); - } - if (decompiler_type == DECOMPILER_TYPE_FUNCS){ - if (sections[section_index].function_traits == NULL){ - sections[section_index].function_traits = (char *)malloc(data_size * 2 + data_size + 1); - memset((void *)sections[section_index].function_traits, 0, data_size * 2 + data_size + 1); - } - if (strlen(sections[section_index].function_traits) == 0){ - sprintf(sections[section_index].function_traits, "%s", temp); - } else { - sprintf(sections[section_index].function_traits, "%s%s", sections[section_index].function_traits, temp); - } - } - if (decompiler_type == DECOMPILER_TYPE_BLCKS){ - if (sections[section_index].block_traits == NULL){ - sections[section_index].block_traits = (char *)malloc(data_size * 2 + data_size + 1); - memset((void *)sections[section_index].block_traits, 0, data_size * 2 + data_size + 1); - } - - if (strlen(sections[section_index].block_traits) == 0){ - sprintf(sections[section_index].block_traits, "%s", temp); - } else { - sprintf(sections[section_index].block_traits, "%s%s", sections[section_index].block_traits, temp); - } - } - free(temp); - return offset; - } - void x86_64(int decompiler_type, void *data, int data_size, int section_index){ - // This is a hack should be in the x86_64_0 function as recursion, this fix works for now on emotet sample - int offset = x86_64_0(decompiler_type, data, data_size, section_index); - for(;;) { - if (offset < data_size){ - offset = offset + x86_64_0(decompiler_type, data + offset, data_size - offset, section_index); - } else { - break; - } - } - } - void PrintTraits(int type){ - for (int i = 0; i < DECOMPILER_MAX_SECTIONS; i++){ - switch(type){ - case DECOMPILER_TYPE_FUNCS: - if (sections[i].function_traits != NULL){ - printf("%s", sections[i].function_traits); - } - break; - case DECOMPILER_TYPE_BLCKS: - if (sections[i].block_traits != NULL){ - printf("%s", sections[i].block_traits); - } - break; - case DECOMPILER_TYPE_ALL: - if (sections[i].function_traits != NULL){ - printf("%s", sections[i].function_traits); - } - if (sections[i].block_traits != NULL){ - printf("%s", sections[i].block_traits); - } - break; - default: - break; - } - } - } - void WriteTraits(char *file_path){ - FILE *fd = fopen(file_path, "w"); - for (int i = 0; i < DECOMPILER_MAX_SECTIONS; i++){ - if (sections[i].function_traits != NULL){ - fwrite(sections[i].function_traits, sizeof(char), strlen(sections[i].function_traits), fd); - } - if (sections[i].block_traits != NULL){ - fwrite(sections[i].block_traits, sizeof(char), strlen(sections[i].block_traits), fd); - } - } - fclose(fd); - } - ~Decompiler(){ - cs_close(&cs_handle); - for (int i = 0; i < DECOMPILER_MAX_SECTIONS; i++){ - if (sections[i].function_traits != NULL){ - free(sections[i].function_traits); - } - if (sections[i].block_traits != NULL){ - free(sections[i].block_traits); - } - } - SetSectionsDefault(); - } -}; - -#endif diff --git a/src/decompiler_rev.cpp b/src/decompiler_rev.cpp new file mode 100644 index 00000000..21e5b28e --- /dev/null +++ b/src/decompiler_rev.cpp @@ -0,0 +1,173 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "json.h" +#include "decompiler_rev.h" + +using namespace std; +using json = nlohmann::json; +using namespace binlex; + +DecompilerREV::DecompilerREV(){ + for (int i = 0; i < DECOMPILER_REV_MAX_SECTIONS; i++){ + sections[i].pc = 0; + sections[i].code_size = 0; + sections[i].data_size = 0; + sections[i].data_offset = 0; + sections[i].data = NULL; + sections[i].code = NULL; + sections[i].b_edges = 0; + sections[i].f_edges = 0; + sections[i].b_end = false; + sections[i].f_end = false; + sections[i].b_count = 0; + sections[i].b_insn_count = 0; + sections[i].f_insn_count = 0; + sections[i].b_trait.clear(); + sections[i].f_trait.clear(); + sections[i].f_bytes.clear(); + sections[i].b_bytes.clear(); + sections[i].blocks.clear(); + sections[i].functions.clear(); + sections[i].visited.clear(); + } +} + +json DecompilerREV::GetTraits(){ + json result; + for (int i = 0; i < DECOMPILER_REV_MAX_SECTIONS; i++){ + if (sections[i].traits.is_null() == false){ + if (sections[i].traits.is_null() == false){ + for (int j = 0; j < sections[i].traits.size(); j++){ + result.push_back(sections[i].traits[j]); + } + } + } + } + return result; +} + +bool DecompilerREV::Setup(cs_arch arch, cs_mode mode, uint index){ + sections[index].status = cs_open(arch, mode, §ions[index].handle); + if (sections[index].status != CS_ERR_OK){ + return false; + } + sections[index].status = cs_option(sections[index].handle, CS_OPT_DETAIL, CS_OPT_ON); + if (sections[index].status != CS_ERR_OK){ + return false; + } + return true; +} + +void DecompilerREV::ClearBlock(uint index){ + sections[index].b_trait.clear(); + sections[index].b_bytes.clear(); + sections[index].b_edges = 0; + sections[index].b_insn_count = 0; + sections[index].b_end = false; +} + +void DecompilerREV::ClearTrait(uint index){ + sections[index].f_trait.clear(); + sections[index].f_bytes.clear(); + sections[index].f_edges = 0; + sections[index].f_insn_count = 0; + sections[index].f_end = false; +} + +void DecompilerREV::AddEdges(uint count, uint index){ + sections[index].b_edges = sections[index].b_edges + count; + sections[index].f_edges = sections[index].f_edges + count; +} + +void DecompilerREV::CollectBlockTrait(uint index){ + json trait; + trait["type"] = "block"; + trait["trait"] = common.TrimRight(sections[index].b_trait); + trait["edges"] = sections[index].b_edges; + trait["bytes"] = common.TrimRight(sections[index].b_bytes); + trait["size"] = common.GetByteSize(sections[index].b_bytes); + trait["instructions"] = sections[index].b_insn_count; + sections[index].traits.push_back(trait); + ClearBlock(index); +} + +void DecompilerREV::CollectFunctionTrait(uint index){ + json trait; + trait["type"] = "function"; + trait["trait"] = common.TrimRight(sections[index].f_trait); + trait["edges"] = sections[index].f_edges; + trait["bytes"] = common.TrimRight(sections[index].f_bytes); + trait["size"] = common.GetByteSize(sections[index].f_bytes); + trait["instructions"] = sections[index].f_insn_count; + sections[index].traits.push_back(trait); + ClearTrait(index); +} + +void DecompilerREV::PrintTraits(bool pretty){ + json traits = GetTraits(); + if (pretty == false){ + cout << traits.dump() << endl; + } else { + cout << traits.dump(4) << endl; + } +} + +void DecompilerREV::WriteTraits(char *file_path, bool pretty){ + FILE *fd = fopen(file_path, "w"); + string traits; + if (pretty == false){ + traits = GetTraits().dump(); + } else { + traits = GetTraits().dump(4); + } + if (traits.length() > 0){ + traits = traits + '\n'; + } + fwrite(traits.c_str(), sizeof(char), traits.length(), fd); + fclose(fd); +} + +void DecompilerREV::Seek(uint offset, uint index){ + sections[index].pc = offset; + sections[index].code_size = sections[index].data_size - offset; + memmove(sections[index].data, sections[index].code + sections[index].pc, sections[index].code_size); + sections[index].code = (uint8_t *)sections[index].data; +} + +uint DecompilerREV::Decompile(void *data, size_t data_size, size_t data_offset, uint index){ + sections[index].pc = 0; + sections[index].data = data; + sections[index].data_size = data_size; + sections[index].data_offset = data_offset; + sections[index].code = (uint8_t *)data; + cs_insn *insn = cs_malloc(sections[index].handle); + while (true){ + bool result = cs_disasm_iter(sections[index].handle, §ions[index].code, §ions[index].code_size, §ions[index].pc, insn); + if (sections[index].pc >= data_size){ + break; + } + if (result == false){ + Seek(sections[index].pc + 1, index); + continue; + } + printf("pc: %ld, %ld\n", sections[index].pc, sections[index].data_size); + } + cs_free(insn, 1); + return sections[index].pc; + } + +DecompilerREV::~DecompilerREV(){ + for (int i = 0; i < DECOMPILER_REV_MAX_SECTIONS; i++){ + cs_close(§ions[i].handle); + } +} diff --git a/src/elf.h b/src/elf.h deleted file mode 100644 index 2ea6db95..00000000 --- a/src/elf.h +++ /dev/null @@ -1,251 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "common.h" - -#ifndef ELF_H -#define ELF_H - -#define ELF_MAX_SECTIONS 32 - -#define ELF_MODE_UNSET 0 -#define ELF_MODE_X86 1 -#define ELF_MODE_X86_64 2 - -extern int errno; - -class Elf { - private: - struct Section { - int offset; - int size; - void *data; - }; - char * hexdump_be(const void *data, int size){ - int buffer_size = size * 2 + size; - char *buffer0 = (char *)malloc(buffer_size); - memset((void *)buffer0, 0, buffer_size); - const unsigned char * pc = (const unsigned char *)data; - int count = 0; - for (int i = 0; i < size; i++){ - if (count == 0){ - sprintf(buffer0, "%s%02x", buffer0, pc[i]); - } else { - sprintf(buffer0, "%s %02x", buffer0, pc[i]); - } - count++; - } - return buffer0; - } - bool is_arch(int arch){ - if (mode == ELF_MODE_X86){ - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - if (header_local->e_machine == arch){ - return true; - } - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - if (header_local->e_machine == arch){ - return true; - } - } - return false; - } - bool is_elf(){ - int result = 1; - if (mode == ELF_MODE_X86){ - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - result = memcmp(header_local->e_ident, magic, sizeof(magic)); - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - result = memcmp(header_local->e_ident, magic, sizeof(magic)); - } - if (result == 1){ - return false; - } - return true; - } - unsigned int GetSectionTableSize(){ - if (mode == ELF_MODE_X86){ - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - return header_local->e_shentsize * header_local->e_shnum; - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - return header_local->e_shentsize * header_local->e_shnum; - } - return 0; - } - void SetSectionsDefault(){ - for (int i = 0; i < ELF_MAX_SECTIONS; i++){ - sections[i].data = NULL; - sections[i].offset = 0; - sections[i].size = 0; - } - } - public: - char magic[4] = {0x7F, 0x45, 0x4C, 0x46}; - FILE *fd = NULL; - void *header = NULL; - void *sh_table = NULL; - char *sh_str = NULL; - int mode = ELF_MODE_UNSET; - struct Section sections[ELF_MAX_SECTIONS]; - Elf(){ - SetSectionsDefault(); - } - bool Setup(int input_mode){ - switch(input_mode){ - case ELF_MODE_X86: - header = (Elf32_Ehdr *)malloc(sizeof(Elf32_Ehdr)); - mode = ELF_MODE_X86; - break; - case ELF_MODE_X86_64: - header = (Elf64_Ehdr *)malloc(sizeof(Elf64_Ehdr)); - mode = ELF_MODE_X86_64; - break; - default: - fprintf(stderr, "[x] unsupported elf executable mode\n"); - mode = ELF_MODE_UNSET; - return false; - } - return true; - } - bool ReadSectionHeaders(){ - if (mode == ELF_MODE_X86){ - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - Elf32_Shdr *sh_table_local = (Elf32_Shdr *)sh_table; - fseek(fd, header_local->e_shoff, SEEK_SET); - fread(sh_table_local, 1, GetSectionTableSize(), fd); - sh_str = (char *)malloc(sh_table_local[header_local->e_shstrndx].sh_size); - if (sh_str == NULL){ - return false; - } - fseek(fd, sh_table_local[header_local->e_shstrndx].sh_offset, SEEK_SET); - fread(sh_str, 1, sh_table_local[header_local->e_shstrndx].sh_size, fd); - return true; - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - Elf64_Shdr *sh_table_local = (Elf64_Shdr *)sh_table; - fseek(fd, header_local->e_shoff, SEEK_SET); - fread(sh_table_local, 1, GetSectionTableSize(), fd); - sh_str = (char *)malloc(sh_table_local[header_local->e_shstrndx].sh_size); - if (sh_str == NULL){ - return false; - } - fseek(fd, sh_table_local[header_local->e_shstrndx].sh_offset, SEEK_SET); - fread(sh_str, 1, sh_table_local[header_local->e_shstrndx].sh_size, fd); - return true; - } - return false; - } - bool ReadFile(char *file_path){ - fd = fopen(file_path, "rb"); - if (fd == NULL){ - fprintf(stderr, "[x] failed to open %s\n", file_path); - return false; - } - fseek(fd, 0, SEEK_SET); - if (mode == ELF_MODE_X86){ - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - fread(header_local, sizeof(Elf32_Ehdr), 1, fd); - if (is_arch(EM_386) == false){ - fprintf(stderr, "[x] the file %s is not an x86 binary\n", file_path); - return false; - } - sh_table = (Elf32_Shdr *)malloc(GetSectionTableSize()); - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - fread(header_local, sizeof(Elf64_Ehdr), 1, fd); - if (is_arch(EM_X86_64) == false){ - fprintf(stderr, "[x] the file %s is not an x86_64 binary\n", file_path); - return false; - } - sh_table = (Elf64_Shdr *)malloc(GetSectionTableSize()); - } - if (is_elf() == false){ - fprintf(stderr, "[x] the file %s is not a valid ELF executable\n", file_path); - return false; - } - ReadSectionHeaders(); - return true; - } - bool GetExecutableData(){ - if (mode == ELF_MODE_X86){ - int section_index = 0; - Elf32_Ehdr *header_local = (Elf32_Ehdr *)header; - Elf32_Shdr *sh_table_local = (Elf32_Shdr *)sh_table; - for(int i = 0; i < header_local->e_shnum; i++){ - if (sh_table_local[i].sh_flags & SHF_EXECINSTR){ - sections[section_index].offset = sh_table_local[i].sh_offset; - sections[section_index].size = sh_table_local[i].sh_size; - sections[section_index].data = malloc(sh_table_local[i].sh_size); - if (sections[section_index].data == NULL){ - return false; - } - fseek(fd, sections[section_index].offset, SEEK_SET); - fread(sections[section_index].data, sh_table_local[i].sh_size, 1, fd); - //printf("%s\n", (sh_str + sh_table_local[i].sh_name)); - section_index++; - } - } - return true; - } - if (mode == ELF_MODE_X86_64){ - Elf64_Ehdr *header_local = (Elf64_Ehdr *)header; - Elf64_Shdr *sh_table_local = (Elf64_Shdr *)sh_table; - int section_index = 0; - for(int i = 0; i < header_local->e_shnum; i++){ - if (sh_table_local[i].sh_flags & SHF_EXECINSTR){ - sections[section_index].offset = sh_table_local[i].sh_offset; - sections[section_index].size = sh_table_local[i].sh_size; - sections[section_index].data = malloc(sh_table_local[i].sh_size); - if (sections[section_index].data == NULL){ - return false; - } - fseek(fd, sections[section_index].offset, SEEK_SET); - fread(sections[section_index].data, sh_table_local[i].sh_size, 1, fd); - //printf("%s\n", (sh_str + sh_table_local[i].sh_name)); - section_index++; - } - } - return true; - } - return false; - } - ~Elf(){ - if (header != NULL){ - free(header); - header = NULL; - } - if (sh_table != NULL){ - free(sh_table); - sh_table = NULL; - } - if (sh_str != NULL){ - free(sh_str); - sh_str = NULL; - } - if (fd != NULL){ - fclose(fd); - fd = NULL; - } - for (int i = 0; i < ELF_MAX_SECTIONS; i++){ - if (sections[i].data != NULL){ - free(sections[i].data); - } - } - SetSectionsDefault(); - } -}; - -#endif diff --git a/src/filetypes.h b/src/filetypes.h deleted file mode 100644 index a35f19a0..00000000 --- a/src/filetypes.h +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include - -#ifndef FILE_TYPES_H -#define FILE_TYPES_H - -#define FILE_TYPE_UNSUPPORTED 0 -#define FILE_TYPE_ELF_32 1 -#define FILE_TYPE_ELF_64 2 - -extern int errno; - -class FileTypes { - private: - bool ReadHeader(void *header, size_t size){ - fseek(file, 0, SEEK_SET); - fread(header, size, 1, file); - if (ferror(file)){ - return false; - } - return true; - } - int GetFileSize(){ - int cursor = ftell(file); - fseek(file, 0, SEEK_END); - int size = ftell(file); - fseek(file, cursor, SEEK_SET); - return size; - } - public: - FILE *file; - Elf32_Ehdr *elf_header; - char elf_magic[4] = {0x7F, 0x45, 0x4C, 0x46}; - int file_type = FILE_TYPE_UNSUPPORTED; - FileTypes(){ - elf_header = (Elf32_Ehdr *)malloc(sizeof(Elf32_Ehdr)); - } - int GetType(char *file_path){ - file = fopen(file_path, "rb"); - if (file == NULL){ - return -1; - } - if (GetFileSize() >= sizeof(Elf32_Ehdr)){ - ReadHeader(elf_header, sizeof(Elf32_Ehdr)); - if (memcmp(elf_header->e_ident, elf_magic, sizeof(elf_magic)) == 0){ - switch(elf_header->e_machine){ - case EM_386: - file_type = FILE_TYPE_ELF_32; - return file_type; - case EM_X86_64: - file_type = FILE_TYPE_ELF_64; - return file_type; - default: - break; - } - } - } - return FILE_TYPE_UNSUPPORTED; - } - ~FileTypes(){ - free(elf_header); - } -}; - -#endif \ No newline at end of file diff --git a/src/jvm.h b/src/jvm.cpp similarity index 100% rename from src/jvm.h rename to src/jvm.cpp diff --git a/src/macho.h b/src/macho.cpp similarity index 100% rename from src/macho.h rename to src/macho.cpp diff --git a/src/pe.cpp b/src/pe.cpp new file mode 100644 index 00000000..defcd530 --- /dev/null +++ b/src/pe.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include "pe.h" + +using namespace binlex; + +Pe::Pe(){ + for (int i = 0; i < PE_MAX_SECTIONS; i++){ + sections[i].size = 0; + sections[i].offset = 0; + sections[i].data = NULL; + } +} + +bool Pe::Setup(int input_mode){ + dos_header = (PIMAGE_DOS_HEADER)malloc(sizeof(IMAGE_DOS_HEADER)); + coff_header = (PIMAGE_COFF_HEADER)malloc(sizeof(IMAGE_COFF_HEADER)); + section_header = (PIMAGE_SECTION_HEADER)malloc(sizeof(IMAGE_SECTION_HEADER)); + switch(input_mode){ + case PE_MODE_X86: + mode = PE_MODE_X86; + break; + case PE_MODE_X86_64: + mode = PE_MODE_X86_64; + break; + default: + fprintf(stderr, "[x] unsupported elf executable mode\n"); + mode = PE_MODE_UNSET; + return false; + } + return true; +} + +bool Pe::is_pe(){ + if (dos_header->e_magic != 23117 || + coff_header->Signature != 17744){ + return false; + } + return true; +} + +bool Pe::ReadFile(char *file_path){ + fd = fopen(file_path, "rb"); + if (fd == NULL){ + fprintf(stderr, "[x] failed to open %s\n", file_path); + return false; + } + fread(dos_header, sizeof(IMAGE_DOS_HEADER), 1, fd); + fseek(fd, dos_header->e_lfanew, SEEK_SET); + fread(coff_header, sizeof(IMAGE_COFF_HEADER), 1, fd); + if (is_pe() == false){ + fprintf(stderr, "[x] %s is not a valid pe file\n", file_path); + return false; + } + if (mode == PE_MODE_X86 && coff_header->Machine != IMAGE_FILE_MACHINE_I386){ + fprintf(stderr, "[x] %s is not a valid x86 pe file\n", file_path); + return false; + } + if (mode == PE_MODE_X86_64 && coff_header->Machine != IMAGE_FILE_MACHINE_AMD64){ + fprintf(stderr, "[x] %s is not a valid x86_64 pe file\n", file_path); + return false; + } + if (mode == PE_MODE_X86 && coff_header->Machine == IMAGE_FILE_MACHINE_I386){ + optional_header_32 = (PIMAGE_OPTIONAL_HEADER_32)malloc(sizeof(IMAGE_OPTIONAL_HEADER_32)); + if (fread(optional_header_32, sizeof(IMAGE_OPTIONAL_HEADER_32), 1, fd) <= 0){ + fprintf(stderr, "[x] failed to read %s optional_header_64\n", file_path); + return false; + } + } + if (mode == PE_MODE_X86_64 && coff_header->Machine == IMAGE_FILE_MACHINE_AMD64){ + optional_header_64 = (PIMAGE_OPTIONAL_HEADER_64)malloc(sizeof(IMAGE_OPTIONAL_HEADER_64)); + if (fread(optional_header_64, sizeof(IMAGE_OPTIONAL_HEADER_64), 1, fd) <= 0){ + fprintf(stderr, "[x] failed to read %s optional_header_64\n", file_path); + return false; + } + } + for (int i = 0; i < coff_header->NumberOfSections; i++){ + if (fread(section_header, sizeof(IMAGE_SECTION_HEADER), 1, fd) <= 0){ + fprintf(stderr, "[x] failed to read %s section_header\n", file_path); + return false; + } + if (section_header->Characteristics & IMAGE_SCN_MEM_EXECUTE){ + int set = ftell(fd); + fseek(fd, section_header->PointerToRawData, SEEK_SET); + sections[i].offset = section_header->PointerToRawData; + sections[i].size = section_header->SizeOfRawData; + sections[i].data = malloc(section_header->SizeOfRawData); + if (sections[i].data == NULL){ + fprintf(stderr, "[x] failed to allocate section memory\n"); + return false; + } + memset(sections[i].data, 0, sections[i].size); + if (fread(sections[i].data, sections[i].size, 1, fd) <= 0){ + fprintf(stderr, "[x] failed to read %s executable section\n", file_path); + return false; + } + fseek(fd, set, SEEK_SET); + } + + } + return true; +} + +Pe::~Pe(){ + if (dos_header != NULL){ + free(dos_header); + dos_header = NULL; + } + if (coff_header != NULL){ + free(coff_header); + coff_header = NULL; + } + if (optional_header_32 != NULL){ + free(optional_header_32); + optional_header_32 = NULL; + } + if (optional_header_64 != NULL){ + free(optional_header_64); + optional_header_64 = NULL; + } + if (section_header != NULL){ + free(section_header); + section_header = NULL; + } + for (int i = 0; i < PE_MAX_SECTIONS; i++){ + if (sections[i].data != NULL){ + free(sections[i].data); + sections[i].size = 0; + sections[i].offset = 0; + sections[i].data = NULL; + } + } +} diff --git a/src/raw.cpp b/src/raw.cpp new file mode 100644 index 00000000..04a1c93e --- /dev/null +++ b/src/raw.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include "raw.h" + +using namespace binlex; + +Raw::Raw(){ + for (int i = 0; i < RAW_MAX_SECTIONS; i++){ + sections[i].data = NULL; + sections[i].size = 0; + } +} + +int Raw::GetFileSize(FILE *fd){ + int start = ftell(fd); + fseek(fd, 0, SEEK_END); + int size = ftell(fd); + fseek(fd, start, SEEK_SET); + return size; +} + +bool Raw::ReadFile(char *file_path, int section_index){ + FILE *fd = fopen(file_path, "rb"); + sections[section_index].offset = ftell(fd); + sections[section_index].size = GetFileSize(fd); + sections[section_index].data = malloc(sections[section_index].size); + memset(sections[section_index].data, 0, sections[section_index].size); + fread(sections[section_index].data, sections[section_index].size, 1, fd); + fclose(fd); + return true; +} + +Raw::~Raw(){ + for (int i = 0; i < RAW_MAX_SECTIONS; i++){ + if (sections[i].data != NULL){ + free(sections[i].data); + sections[i].size = 0; + } + } +} diff --git a/src/raw.h b/src/raw.h deleted file mode 100644 index 47a472b7..00000000 --- a/src/raw.h +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include - -#ifndef RAW_H -#define RAW_H - -#define RAW_MAX_SECTIONS 128 - -class Raw { - private: - struct Section { - void *data; - int size; - }; - int GetFileSize(FILE *fd){ - int start = ftell(fd); - fseek(fd, 0, SEEK_END); - int size = ftell(fd); - fseek(fd, start, SEEK_SET); - return size; - } - public: - struct Section sections[RAW_MAX_SECTIONS]; - Raw(){ - for (int i = 0; i < RAW_MAX_SECTIONS; i++){ - sections[i].data = NULL; - sections[i].size = 0; - } - } - bool ReadFile(char *file_path, int section_index){ - FILE *fd = fopen(file_path, "rb"); - sections[section_index].size = GetFileSize(fd); - sections[section_index].data = malloc(sections[section_index].size); - memset(sections[section_index].data, 0, sections[section_index].size); - fread(sections[section_index].data, sections[section_index].size, 1, fd); - fclose(fd); - return true; - } - ~Raw(){ - for (int i = 0; i < RAW_MAX_SECTIONS; i++){ - if (sections[i].data != NULL){ - free(sections[i].data); - sections[i].size = 0; - } - } - } -}; - -#endif diff --git a/tests/.gitignore b/tests/.gitignore index 2341ef8c..5bc6a7f4 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -3,3 +3,4 @@ pe/** raw/** macho/** cil/** +venv/** diff --git a/tests/pe.zip b/tests/pe.zip index 56050ac3..debfe2f2 100644 --- a/tests/pe.zip +++ b/tests/pe.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25dc744c0841d44b57593b44b19afe10380495ab439989886ff967c54b2e4130 -size 124773 +oid sha256:b65c36879b0025c4ea9e3ba3d432547e7d6fc376d2b79b5e58c3a372660ebd78 +size 1463461 diff --git a/tests/tsmda.py b/tests/tsmda.py new file mode 100755 index 00000000..6952c419 --- /dev/null +++ b/tests/tsmda.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +import json +import sys +import os +from smda.Disassembler import Disassembler + +disassembler = Disassembler() +report = disassembler.disassembleFile(sys.argv[1]) +json_report = report.toDict()