angr 9.2.192__cp311-cp311-macosx_10_12_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- angr/__init__.py +366 -0
- angr/__main__.py +182 -0
- angr/ail_callable.py +79 -0
- angr/ailment/__init__.py +83 -0
- angr/ailment/block.py +88 -0
- angr/ailment/block_walker.py +856 -0
- angr/ailment/constant.py +3 -0
- angr/ailment/converter_common.py +11 -0
- angr/ailment/converter_pcode.py +648 -0
- angr/ailment/converter_vex.py +829 -0
- angr/ailment/expression.py +1655 -0
- angr/ailment/manager.py +34 -0
- angr/ailment/statement.py +973 -0
- angr/ailment/tagged_object.py +58 -0
- angr/ailment/utils.py +114 -0
- angr/analyses/__init__.py +117 -0
- angr/analyses/analysis.py +429 -0
- angr/analyses/backward_slice.py +686 -0
- angr/analyses/binary_optimizer.py +670 -0
- angr/analyses/bindiff.py +1512 -0
- angr/analyses/boyscout.py +76 -0
- angr/analyses/callee_cleanup_finder.py +74 -0
- angr/analyses/calling_convention/__init__.py +6 -0
- angr/analyses/calling_convention/calling_convention.py +1113 -0
- angr/analyses/calling_convention/fact_collector.py +647 -0
- angr/analyses/calling_convention/utils.py +60 -0
- angr/analyses/cdg.py +189 -0
- angr/analyses/cfg/__init__.py +23 -0
- angr/analyses/cfg/cfb.py +451 -0
- angr/analyses/cfg/cfg.py +74 -0
- angr/analyses/cfg/cfg_arch_options.py +95 -0
- angr/analyses/cfg/cfg_base.py +2954 -0
- angr/analyses/cfg/cfg_emulated.py +3451 -0
- angr/analyses/cfg/cfg_fast.py +5431 -0
- angr/analyses/cfg/cfg_fast_soot.py +662 -0
- angr/analyses/cfg/cfg_job_base.py +203 -0
- angr/analyses/cfg/indirect_jump_resolvers/__init__.py +30 -0
- angr/analyses/cfg/indirect_jump_resolvers/aarch64_macho_got.py +77 -0
- angr/analyses/cfg/indirect_jump_resolvers/amd64_elf_got.py +62 -0
- angr/analyses/cfg/indirect_jump_resolvers/amd64_pe_iat.py +51 -0
- angr/analyses/cfg/indirect_jump_resolvers/arm_elf_fast.py +159 -0
- angr/analyses/cfg/indirect_jump_resolvers/const_resolver.py +339 -0
- angr/analyses/cfg/indirect_jump_resolvers/constant_value_manager.py +107 -0
- angr/analyses/cfg/indirect_jump_resolvers/default_resolvers.py +82 -0
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +2490 -0
- angr/analyses/cfg/indirect_jump_resolvers/memload_resolver.py +81 -0
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +286 -0
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_got.py +148 -0
- angr/analyses/cfg/indirect_jump_resolvers/propagator_utils.py +46 -0
- angr/analyses/cfg/indirect_jump_resolvers/resolver.py +74 -0
- angr/analyses/cfg/indirect_jump_resolvers/syscall_resolver.py +92 -0
- angr/analyses/cfg/indirect_jump_resolvers/x86_elf_pic_plt.py +88 -0
- angr/analyses/cfg/indirect_jump_resolvers/x86_pe_iat.py +47 -0
- angr/analyses/cfg_slice_to_sink/__init__.py +11 -0
- angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +117 -0
- angr/analyses/cfg_slice_to_sink/graph.py +87 -0
- angr/analyses/cfg_slice_to_sink/transitions.py +27 -0
- angr/analyses/class_identifier.py +63 -0
- angr/analyses/code_tagging.py +123 -0
- angr/analyses/codecave.py +77 -0
- angr/analyses/complete_calling_conventions.py +475 -0
- angr/analyses/congruency_check.py +377 -0
- angr/analyses/data_dep/__init__.py +16 -0
- angr/analyses/data_dep/data_dependency_analysis.py +595 -0
- angr/analyses/data_dep/dep_nodes.py +171 -0
- angr/analyses/data_dep/sim_act_location.py +49 -0
- angr/analyses/datagraph_meta.py +105 -0
- angr/analyses/ddg.py +1670 -0
- angr/analyses/decompiler/__init__.py +41 -0
- angr/analyses/decompiler/ail_simplifier.py +2246 -0
- angr/analyses/decompiler/ailgraph_walker.py +49 -0
- angr/analyses/decompiler/block_io_finder.py +302 -0
- angr/analyses/decompiler/block_similarity.py +199 -0
- angr/analyses/decompiler/block_simplifier.py +397 -0
- angr/analyses/decompiler/callsite_maker.py +579 -0
- angr/analyses/decompiler/ccall_rewriters/__init__.py +9 -0
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +618 -0
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +24 -0
- angr/analyses/decompiler/ccall_rewriters/x86_ccalls.py +354 -0
- angr/analyses/decompiler/clinic.py +3662 -0
- angr/analyses/decompiler/condition_processor.py +1323 -0
- angr/analyses/decompiler/counters/__init__.py +16 -0
- angr/analyses/decompiler/counters/boolean_counter.py +27 -0
- angr/analyses/decompiler/counters/call_counter.py +77 -0
- angr/analyses/decompiler/counters/expression_counters.py +77 -0
- angr/analyses/decompiler/counters/seq_cf_structure_counter.py +63 -0
- angr/analyses/decompiler/decompilation_cache.py +54 -0
- angr/analyses/decompiler/decompilation_options.py +317 -0
- angr/analyses/decompiler/decompiler.py +796 -0
- angr/analyses/decompiler/dephication/__init__.py +6 -0
- angr/analyses/decompiler/dephication/dephication_base.py +100 -0
- angr/analyses/decompiler/dephication/graph_dephication.py +70 -0
- angr/analyses/decompiler/dephication/graph_rewriting.py +112 -0
- angr/analyses/decompiler/dephication/graph_vvar_mapping.py +357 -0
- angr/analyses/decompiler/dephication/rewriting_engine.py +528 -0
- angr/analyses/decompiler/dephication/seqnode_dephication.py +156 -0
- angr/analyses/decompiler/dirty_rewriters/__init__.py +7 -0
- angr/analyses/decompiler/dirty_rewriters/amd64_dirty.py +74 -0
- angr/analyses/decompiler/dirty_rewriters/rewriter_base.py +27 -0
- angr/analyses/decompiler/empty_node_remover.py +212 -0
- angr/analyses/decompiler/expression_narrower.py +290 -0
- angr/analyses/decompiler/goto_manager.py +112 -0
- angr/analyses/decompiler/graph_region.py +441 -0
- angr/analyses/decompiler/jump_target_collector.py +37 -0
- angr/analyses/decompiler/jumptable_entry_condition_rewriter.py +67 -0
- angr/analyses/decompiler/label_collector.py +32 -0
- angr/analyses/decompiler/node_replacer.py +42 -0
- angr/analyses/decompiler/notes/__init__.py +9 -0
- angr/analyses/decompiler/notes/decompilation_note.py +48 -0
- angr/analyses/decompiler/notes/deobfuscated_strings.py +56 -0
- angr/analyses/decompiler/optimization_passes/__init__.py +164 -0
- angr/analyses/decompiler/optimization_passes/base_ptr_save_simplifier.py +157 -0
- angr/analyses/decompiler/optimization_passes/call_stmt_rewriter.py +46 -0
- angr/analyses/decompiler/optimization_passes/code_motion.py +362 -0
- angr/analyses/decompiler/optimization_passes/condition_constprop.py +211 -0
- angr/analyses/decompiler/optimization_passes/const_derefs.py +127 -0
- angr/analyses/decompiler/optimization_passes/const_prop_reverter.py +365 -0
- angr/analyses/decompiler/optimization_passes/cross_jump_reverter.py +106 -0
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +82 -0
- angr/analyses/decompiler/optimization_passes/determine_load_sizes.py +64 -0
- angr/analyses/decompiler/optimization_passes/div_simplifier.py +425 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/__init__.py +5 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/ail_merge_graph.py +503 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/duplication_reverter.py +1221 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/errors.py +16 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/similarity.py +126 -0
- angr/analyses/decompiler/optimization_passes/duplication_reverter/utils.py +167 -0
- angr/analyses/decompiler/optimization_passes/eager_std_string_concatenation.py +236 -0
- angr/analyses/decompiler/optimization_passes/eager_std_string_eval.py +186 -0
- angr/analyses/decompiler/optimization_passes/engine_base.py +502 -0
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +138 -0
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +113 -0
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +618 -0
- angr/analyses/decompiler/optimization_passes/inlined_strlen_simplifier.py +274 -0
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +224 -0
- angr/analyses/decompiler/optimization_passes/ite_region_converter.py +337 -0
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +939 -0
- angr/analyses/decompiler/optimization_passes/mod_simplifier.py +99 -0
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +710 -0
- angr/analyses/decompiler/optimization_passes/peephole_simplifier.py +75 -0
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +263 -0
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier_adv.py +198 -0
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +171 -0
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +222 -0
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +632 -0
- angr/analyses/decompiler/optimization_passes/return_duplicator_high.py +61 -0
- angr/analyses/decompiler/optimization_passes/return_duplicator_low.py +166 -0
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +333 -0
- angr/analyses/decompiler/optimization_passes/static_vvar_rewriter.py +336 -0
- angr/analyses/decompiler/optimization_passes/switch_default_case_duplicator.py +166 -0
- angr/analyses/decompiler/optimization_passes/switch_reused_entry_rewriter.py +102 -0
- angr/analyses/decompiler/optimization_passes/tag_slicer.py +41 -0
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +477 -0
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +88 -0
- angr/analyses/decompiler/peephole_optimizations/__init__.py +136 -0
- angr/analyses/decompiler/peephole_optimizations/a_div_const_add_a_mul_n_div_const.py +42 -0
- angr/analyses/decompiler/peephole_optimizations/a_mul_const_div_shr_const.py +38 -0
- angr/analyses/decompiler/peephole_optimizations/a_mul_const_sub_a.py +34 -0
- angr/analyses/decompiler/peephole_optimizations/a_shl_const_sub_a.py +34 -0
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_div.py +25 -0
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_shr_const_shr_const.py +37 -0
- angr/analyses/decompiler/peephole_optimizations/a_sub_a_sub_n.py +23 -0
- angr/analyses/decompiler/peephole_optimizations/arm_cmpf.py +236 -0
- angr/analyses/decompiler/peephole_optimizations/base.py +157 -0
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_add_n.py +34 -0
- angr/analyses/decompiler/peephole_optimizations/basepointeroffset_and_mask.py +36 -0
- angr/analyses/decompiler/peephole_optimizations/bitwise_or_to_logical_or.py +34 -0
- angr/analyses/decompiler/peephole_optimizations/bool_expr_xor_1.py +27 -0
- angr/analyses/decompiler/peephole_optimizations/bswap.py +142 -0
- angr/analyses/decompiler/peephole_optimizations/cas_intrinsics.py +182 -0
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +71 -0
- angr/analyses/decompiler/peephole_optimizations/coalesce_adjacent_shrs.py +39 -0
- angr/analyses/decompiler/peephole_optimizations/coalesce_same_cascading_ifs.py +28 -0
- angr/analyses/decompiler/peephole_optimizations/constant_derefs.py +44 -0
- angr/analyses/decompiler/peephole_optimizations/conv_a_sub0_shr_and.py +69 -0
- angr/analyses/decompiler/peephole_optimizations/conv_shl_shr.py +52 -0
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +436 -0
- angr/analyses/decompiler/peephole_optimizations/extended_byte_and_mask.py +56 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_memcpy.py +78 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_memset.py +262 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +217 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +106 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_wcscpy.py +256 -0
- angr/analyses/decompiler/peephole_optimizations/inlined_wcscpy_consolidation.py +296 -0
- angr/analyses/decompiler/peephole_optimizations/invert_negated_logical_conjuction_disjunction.py +50 -0
- angr/analyses/decompiler/peephole_optimizations/modulo_simplifier.py +89 -0
- angr/analyses/decompiler/peephole_optimizations/one_sub_bool.py +33 -0
- angr/analyses/decompiler/peephole_optimizations/optimized_div_simplifier.py +356 -0
- angr/analyses/decompiler/peephole_optimizations/remove_cascading_conversions.py +45 -0
- angr/analyses/decompiler/peephole_optimizations/remove_cxx_destructor_calls.py +32 -0
- angr/analyses/decompiler/peephole_optimizations/remove_empty_if_body.py +46 -0
- angr/analyses/decompiler/peephole_optimizations/remove_noop_conversions.py +47 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_bitmasks.py +125 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_conversions.py +273 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_derefs.py +21 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_branch.py +30 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_ite_comparisons.py +54 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_nots.py +36 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_reinterprets.py +44 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts.py +95 -0
- angr/analyses/decompiler/peephole_optimizations/remove_redundant_shifts_around_comparators.py +115 -0
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +85 -0
- angr/analyses/decompiler/peephole_optimizations/rewrite_conv_mul.py +40 -0
- angr/analyses/decompiler/peephole_optimizations/rewrite_cxx_operator_calls.py +90 -0
- angr/analyses/decompiler/peephole_optimizations/rewrite_mips_gp_loads.py +49 -0
- angr/analyses/decompiler/peephole_optimizations/rol_ror.py +130 -0
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +143 -0
- angr/analyses/decompiler/peephole_optimizations/shl_to_mul.py +25 -0
- angr/analyses/decompiler/peephole_optimizations/simplify_pc_relative_loads.py +51 -0
- angr/analyses/decompiler/peephole_optimizations/single_bit_cond_to_boolexpr.py +28 -0
- angr/analyses/decompiler/peephole_optimizations/single_bit_xor.py +29 -0
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +131 -0
- angr/analyses/decompiler/peephole_optimizations/utils.py +18 -0
- angr/analyses/decompiler/presets/__init__.py +22 -0
- angr/analyses/decompiler/presets/basic.py +36 -0
- angr/analyses/decompiler/presets/fast.py +66 -0
- angr/analyses/decompiler/presets/full.py +76 -0
- angr/analyses/decompiler/presets/malware.py +70 -0
- angr/analyses/decompiler/presets/preset.py +37 -0
- angr/analyses/decompiler/redundant_label_remover.py +141 -0
- angr/analyses/decompiler/region_identifier.py +1319 -0
- angr/analyses/decompiler/region_simplifiers/__init__.py +5 -0
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +95 -0
- angr/analyses/decompiler/region_simplifiers/cascading_ifs.py +82 -0
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +838 -0
- angr/analyses/decompiler/region_simplifiers/goto.py +178 -0
- angr/analyses/decompiler/region_simplifiers/if_.py +135 -0
- angr/analyses/decompiler/region_simplifiers/ifelse.py +91 -0
- angr/analyses/decompiler/region_simplifiers/loop.py +143 -0
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +24 -0
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +270 -0
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +654 -0
- angr/analyses/decompiler/region_simplifiers/switch_expr_simplifier.py +87 -0
- angr/analyses/decompiler/region_walker.py +24 -0
- angr/analyses/decompiler/return_maker.py +72 -0
- angr/analyses/decompiler/semantic_naming/__init__.py +37 -0
- angr/analyses/decompiler/semantic_naming/array_index_naming.py +196 -0
- angr/analyses/decompiler/semantic_naming/boolean_naming.py +264 -0
- angr/analyses/decompiler/semantic_naming/call_result_naming.py +220 -0
- angr/analyses/decompiler/semantic_naming/naming_base.py +166 -0
- angr/analyses/decompiler/semantic_naming/orchestrator.py +107 -0
- angr/analyses/decompiler/semantic_naming/pointer_naming.py +334 -0
- angr/analyses/decompiler/semantic_naming/region_loop_counter_naming.py +246 -0
- angr/analyses/decompiler/semantic_naming/size_naming.py +137 -0
- angr/analyses/decompiler/seq_to_blocks.py +20 -0
- angr/analyses/decompiler/sequence_walker.py +261 -0
- angr/analyses/decompiler/ssailification/__init__.py +4 -0
- angr/analyses/decompiler/ssailification/rewriting.py +451 -0
- angr/analyses/decompiler/ssailification/rewriting_engine.py +1091 -0
- angr/analyses/decompiler/ssailification/rewriting_state.py +61 -0
- angr/analyses/decompiler/ssailification/ssailification.py +283 -0
- angr/analyses/decompiler/ssailification/traversal.py +127 -0
- angr/analyses/decompiler/ssailification/traversal_engine.py +323 -0
- angr/analyses/decompiler/ssailification/traversal_state.py +48 -0
- angr/analyses/decompiler/stack_item.py +36 -0
- angr/analyses/decompiler/structured_codegen/__init__.py +25 -0
- angr/analyses/decompiler/structured_codegen/base.py +193 -0
- angr/analyses/decompiler/structured_codegen/c.py +4257 -0
- angr/analyses/decompiler/structured_codegen/dummy.py +15 -0
- angr/analyses/decompiler/structured_codegen/dwarf_import.py +190 -0
- angr/analyses/decompiler/structuring/__init__.py +30 -0
- angr/analyses/decompiler/structuring/dream.py +1217 -0
- angr/analyses/decompiler/structuring/phoenix.py +3636 -0
- angr/analyses/decompiler/structuring/recursive_structurer.py +187 -0
- angr/analyses/decompiler/structuring/sailr.py +120 -0
- angr/analyses/decompiler/structuring/structurer_base.py +1140 -0
- angr/analyses/decompiler/structuring/structurer_nodes.py +442 -0
- angr/analyses/decompiler/utils.py +1224 -0
- angr/analyses/deobfuscator/__init__.py +23 -0
- angr/analyses/deobfuscator/api_obf_finder.py +333 -0
- angr/analyses/deobfuscator/api_obf_peephole_optimizer.py +80 -0
- angr/analyses/deobfuscator/api_obf_type2_finder.py +166 -0
- angr/analyses/deobfuscator/data_transformation_embedder.py +633 -0
- angr/analyses/deobfuscator/hash_lookup_api_deobfuscator.py +156 -0
- angr/analyses/deobfuscator/irsb_reg_collector.py +54 -0
- angr/analyses/deobfuscator/scope_ops_analyzer.py +68 -0
- angr/analyses/deobfuscator/string_obf_finder.py +983 -0
- angr/analyses/deobfuscator/string_obf_opt_passes.py +136 -0
- angr/analyses/deobfuscator/string_obf_peephole_optimizer.py +47 -0
- angr/analyses/disassembly.py +1351 -0
- angr/analyses/disassembly_utils.py +101 -0
- angr/analyses/dominance_frontier.py +57 -0
- angr/analyses/fcp/__init__.py +4 -0
- angr/analyses/fcp/fcp.py +427 -0
- angr/analyses/find_objects_static.py +205 -0
- angr/analyses/flirt/__init__.py +47 -0
- angr/analyses/flirt/consts.py +160 -0
- angr/analyses/flirt/flirt.py +249 -0
- angr/analyses/flirt/flirt_function.py +20 -0
- angr/analyses/flirt/flirt_matcher.py +352 -0
- angr/analyses/flirt/flirt_module.py +32 -0
- angr/analyses/flirt/flirt_node.py +23 -0
- angr/analyses/flirt/flirt_sig.py +359 -0
- angr/analyses/flirt/flirt_utils.py +31 -0
- angr/analyses/forward_analysis/__init__.py +12 -0
- angr/analyses/forward_analysis/forward_analysis.py +619 -0
- angr/analyses/forward_analysis/job_info.py +64 -0
- angr/analyses/forward_analysis/visitors/__init__.py +14 -0
- angr/analyses/forward_analysis/visitors/call_graph.py +29 -0
- angr/analyses/forward_analysis/visitors/function_graph.py +86 -0
- angr/analyses/forward_analysis/visitors/graph.py +242 -0
- angr/analyses/forward_analysis/visitors/loop.py +29 -0
- angr/analyses/forward_analysis/visitors/single_node_graph.py +38 -0
- angr/analyses/identifier/__init__.py +5 -0
- angr/analyses/identifier/custom_callable.py +137 -0
- angr/analyses/identifier/errors.py +10 -0
- angr/analyses/identifier/func.py +60 -0
- angr/analyses/identifier/functions/__init__.py +37 -0
- angr/analyses/identifier/functions/atoi.py +73 -0
- angr/analyses/identifier/functions/based_atoi.py +125 -0
- angr/analyses/identifier/functions/fdprintf.py +123 -0
- angr/analyses/identifier/functions/free.py +64 -0
- angr/analyses/identifier/functions/int2str.py +287 -0
- angr/analyses/identifier/functions/malloc.py +111 -0
- angr/analyses/identifier/functions/memcmp.py +67 -0
- angr/analyses/identifier/functions/memcpy.py +89 -0
- angr/analyses/identifier/functions/memset.py +43 -0
- angr/analyses/identifier/functions/printf.py +123 -0
- angr/analyses/identifier/functions/recv_until.py +312 -0
- angr/analyses/identifier/functions/skip_calloc.py +73 -0
- angr/analyses/identifier/functions/skip_realloc.py +97 -0
- angr/analyses/identifier/functions/skip_recv_n.py +105 -0
- angr/analyses/identifier/functions/snprintf.py +112 -0
- angr/analyses/identifier/functions/sprintf.py +116 -0
- angr/analyses/identifier/functions/strcasecmp.py +33 -0
- angr/analyses/identifier/functions/strcmp.py +113 -0
- angr/analyses/identifier/functions/strcpy.py +43 -0
- angr/analyses/identifier/functions/strlen.py +27 -0
- angr/analyses/identifier/functions/strncmp.py +104 -0
- angr/analyses/identifier/functions/strncpy.py +65 -0
- angr/analyses/identifier/functions/strtol.py +89 -0
- angr/analyses/identifier/identify.py +825 -0
- angr/analyses/identifier/runner.py +360 -0
- angr/analyses/init_finder.py +289 -0
- angr/analyses/loop_analysis/__init__.py +4 -0
- angr/analyses/loop_analysis/loop_analysis.py +464 -0
- angr/analyses/loop_analysis.py +349 -0
- angr/analyses/loop_unroller/__init__.py +4 -0
- angr/analyses/loop_unroller/loop_unroller.py +222 -0
- angr/analyses/loopfinder.py +171 -0
- angr/analyses/outliner/__init__.py +7 -0
- angr/analyses/outliner/outliner.py +402 -0
- angr/analyses/patchfinder.py +137 -0
- angr/analyses/pathfinder.py +282 -0
- angr/analyses/propagator/__init__.py +5 -0
- angr/analyses/propagator/engine_base.py +62 -0
- angr/analyses/propagator/engine_vex.py +297 -0
- angr/analyses/propagator/propagator.py +361 -0
- angr/analyses/propagator/top_checker_mixin.py +218 -0
- angr/analyses/propagator/values.py +117 -0
- angr/analyses/propagator/vex_vars.py +68 -0
- angr/analyses/proximity_graph.py +444 -0
- angr/analyses/purity/__init__.py +15 -0
- angr/analyses/purity/analysis.py +78 -0
- angr/analyses/purity/engine.py +593 -0
- angr/analyses/reaching_definitions/__init__.py +67 -0
- angr/analyses/reaching_definitions/call_trace.py +73 -0
- angr/analyses/reaching_definitions/dep_graph.py +433 -0
- angr/analyses/reaching_definitions/engine_ail.py +1128 -0
- angr/analyses/reaching_definitions/engine_vex.py +1128 -0
- angr/analyses/reaching_definitions/external_codeloc.py +0 -0
- angr/analyses/reaching_definitions/function_handler.py +639 -0
- angr/analyses/reaching_definitions/function_handler_library/__init__.py +12 -0
- angr/analyses/reaching_definitions/function_handler_library/stdio.py +269 -0
- angr/analyses/reaching_definitions/function_handler_library/stdlib.py +195 -0
- angr/analyses/reaching_definitions/function_handler_library/string.py +158 -0
- angr/analyses/reaching_definitions/function_handler_library/unistd.py +51 -0
- angr/analyses/reaching_definitions/heap_allocator.py +70 -0
- angr/analyses/reaching_definitions/rd_initializer.py +237 -0
- angr/analyses/reaching_definitions/rd_state.py +579 -0
- angr/analyses/reaching_definitions/reaching_definitions.py +581 -0
- angr/analyses/reaching_definitions/subject.py +65 -0
- angr/analyses/reassembler.py +2900 -0
- angr/analyses/s_liveness.py +254 -0
- angr/analyses/s_propagator.py +575 -0
- angr/analyses/s_reaching_definitions/__init__.py +12 -0
- angr/analyses/s_reaching_definitions/s_rda_model.py +145 -0
- angr/analyses/s_reaching_definitions/s_rda_view.py +344 -0
- angr/analyses/s_reaching_definitions/s_reaching_definitions.py +230 -0
- angr/analyses/smc.py +160 -0
- angr/analyses/soot_class_hierarchy.py +273 -0
- angr/analyses/stack_pointer_tracker.py +954 -0
- angr/analyses/static_hooker.py +53 -0
- angr/analyses/typehoon/__init__.py +5 -0
- angr/analyses/typehoon/dfa.py +118 -0
- angr/analyses/typehoon/lifter.py +133 -0
- angr/analyses/typehoon/simple_solver.py +2009 -0
- angr/analyses/typehoon/translator.py +283 -0
- angr/analyses/typehoon/typeconsts.py +439 -0
- angr/analyses/typehoon/typehoon.py +338 -0
- angr/analyses/typehoon/typevars.py +633 -0
- angr/analyses/typehoon/variance.py +11 -0
- angr/analyses/unpacker/__init__.py +6 -0
- angr/analyses/unpacker/obfuscation_detector.py +103 -0
- angr/analyses/unpacker/packing_detector.py +138 -0
- angr/analyses/variable_recovery/__init__.py +9 -0
- angr/analyses/variable_recovery/annotations.py +58 -0
- angr/analyses/variable_recovery/engine_ail.py +978 -0
- angr/analyses/variable_recovery/engine_base.py +1256 -0
- angr/analyses/variable_recovery/engine_vex.py +594 -0
- angr/analyses/variable_recovery/irsb_scanner.py +143 -0
- angr/analyses/variable_recovery/variable_recovery.py +574 -0
- angr/analyses/variable_recovery/variable_recovery_base.py +489 -0
- angr/analyses/variable_recovery/variable_recovery_fast.py +669 -0
- angr/analyses/veritesting.py +626 -0
- angr/analyses/vfg.py +1898 -0
- angr/analyses/vsa_ddg.py +420 -0
- angr/analyses/vtable.py +92 -0
- angr/analyses/xrefs.py +286 -0
- angr/angrdb/__init__.py +14 -0
- angr/angrdb/db.py +215 -0
- angr/angrdb/models.py +184 -0
- angr/angrdb/serializers/__init__.py +10 -0
- angr/angrdb/serializers/cfg_model.py +41 -0
- angr/angrdb/serializers/comments.py +60 -0
- angr/angrdb/serializers/funcs.py +61 -0
- angr/angrdb/serializers/kb.py +111 -0
- angr/angrdb/serializers/labels.py +59 -0
- angr/angrdb/serializers/loader.py +165 -0
- angr/angrdb/serializers/structured_code.py +167 -0
- angr/angrdb/serializers/variables.py +58 -0
- angr/angrdb/serializers/xrefs.py +48 -0
- angr/annocfg.py +317 -0
- angr/blade.py +431 -0
- angr/block.py +509 -0
- angr/callable.py +176 -0
- angr/calling_conventions.py +2613 -0
- angr/code_location.py +249 -0
- angr/codenode.py +145 -0
- angr/concretization_strategies/__init__.py +32 -0
- angr/concretization_strategies/any.py +17 -0
- angr/concretization_strategies/any_named.py +35 -0
- angr/concretization_strategies/base.py +81 -0
- angr/concretization_strategies/controlled_data.py +58 -0
- angr/concretization_strategies/eval.py +19 -0
- angr/concretization_strategies/logging.py +35 -0
- angr/concretization_strategies/max.py +25 -0
- angr/concretization_strategies/nonzero.py +16 -0
- angr/concretization_strategies/nonzero_range.py +22 -0
- angr/concretization_strategies/norepeats.py +37 -0
- angr/concretization_strategies/norepeats_range.py +37 -0
- angr/concretization_strategies/range.py +19 -0
- angr/concretization_strategies/signed_add.py +31 -0
- angr/concretization_strategies/single.py +15 -0
- angr/concretization_strategies/solutions.py +20 -0
- angr/concretization_strategies/unlimited_range.py +17 -0
- angr/distributed/__init__.py +9 -0
- angr/distributed/server.py +197 -0
- angr/distributed/worker.py +185 -0
- angr/emulator.py +144 -0
- angr/engines/__init__.py +69 -0
- angr/engines/ail/__init__.py +16 -0
- angr/engines/ail/callstack.py +58 -0
- angr/engines/ail/engine_light.py +903 -0
- angr/engines/ail/engine_successors.py +24 -0
- angr/engines/ail/setup.py +57 -0
- angr/engines/concrete.py +66 -0
- angr/engines/engine.py +29 -0
- angr/engines/failure.py +27 -0
- angr/engines/hook.py +93 -0
- angr/engines/icicle.py +294 -0
- angr/engines/light/__init__.py +23 -0
- angr/engines/light/data.py +681 -0
- angr/engines/light/engine.py +1297 -0
- angr/engines/pcode/__init__.py +9 -0
- angr/engines/pcode/behavior.py +998 -0
- angr/engines/pcode/cc.py +148 -0
- angr/engines/pcode/emulate.py +440 -0
- angr/engines/pcode/engine.py +242 -0
- angr/engines/pcode/lifter.py +1428 -0
- angr/engines/procedure.py +70 -0
- angr/engines/soot/__init__.py +5 -0
- angr/engines/soot/engine.py +410 -0
- angr/engines/soot/exceptions.py +17 -0
- angr/engines/soot/expressions/__init__.py +87 -0
- angr/engines/soot/expressions/arrayref.py +22 -0
- angr/engines/soot/expressions/base.py +21 -0
- angr/engines/soot/expressions/binop.py +28 -0
- angr/engines/soot/expressions/cast.py +22 -0
- angr/engines/soot/expressions/condition.py +35 -0
- angr/engines/soot/expressions/constants.py +47 -0
- angr/engines/soot/expressions/instanceOf.py +15 -0
- angr/engines/soot/expressions/instancefieldref.py +8 -0
- angr/engines/soot/expressions/invoke.py +114 -0
- angr/engines/soot/expressions/length.py +8 -0
- angr/engines/soot/expressions/local.py +8 -0
- angr/engines/soot/expressions/new.py +16 -0
- angr/engines/soot/expressions/newArray.py +54 -0
- angr/engines/soot/expressions/newMultiArray.py +86 -0
- angr/engines/soot/expressions/paramref.py +8 -0
- angr/engines/soot/expressions/phi.py +30 -0
- angr/engines/soot/expressions/staticfieldref.py +8 -0
- angr/engines/soot/expressions/thisref.py +7 -0
- angr/engines/soot/expressions/unsupported.py +7 -0
- angr/engines/soot/field_dispatcher.py +46 -0
- angr/engines/soot/method_dispatcher.py +46 -0
- angr/engines/soot/statements/__init__.py +44 -0
- angr/engines/soot/statements/assign.py +30 -0
- angr/engines/soot/statements/base.py +79 -0
- angr/engines/soot/statements/goto.py +14 -0
- angr/engines/soot/statements/identity.py +15 -0
- angr/engines/soot/statements/if_.py +19 -0
- angr/engines/soot/statements/invoke.py +12 -0
- angr/engines/soot/statements/return_.py +20 -0
- angr/engines/soot/statements/switch.py +41 -0
- angr/engines/soot/statements/throw.py +15 -0
- angr/engines/soot/values/__init__.py +38 -0
- angr/engines/soot/values/arrayref.py +122 -0
- angr/engines/soot/values/base.py +7 -0
- angr/engines/soot/values/constants.py +18 -0
- angr/engines/soot/values/instancefieldref.py +44 -0
- angr/engines/soot/values/local.py +18 -0
- angr/engines/soot/values/paramref.py +18 -0
- angr/engines/soot/values/staticfieldref.py +38 -0
- angr/engines/soot/values/strref.py +38 -0
- angr/engines/soot/values/thisref.py +149 -0
- angr/engines/successors.py +608 -0
- angr/engines/syscall.py +51 -0
- angr/engines/unicorn.py +490 -0
- angr/engines/vex/__init__.py +20 -0
- angr/engines/vex/claripy/__init__.py +5 -0
- angr/engines/vex/claripy/ccall.py +2097 -0
- angr/engines/vex/claripy/datalayer.py +141 -0
- angr/engines/vex/claripy/irop.py +1276 -0
- angr/engines/vex/heavy/__init__.py +16 -0
- angr/engines/vex/heavy/actions.py +231 -0
- angr/engines/vex/heavy/concretizers.py +403 -0
- angr/engines/vex/heavy/dirty.py +466 -0
- angr/engines/vex/heavy/heavy.py +370 -0
- angr/engines/vex/heavy/inspect.py +52 -0
- angr/engines/vex/heavy/resilience.py +85 -0
- angr/engines/vex/heavy/super_fastpath.py +34 -0
- angr/engines/vex/lifter.py +420 -0
- angr/engines/vex/light/__init__.py +11 -0
- angr/engines/vex/light/light.py +551 -0
- angr/engines/vex/light/resilience.py +74 -0
- angr/engines/vex/light/slicing.py +52 -0
- angr/errors.py +611 -0
- angr/exploration_techniques/__init__.py +53 -0
- angr/exploration_techniques/base.py +126 -0
- angr/exploration_techniques/bucketizer.py +94 -0
- angr/exploration_techniques/common.py +56 -0
- angr/exploration_techniques/dfs.py +37 -0
- angr/exploration_techniques/director.py +520 -0
- angr/exploration_techniques/driller_core.py +100 -0
- angr/exploration_techniques/explorer.py +152 -0
- angr/exploration_techniques/lengthlimiter.py +22 -0
- angr/exploration_techniques/local_loop_seer.py +65 -0
- angr/exploration_techniques/loop_seer.py +236 -0
- angr/exploration_techniques/manual_mergepoint.py +82 -0
- angr/exploration_techniques/memory_watcher.py +43 -0
- angr/exploration_techniques/oppologist.py +92 -0
- angr/exploration_techniques/slicecutor.py +118 -0
- angr/exploration_techniques/spiller.py +280 -0
- angr/exploration_techniques/spiller_db.py +27 -0
- angr/exploration_techniques/stochastic.py +56 -0
- angr/exploration_techniques/stub_stasher.py +19 -0
- angr/exploration_techniques/suggestions.py +159 -0
- angr/exploration_techniques/tech_builder.py +49 -0
- angr/exploration_techniques/threading.py +69 -0
- angr/exploration_techniques/timeout.py +34 -0
- angr/exploration_techniques/tracer.py +1098 -0
- angr/exploration_techniques/unique.py +106 -0
- angr/exploration_techniques/veritesting.py +37 -0
- angr/factory.py +413 -0
- angr/flirt/__init__.py +124 -0
- angr/flirt/build_sig.py +305 -0
- angr/graph_utils.py +0 -0
- angr/keyed_region.py +525 -0
- angr/knowledge_base.py +146 -0
- angr/knowledge_plugins/__init__.py +43 -0
- angr/knowledge_plugins/callsite_prototypes.py +95 -0
- angr/knowledge_plugins/cfg/__init__.py +18 -0
- angr/knowledge_plugins/cfg/cfg_manager.py +95 -0
- angr/knowledge_plugins/cfg/cfg_model.py +1043 -0
- angr/knowledge_plugins/cfg/cfg_node.py +536 -0
- angr/knowledge_plugins/cfg/indirect_jump.py +131 -0
- angr/knowledge_plugins/cfg/memory_data.py +156 -0
- angr/knowledge_plugins/comments.py +16 -0
- angr/knowledge_plugins/custom_strings.py +38 -0
- angr/knowledge_plugins/data.py +22 -0
- angr/knowledge_plugins/debug_variables.py +216 -0
- angr/knowledge_plugins/functions/__init__.py +9 -0
- angr/knowledge_plugins/functions/function.py +1830 -0
- angr/knowledge_plugins/functions/function_manager.py +621 -0
- angr/knowledge_plugins/functions/function_parser.py +360 -0
- angr/knowledge_plugins/functions/soot_function.py +128 -0
- angr/knowledge_plugins/indirect_jumps.py +35 -0
- angr/knowledge_plugins/key_definitions/__init__.py +17 -0
- angr/knowledge_plugins/key_definitions/atoms.py +374 -0
- angr/knowledge_plugins/key_definitions/constants.py +29 -0
- angr/knowledge_plugins/key_definitions/definition.py +216 -0
- angr/knowledge_plugins/key_definitions/environment.py +96 -0
- angr/knowledge_plugins/key_definitions/heap_address.py +33 -0
- angr/knowledge_plugins/key_definitions/key_definition_manager.py +82 -0
- angr/knowledge_plugins/key_definitions/live_definitions.py +1020 -0
- angr/knowledge_plugins/key_definitions/liveness.py +165 -0
- angr/knowledge_plugins/key_definitions/rd_model.py +171 -0
- angr/knowledge_plugins/key_definitions/tag.py +78 -0
- angr/knowledge_plugins/key_definitions/undefined.py +70 -0
- angr/knowledge_plugins/key_definitions/unknown_size.py +86 -0
- angr/knowledge_plugins/key_definitions/uses.py +178 -0
- angr/knowledge_plugins/labels.py +110 -0
- angr/knowledge_plugins/obfuscations.py +40 -0
- angr/knowledge_plugins/patches.py +126 -0
- angr/knowledge_plugins/plugin.py +24 -0
- angr/knowledge_plugins/propagations/__init__.py +10 -0
- angr/knowledge_plugins/propagations/prop_value.py +191 -0
- angr/knowledge_plugins/propagations/propagation_manager.py +60 -0
- angr/knowledge_plugins/propagations/propagation_model.py +80 -0
- angr/knowledge_plugins/propagations/states.py +552 -0
- angr/knowledge_plugins/structured_code.py +63 -0
- angr/knowledge_plugins/types.py +95 -0
- angr/knowledge_plugins/variables/__init__.py +8 -0
- angr/knowledge_plugins/variables/variable_access.py +113 -0
- angr/knowledge_plugins/variables/variable_manager.py +1375 -0
- angr/knowledge_plugins/xrefs/__init__.py +12 -0
- angr/knowledge_plugins/xrefs/xref.py +150 -0
- angr/knowledge_plugins/xrefs/xref_manager.py +127 -0
- angr/knowledge_plugins/xrefs/xref_types.py +16 -0
- angr/misc/__init__.py +19 -0
- angr/misc/ansi.py +47 -0
- angr/misc/autoimport.py +90 -0
- angr/misc/bug_report.py +126 -0
- angr/misc/hookset.py +106 -0
- angr/misc/loggers.py +130 -0
- angr/misc/picklable_lock.py +46 -0
- angr/misc/plugins.py +289 -0
- angr/misc/telemetry.py +54 -0
- angr/misc/testing.py +24 -0
- angr/misc/ux.py +31 -0
- angr/procedures/__init__.py +12 -0
- angr/procedures/advapi32/__init__.py +0 -0
- angr/procedures/cgc/__init__.py +3 -0
- angr/procedures/cgc/_terminate.py +11 -0
- angr/procedures/cgc/allocate.py +75 -0
- angr/procedures/cgc/deallocate.py +67 -0
- angr/procedures/cgc/fdwait.py +65 -0
- angr/procedures/cgc/random.py +67 -0
- angr/procedures/cgc/receive.py +93 -0
- angr/procedures/cgc/transmit.py +65 -0
- angr/procedures/definitions/__init__.py +1043 -0
- angr/procedures/definitions/cgc.py +23 -0
- angr/procedures/definitions/common/glibc.json +3516 -0
- angr/procedures/definitions/gnulib.py +41 -0
- angr/procedures/definitions/libstdcpp.py +25 -0
- angr/procedures/definitions/linux_kernel.py +8382 -0
- angr/procedures/definitions/linux_loader.py +7 -0
- angr/procedures/definitions/macho_libsystem.py +18 -0
- angr/procedures/definitions/msvcr.py +25 -0
- angr/procedures/definitions/parse_glibc.py +77 -0
- angr/procedures/definitions/parse_syscalls_from_local_system.py +54 -0
- angr/procedures/definitions/parse_win32json.py +2540 -0
- angr/procedures/definitions/types_stl.py +22 -0
- angr/procedures/definitions/wdk/api-ms-win-dx-d3dkmt-l1-1-4.json +24 -0
- angr/procedures/definitions/wdk/api-ms-win-dx-d3dkmt-l1-1-6.json +18 -0
- angr/procedures/definitions/wdk/clfs.json +189 -0
- angr/procedures/definitions/wdk/fltmgr.json +813 -0
- angr/procedures/definitions/wdk/fwpkclnt.json +24 -0
- angr/procedures/definitions/wdk/fwpuclnt.json +453 -0
- angr/procedures/definitions/wdk/gdi32.json +528 -0
- angr/procedures/definitions/wdk/hal.json +96 -0
- angr/procedures/definitions/wdk/ksecdd.json +72 -0
- angr/procedures/definitions/wdk/ndis.json +336 -0
- angr/procedures/definitions/wdk/ntoskrnl.json +5158 -0
- angr/procedures/definitions/wdk/offreg.json +87 -0
- angr/procedures/definitions/wdk/pshed.json +33 -0
- angr/procedures/definitions/wdk/secur32.json +39 -0
- angr/procedures/definitions/wdk/vhfum.json +30 -0
- angr/procedures/definitions/win32/_types_win32.json +34480 -0
- angr/procedures/definitions/win32/aclui.json +24 -0
- angr/procedures/definitions/win32/activeds.json +81 -0
- angr/procedures/definitions/win32/advapi32.json +2505 -0
- angr/procedures/definitions/win32/advpack.json +165 -0
- angr/procedures/definitions/win32/amsi.json +36 -0
- angr/procedures/definitions/win32/api-ms-win-appmodel-runtime-l1-1-1.json +45 -0
- angr/procedures/definitions/win32/api-ms-win-appmodel-runtime-l1-1-3.json +30 -0
- angr/procedures/definitions/win32/api-ms-win-appmodel-runtime-l1-1-6.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-apiquery-l2-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-backgroundtask-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-comm-l1-1-1.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-comm-l1-1-2.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-enclave-l1-1-1.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-errorhandling-l1-1-3.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-featurestaging-l1-1-0.json +30 -0
- angr/procedures/definitions/win32/api-ms-win-core-featurestaging-l1-1-1.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-file-fromapp-l1-1-0.json +48 -0
- angr/procedures/definitions/win32/api-ms-win-core-handle-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-ioring-l1-1-0.json +51 -0
- angr/procedures/definitions/win32/api-ms-win-core-marshal-l1-1-0.json +27 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-3.json +27 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-4.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-5.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-6.json +27 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-7.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-memory-l1-1-8.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-path-l1-1-0.json +81 -0
- angr/procedures/definitions/win32/api-ms-win-core-psm-appnotify-l1-1-0.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-psm-appnotify-l1-1-1.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-realtime-l1-1-1.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-realtime-l1-1-2.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-slapi-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-state-helpers-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-synch-l1-2-0.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-core-sysinfo-l1-2-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-sysinfo-l1-2-3.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-sysinfo-l1-2-4.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-sysinfo-l1-2-6.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-core-util-l1-1-1.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-core-wow64-l1-1-1.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-devices-query-l1-1-0.json +42 -0
- angr/procedures/definitions/win32/api-ms-win-devices-query-l1-1-1.json +30 -0
- angr/procedures/definitions/win32/api-ms-win-dx-d3dkmt-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-deviceinformation-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-expandedresources-l1-1-0.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-tcui-l1-1-0.json +36 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-tcui-l1-1-1.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-tcui-l1-1-2.json +36 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-tcui-l1-1-3.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-gaming-tcui-l1-1-4.json +39 -0
- angr/procedures/definitions/win32/api-ms-win-mm-misc-l1-1-1.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-net-isolation-l1-1-0.json +39 -0
- angr/procedures/definitions/win32/api-ms-win-security-base-l1-2-2.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-security-isolatedcontainer-l1-1-0.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-security-isolatedcontainer-l1-1-1.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-service-core-l1-1-3.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-service-core-l1-1-4.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-service-core-l1-1-5.json +21 -0
- angr/procedures/definitions/win32/api-ms-win-shcore-scaling-l1-1-0.json +24 -0
- angr/procedures/definitions/win32/api-ms-win-shcore-scaling-l1-1-1.json +33 -0
- angr/procedures/definitions/win32/api-ms-win-shcore-scaling-l1-1-2.json +18 -0
- angr/procedures/definitions/win32/api-ms-win-wsl-api-l1-1-0.json +36 -0
- angr/procedures/definitions/win32/apphelp.json +18 -0
- angr/procedures/definitions/win32/authz.json +114 -0
- angr/procedures/definitions/win32/avicap32.json +27 -0
- angr/procedures/definitions/win32/avifil32.json +195 -0
- angr/procedures/definitions/win32/avrt.json +57 -0
- angr/procedures/definitions/win32/bcp47mrm.json +21 -0
- angr/procedures/definitions/win32/bcrypt.json +174 -0
- angr/procedures/definitions/win32/bcryptprimitives.json +21 -0
- angr/procedures/definitions/win32/bluetoothapis.json +138 -0
- angr/procedures/definitions/win32/bthprops_cpl.json +33 -0
- angr/procedures/definitions/win32/cabinet.json +81 -0
- angr/procedures/definitions/win32/certadm.json +69 -0
- angr/procedures/definitions/win32/certpoleng.json +39 -0
- angr/procedures/definitions/win32/cfgmgr32.json +732 -0
- angr/procedures/definitions/win32/chakra.json +270 -0
- angr/procedures/definitions/win32/cldapi.json +123 -0
- angr/procedures/definitions/win32/clfsw32.json +192 -0
- angr/procedures/definitions/win32/clusapi.json +855 -0
- angr/procedures/definitions/win32/comctl32.json +360 -0
- angr/procedures/definitions/win32/comdlg32.json +78 -0
- angr/procedures/definitions/win32/compstui.json +27 -0
- angr/procedures/definitions/win32/computecore.json +177 -0
- angr/procedures/definitions/win32/computenetwork.json +144 -0
- angr/procedures/definitions/win32/computestorage.json +51 -0
- angr/procedures/definitions/win32/comsvcs.json +36 -0
- angr/procedures/definitions/win32/credui.json +72 -0
- angr/procedures/definitions/win32/crypt32.json +702 -0
- angr/procedures/definitions/win32/cryptnet.json +30 -0
- angr/procedures/definitions/win32/cryptui.json +45 -0
- angr/procedures/definitions/win32/cryptxml.json +72 -0
- angr/procedures/definitions/win32/cscapi.json +27 -0
- angr/procedures/definitions/win32/d2d1.json +54 -0
- angr/procedures/definitions/win32/d3d10.json +96 -0
- angr/procedures/definitions/win32/d3d10_1.json +21 -0
- angr/procedures/definitions/win32/d3d11.json +24 -0
- angr/procedures/definitions/win32/d3d12.json +39 -0
- angr/procedures/definitions/win32/d3d9.json +48 -0
- angr/procedures/definitions/win32/d3dcompiler_47.json +93 -0
- angr/procedures/definitions/win32/d3dcsx.json +42 -0
- angr/procedures/definitions/win32/davclnt.json +69 -0
- angr/procedures/definitions/win32/dbgeng.json +27 -0
- angr/procedures/definitions/win32/dbghelp.json +663 -0
- angr/procedures/definitions/win32/dbgmodel.json +18 -0
- angr/procedures/definitions/win32/dciman32.json +75 -0
- angr/procedures/definitions/win32/dcomp.json +51 -0
- angr/procedures/definitions/win32/ddraw.json +36 -0
- angr/procedures/definitions/win32/deviceaccess.json +18 -0
- angr/procedures/definitions/win32/dflayout.json +18 -0
- angr/procedures/definitions/win32/dhcpcsvc.json +60 -0
- angr/procedures/definitions/win32/dhcpcsvc6.json +33 -0
- angr/procedures/definitions/win32/dhcpsapi.json +603 -0
- angr/procedures/definitions/win32/diagnosticdataquery.json +120 -0
- angr/procedures/definitions/win32/dinput8.json +18 -0
- angr/procedures/definitions/win32/directml.json +21 -0
- angr/procedures/definitions/win32/dmprocessxmlfiltered.json +18 -0
- angr/procedures/definitions/win32/dnsapi.json +207 -0
- angr/procedures/definitions/win32/drt.json +63 -0
- angr/procedures/definitions/win32/drtprov.json +42 -0
- angr/procedures/definitions/win32/drttransport.json +21 -0
- angr/procedures/definitions/win32/dsound.json +45 -0
- angr/procedures/definitions/win32/dsparse.json +72 -0
- angr/procedures/definitions/win32/dsprop.json +36 -0
- angr/procedures/definitions/win32/dssec.json +27 -0
- angr/procedures/definitions/win32/dsuiext.json +27 -0
- angr/procedures/definitions/win32/dwmapi.json +108 -0
- angr/procedures/definitions/win32/dwrite.json +18 -0
- angr/procedures/definitions/win32/dxcompiler.json +21 -0
- angr/procedures/definitions/win32/dxcore.json +18 -0
- angr/procedures/definitions/win32/dxgi.json +33 -0
- angr/procedures/definitions/win32/dxva2.json +129 -0
- angr/procedures/definitions/win32/eappcfg.json +57 -0
- angr/procedures/definitions/win32/eappprxy.json +69 -0
- angr/procedures/definitions/win32/efswrt.json +21 -0
- angr/procedures/definitions/win32/elscore.json +30 -0
- angr/procedures/definitions/win32/esent.json +702 -0
- angr/procedures/definitions/win32/evr.json +36 -0
- angr/procedures/definitions/win32/faultrep.json +27 -0
- angr/procedures/definitions/win32/fhsvcctl.json +36 -0
- angr/procedures/definitions/win32/firewallapi.json +24 -0
- angr/procedures/definitions/win32/fltlib.json +99 -0
- angr/procedures/definitions/win32/fontsub.json +21 -0
- angr/procedures/definitions/win32/forceinline.json +24 -0
- angr/procedures/definitions/win32/fwpuclnt.json +591 -0
- angr/procedures/definitions/win32/fxsutility.json +21 -0
- angr/procedures/definitions/win32/gdi32.json +1308 -0
- angr/procedures/definitions/win32/gdiplus.json +1902 -0
- angr/procedures/definitions/win32/glu32.json +171 -0
- angr/procedures/definitions/win32/gpedit.json +33 -0
- angr/procedures/definitions/win32/hhctrl_ocx.json +21 -0
- angr/procedures/definitions/win32/hid.json +150 -0
- angr/procedures/definitions/win32/hlink.json +99 -0
- angr/procedures/definitions/win32/hrtfapo.json +18 -0
- angr/procedures/definitions/win32/httpapi.json +144 -0
- angr/procedures/definitions/win32/icm32.json +78 -0
- angr/procedures/definitions/win32/icmui.json +21 -0
- angr/procedures/definitions/win32/icu.json +3090 -0
- angr/procedures/definitions/win32/ieframe.json +102 -0
- angr/procedures/definitions/win32/imagehlp.json +84 -0
- angr/procedures/definitions/win32/imgutil.json +42 -0
- angr/procedures/definitions/win32/imm32.json +261 -0
- angr/procedures/definitions/win32/infocardapi.json +66 -0
- angr/procedures/definitions/win32/inkobjcore.json +96 -0
- angr/procedures/definitions/win32/iphlpapi.json +618 -0
- angr/procedures/definitions/win32/iscsidsc.json +252 -0
- angr/procedures/definitions/win32/isolatedwindowsenvironmentutils.json +21 -0
- angr/procedures/definitions/win32/kernel32.json +4566 -0
- angr/procedures/definitions/win32/kernelbase.json +33 -0
- angr/procedures/definitions/win32/keycredmgr.json +27 -0
- angr/procedures/definitions/win32/ksproxy_ax.json +33 -0
- angr/procedures/definitions/win32/ksuser.json +39 -0
- angr/procedures/definitions/win32/ktmw32.json +132 -0
- angr/procedures/definitions/win32/licenseprotection.json +21 -0
- angr/procedures/definitions/win32/loadperf.json +51 -0
- angr/procedures/definitions/win32/magnification.json +72 -0
- angr/procedures/definitions/win32/mapi32.json +213 -0
- angr/procedures/definitions/win32/mdmlocalmanagement.json +24 -0
- angr/procedures/definitions/win32/mdmregistration.json +60 -0
- angr/procedures/definitions/win32/mf.json +201 -0
- angr/procedures/definitions/win32/mfcore.json +21 -0
- angr/procedures/definitions/win32/mfplat.json +450 -0
- angr/procedures/definitions/win32/mfplay.json +18 -0
- angr/procedures/definitions/win32/mfreadwrite.json +30 -0
- angr/procedures/definitions/win32/mfsensorgroup.json +45 -0
- angr/procedures/definitions/win32/mfsrcsnk.json +21 -0
- angr/procedures/definitions/win32/mgmtapi.json +42 -0
- angr/procedures/definitions/win32/mi.json +18 -0
- angr/procedures/definitions/win32/mmdevapi.json +18 -0
- angr/procedures/definitions/win32/mpr.json +156 -0
- angr/procedures/definitions/win32/mprapi.json +351 -0
- angr/procedures/definitions/win32/mqrt.json +117 -0
- angr/procedures/definitions/win32/mrmsupport.json +96 -0
- angr/procedures/definitions/win32/msacm32.json +141 -0
- angr/procedures/definitions/win32/msajapi.json +1656 -0
- angr/procedures/definitions/win32/mscms.json +252 -0
- angr/procedures/definitions/win32/mscoree.json +96 -0
- angr/procedures/definitions/win32/msctfmonitor.json +24 -0
- angr/procedures/definitions/win32/msdelta.json +63 -0
- angr/procedures/definitions/win32/msdmo.json +48 -0
- angr/procedures/definitions/win32/msdrm.json +267 -0
- angr/procedures/definitions/win32/msi.json +807 -0
- angr/procedures/definitions/win32/msimg32.json +24 -0
- angr/procedures/definitions/win32/mspatcha.json +63 -0
- angr/procedures/definitions/win32/mspatchc.json +42 -0
- angr/procedures/definitions/win32/msports.json +36 -0
- angr/procedures/definitions/win32/msrating.json +72 -0
- angr/procedures/definitions/win32/mssign32.json +45 -0
- angr/procedures/definitions/win32/mstask.json +21 -0
- angr/procedures/definitions/win32/msvfw32.json +144 -0
- angr/procedures/definitions/win32/mswsock.json +63 -0
- angr/procedures/definitions/win32/mtxdm.json +18 -0
- angr/procedures/definitions/win32/ncrypt.json +132 -0
- angr/procedures/definitions/win32/ndfapi.json +63 -0
- angr/procedures/definitions/win32/netapi32.json +633 -0
- angr/procedures/definitions/win32/netsh.json +39 -0
- angr/procedures/definitions/win32/netshell.json +21 -0
- angr/procedures/definitions/win32/newdev.json +48 -0
- angr/procedures/definitions/win32/ninput.json +105 -0
- angr/procedures/definitions/win32/normaliz.json +21 -0
- angr/procedures/definitions/win32/ntdll.json +234 -0
- angr/procedures/definitions/win32/ntdllk.json +18 -0
- angr/procedures/definitions/win32/ntdsapi.json +258 -0
- angr/procedures/definitions/win32/ntlanman.json +45 -0
- angr/procedures/definitions/win32/odbc32.json +477 -0
- angr/procedures/definitions/win32/odbcbcp.json +96 -0
- angr/procedures/definitions/win32/ole32.json +966 -0
- angr/procedures/definitions/win32/oleacc.json +66 -0
- angr/procedures/definitions/win32/oleaut32.json +1230 -0
- angr/procedures/definitions/win32/oledlg.json +84 -0
- angr/procedures/definitions/win32/ondemandconnroutehelper.json +30 -0
- angr/procedures/definitions/win32/opengl32.json +1080 -0
- angr/procedures/definitions/win32/opmxbox.json +24 -0
- angr/procedures/definitions/win32/p2p.json +339 -0
- angr/procedures/definitions/win32/p2pgraph.json +126 -0
- angr/procedures/definitions/win32/pdh.json +309 -0
- angr/procedures/definitions/win32/peerdist.json +99 -0
- angr/procedures/definitions/win32/powrprof.json +267 -0
- angr/procedures/definitions/win32/prntvpt.json +48 -0
- angr/procedures/definitions/win32/projectedfslib.json +72 -0
- angr/procedures/definitions/win32/propsys.json +669 -0
- angr/procedures/definitions/win32/psapi.json +96 -0
- angr/procedures/definitions/win32/quartz.json +21 -0
- angr/procedures/definitions/win32/query.json +27 -0
- angr/procedures/definitions/win32/qwave.json +48 -0
- angr/procedures/definitions/win32/rasapi32.json +267 -0
- angr/procedures/definitions/win32/rasdlg.json +33 -0
- angr/procedures/definitions/win32/resutils.json +375 -0
- angr/procedures/definitions/win32/rpcns4.json +198 -0
- angr/procedures/definitions/win32/rpcproxy.json +27 -0
- angr/procedures/definitions/win32/rpcrt4.json +1356 -0
- angr/procedures/definitions/win32/rstrtmgr.json +48 -0
- angr/procedures/definitions/win32/rtm.json +243 -0
- angr/procedures/definitions/win32/rtutils.json +138 -0
- angr/procedures/definitions/win32/rtworkq.json +114 -0
- angr/procedures/definitions/win32/sas.json +18 -0
- angr/procedures/definitions/win32/scarddlg.json +30 -0
- angr/procedures/definitions/win32/schannel.json +42 -0
- angr/procedures/definitions/win32/sechost.json +21 -0
- angr/procedures/definitions/win32/secur32.json +282 -0
- angr/procedures/definitions/win32/sensapi.json +24 -0
- angr/procedures/definitions/win32/sensorsutilsv2.json +135 -0
- angr/procedures/definitions/win32/setupapi.json +1017 -0
- angr/procedures/definitions/win32/sfc.json +33 -0
- angr/procedures/definitions/win32/shdocvw.json +24 -0
- angr/procedures/definitions/win32/shell32.json +747 -0
- angr/procedures/definitions/win32/shlwapi.json +1095 -0
- angr/procedures/definitions/win32/slc.json +111 -0
- angr/procedures/definitions/win32/slcext.json +27 -0
- angr/procedures/definitions/win32/slwga.json +18 -0
- angr/procedures/definitions/win32/snmpapi.json +93 -0
- angr/procedures/definitions/win32/spoolss.json +93 -0
- angr/procedures/definitions/win32/srclient.json +18 -0
- angr/procedures/definitions/win32/srpapi.json +48 -0
- angr/procedures/definitions/win32/sspicli.json +36 -0
- angr/procedures/definitions/win32/sti.json +18 -0
- angr/procedures/definitions/win32/t2embed.json +57 -0
- angr/procedures/definitions/win32/tapi32.json +762 -0
- angr/procedures/definitions/win32/tbs.json +57 -0
- angr/procedures/definitions/win32/tdh.json +96 -0
- angr/procedures/definitions/win32/tokenbinding.json +45 -0
- angr/procedures/definitions/win32/traffic.json +75 -0
- angr/procedures/definitions/win32/txfw32.json +42 -0
- angr/procedures/definitions/win32/ualapi.json +27 -0
- angr/procedures/definitions/win32/uiautomationcore.json +309 -0
- angr/procedures/definitions/win32/urlmon.json +246 -0
- angr/procedures/definitions/win32/user32.json +2298 -0
- angr/procedures/definitions/win32/userenv.json +147 -0
- angr/procedures/definitions/win32/usp10.json +135 -0
- angr/procedures/definitions/win32/uxtheme.json +246 -0
- angr/procedures/definitions/win32/verifier.json +18 -0
- angr/procedures/definitions/win32/version.json +57 -0
- angr/procedures/definitions/win32/vertdll.json +36 -0
- angr/procedures/definitions/win32/virtdisk.json +102 -0
- angr/procedures/definitions/win32/vmdevicehost.json +54 -0
- angr/procedures/definitions/win32/vmsavedstatedumpprovider.json +144 -0
- angr/procedures/definitions/win32/vssapi.json +18 -0
- angr/procedures/definitions/win32/wcmapi.json +30 -0
- angr/procedures/definitions/win32/wdsbp.json +36 -0
- angr/procedures/definitions/win32/wdsclientapi.json +126 -0
- angr/procedures/definitions/win32/wdsmc.json +33 -0
- angr/procedures/definitions/win32/wdspxe.json +108 -0
- angr/procedures/definitions/win32/wdstptc.json +54 -0
- angr/procedures/definitions/win32/webauthn.json +54 -0
- angr/procedures/definitions/win32/webservices.json +594 -0
- angr/procedures/definitions/win32/websocket.json +54 -0
- angr/procedures/definitions/win32/wecapi.json +60 -0
- angr/procedures/definitions/win32/wer.json +78 -0
- angr/procedures/definitions/win32/wevtapi.json +120 -0
- angr/procedures/definitions/win32/winbio.json +177 -0
- angr/procedures/definitions/win32/windows_ai_machinelearning.json +18 -0
- angr/procedures/definitions/win32/windows_media_mediacontrol.json +39 -0
- angr/procedures/definitions/win32/windows_networking.json +18 -0
- angr/procedures/definitions/win32/windows_ui_xaml.json +21 -0
- angr/procedures/definitions/win32/windowscodecs.json +42 -0
- angr/procedures/definitions/win32/winfax.json +183 -0
- angr/procedures/definitions/win32/winhttp.json +183 -0
- angr/procedures/definitions/win32/winhvemulation.json +27 -0
- angr/procedures/definitions/win32/winhvplatform.json +213 -0
- angr/procedures/definitions/win32/wininet.json +903 -0
- angr/procedures/definitions/win32/winml.json +18 -0
- angr/procedures/definitions/win32/winmm.json +543 -0
- angr/procedures/definitions/win32/winscard.json +225 -0
- angr/procedures/definitions/win32/winspool_drv.json +531 -0
- angr/procedures/definitions/win32/wintrust.json +195 -0
- angr/procedures/definitions/win32/winusb.json +117 -0
- angr/procedures/definitions/win32/wlanapi.json +195 -0
- angr/procedures/definitions/win32/wlanui.json +18 -0
- angr/procedures/definitions/win32/wldap32.json +744 -0
- angr/procedures/definitions/win32/wldp.json +42 -0
- angr/procedures/definitions/win32/wmvcore.json +48 -0
- angr/procedures/definitions/win32/wnvapi.json +21 -0
- angr/procedures/definitions/win32/wofutil.json +48 -0
- angr/procedures/definitions/win32/ws2_32.json +495 -0
- angr/procedures/definitions/win32/wscapi.json +33 -0
- angr/procedures/definitions/win32/wsclient.json +24 -0
- angr/procedures/definitions/win32/wsdapi.json +111 -0
- angr/procedures/definitions/win32/wsmsvc.json +114 -0
- angr/procedures/definitions/win32/wsnmp32.json +162 -0
- angr/procedures/definitions/win32/wtsapi32.json +204 -0
- angr/procedures/definitions/win32/xaudio2_8.json +27 -0
- angr/procedures/definitions/win32/xinput1_4.json +36 -0
- angr/procedures/definitions/win32/xmllite.json +33 -0
- angr/procedures/definitions/win32/xolehlp.json +27 -0
- angr/procedures/definitions/win32/xpsprint.json +21 -0
- angr/procedures/glibc/__ctype_b_loc.py +21 -0
- angr/procedures/glibc/__ctype_tolower_loc.py +21 -0
- angr/procedures/glibc/__ctype_toupper_loc.py +21 -0
- angr/procedures/glibc/__errno_location.py +7 -0
- angr/procedures/glibc/__init__.py +3 -0
- angr/procedures/glibc/__libc_init.py +37 -0
- angr/procedures/glibc/__libc_start_main.py +301 -0
- angr/procedures/glibc/dynamic_loading.py +20 -0
- angr/procedures/glibc/scanf.py +19 -0
- angr/procedures/glibc/sscanf.py +10 -0
- angr/procedures/gnulib/__init__.py +3 -0
- angr/procedures/gnulib/xalloc_die.py +14 -0
- angr/procedures/gnulib/xstrtol_fatal.py +14 -0
- angr/procedures/java/__init__.py +42 -0
- angr/procedures/java/unconstrained.py +65 -0
- angr/procedures/java_io/__init__.py +0 -0
- angr/procedures/java_io/read.py +12 -0
- angr/procedures/java_io/write.py +17 -0
- angr/procedures/java_jni/__init__.py +482 -0
- angr/procedures/java_jni/array_operations.py +312 -0
- angr/procedures/java_jni/class_and_interface_operations.py +31 -0
- angr/procedures/java_jni/field_access.py +173 -0
- angr/procedures/java_jni/global_and_local_refs.py +57 -0
- angr/procedures/java_jni/method_calls.py +365 -0
- angr/procedures/java_jni/not_implemented.py +26 -0
- angr/procedures/java_jni/object_operations.py +94 -0
- angr/procedures/java_jni/string_operations.py +87 -0
- angr/procedures/java_jni/version_information.py +12 -0
- angr/procedures/java_lang/__init__.py +0 -0
- angr/procedures/java_lang/character.py +30 -0
- angr/procedures/java_lang/double.py +24 -0
- angr/procedures/java_lang/exit.py +13 -0
- angr/procedures/java_lang/getsimplename.py +18 -0
- angr/procedures/java_lang/integer.py +43 -0
- angr/procedures/java_lang/load_library.py +9 -0
- angr/procedures/java_lang/math.py +15 -0
- angr/procedures/java_lang/string.py +78 -0
- angr/procedures/java_lang/stringbuilder.py +44 -0
- angr/procedures/java_lang/system.py +18 -0
- angr/procedures/java_util/__init__.py +0 -0
- angr/procedures/java_util/collection.py +35 -0
- angr/procedures/java_util/iterator.py +46 -0
- angr/procedures/java_util/list.py +99 -0
- angr/procedures/java_util/map.py +131 -0
- angr/procedures/java_util/random.py +14 -0
- angr/procedures/java_util/scanner_nextline.py +23 -0
- angr/procedures/libc/__init__.py +3 -0
- angr/procedures/libc/abort.py +9 -0
- angr/procedures/libc/access.py +13 -0
- angr/procedures/libc/atoi.py +14 -0
- angr/procedures/libc/atol.py +13 -0
- angr/procedures/libc/calloc.py +8 -0
- angr/procedures/libc/closelog.py +10 -0
- angr/procedures/libc/err.py +14 -0
- angr/procedures/libc/error.py +54 -0
- angr/procedures/libc/exit.py +11 -0
- angr/procedures/libc/fclose.py +19 -0
- angr/procedures/libc/feof.py +21 -0
- angr/procedures/libc/fflush.py +16 -0
- angr/procedures/libc/fgetc.py +27 -0
- angr/procedures/libc/fgets.py +69 -0
- angr/procedures/libc/fopen.py +63 -0
- angr/procedures/libc/fprintf.py +25 -0
- angr/procedures/libc/fputc.py +23 -0
- angr/procedures/libc/fputs.py +24 -0
- angr/procedures/libc/fread.py +24 -0
- angr/procedures/libc/free.py +9 -0
- angr/procedures/libc/fscanf.py +20 -0
- angr/procedures/libc/fseek.py +34 -0
- angr/procedures/libc/ftell.py +22 -0
- angr/procedures/libc/fwrite.py +19 -0
- angr/procedures/libc/getchar.py +13 -0
- angr/procedures/libc/getdelim.py +99 -0
- angr/procedures/libc/getegid.py +8 -0
- angr/procedures/libc/geteuid.py +8 -0
- angr/procedures/libc/getgid.py +8 -0
- angr/procedures/libc/gets.py +68 -0
- angr/procedures/libc/getuid.py +8 -0
- angr/procedures/libc/malloc.py +12 -0
- angr/procedures/libc/memcmp.py +69 -0
- angr/procedures/libc/memcpy.py +45 -0
- angr/procedures/libc/memset.py +72 -0
- angr/procedures/libc/openlog.py +10 -0
- angr/procedures/libc/perror.py +13 -0
- angr/procedures/libc/printf.py +34 -0
- angr/procedures/libc/putchar.py +13 -0
- angr/procedures/libc/puts.py +19 -0
- angr/procedures/libc/rand.py +8 -0
- angr/procedures/libc/realloc.py +8 -0
- angr/procedures/libc/rewind.py +12 -0
- angr/procedures/libc/scanf.py +20 -0
- angr/procedures/libc/setbuf.py +9 -0
- angr/procedures/libc/setvbuf.py +7 -0
- angr/procedures/libc/snprintf.py +36 -0
- angr/procedures/libc/sprintf.py +25 -0
- angr/procedures/libc/srand.py +7 -0
- angr/procedures/libc/sscanf.py +13 -0
- angr/procedures/libc/stpcpy.py +18 -0
- angr/procedures/libc/strcat.py +14 -0
- angr/procedures/libc/strchr.py +48 -0
- angr/procedures/libc/strcmp.py +31 -0
- angr/procedures/libc/strcpy.py +13 -0
- angr/procedures/libc/strlen.py +114 -0
- angr/procedures/libc/strncat.py +19 -0
- angr/procedures/libc/strncmp.py +183 -0
- angr/procedures/libc/strncpy.py +22 -0
- angr/procedures/libc/strnlen.py +13 -0
- angr/procedures/libc/strstr.py +101 -0
- angr/procedures/libc/strtol.py +261 -0
- angr/procedures/libc/strtoul.py +9 -0
- angr/procedures/libc/system.py +13 -0
- angr/procedures/libc/time.py +9 -0
- angr/procedures/libc/tmpnam.py +20 -0
- angr/procedures/libc/tolower.py +10 -0
- angr/procedures/libc/toupper.py +10 -0
- angr/procedures/libc/ungetc.py +20 -0
- angr/procedures/libc/vsnprintf.py +17 -0
- angr/procedures/libc/wchar.py +16 -0
- angr/procedures/libstdcpp/__init__.py +0 -0
- angr/procedures/libstdcpp/_unwind_resume.py +11 -0
- angr/procedures/libstdcpp/std____throw_bad_alloc.py +13 -0
- angr/procedures/libstdcpp/std____throw_bad_cast.py +13 -0
- angr/procedures/libstdcpp/std____throw_length_error.py +13 -0
- angr/procedures/libstdcpp/std____throw_logic_error.py +13 -0
- angr/procedures/libstdcpp/std__terminate.py +13 -0
- angr/procedures/linux_kernel/__init__.py +3 -0
- angr/procedures/linux_kernel/access.py +18 -0
- angr/procedures/linux_kernel/arch_prctl.py +34 -0
- angr/procedures/linux_kernel/arm_user_helpers.py +59 -0
- angr/procedures/linux_kernel/brk.py +18 -0
- angr/procedures/linux_kernel/cwd.py +28 -0
- angr/procedures/linux_kernel/fstat.py +138 -0
- angr/procedures/linux_kernel/fstat64.py +170 -0
- angr/procedures/linux_kernel/futex.py +17 -0
- angr/procedures/linux_kernel/getegid.py +17 -0
- angr/procedures/linux_kernel/geteuid.py +17 -0
- angr/procedures/linux_kernel/getgid.py +17 -0
- angr/procedures/linux_kernel/getpid.py +14 -0
- angr/procedures/linux_kernel/getrlimit.py +24 -0
- angr/procedures/linux_kernel/gettid.py +9 -0
- angr/procedures/linux_kernel/getuid.py +17 -0
- angr/procedures/linux_kernel/iovec.py +47 -0
- angr/procedures/linux_kernel/lseek.py +42 -0
- angr/procedures/linux_kernel/mmap.py +16 -0
- angr/procedures/linux_kernel/mprotect.py +42 -0
- angr/procedures/linux_kernel/munmap.py +8 -0
- angr/procedures/linux_kernel/openat.py +26 -0
- angr/procedures/linux_kernel/set_tid_address.py +8 -0
- angr/procedures/linux_kernel/sigaction.py +19 -0
- angr/procedures/linux_kernel/sigprocmask.py +23 -0
- angr/procedures/linux_kernel/stat.py +23 -0
- angr/procedures/linux_kernel/sysinfo.py +59 -0
- angr/procedures/linux_kernel/tgkill.py +10 -0
- angr/procedures/linux_kernel/time.py +34 -0
- angr/procedures/linux_kernel/uid.py +30 -0
- angr/procedures/linux_kernel/uname.py +29 -0
- angr/procedures/linux_kernel/unlink.py +22 -0
- angr/procedures/linux_kernel/vsyscall.py +16 -0
- angr/procedures/linux_loader/__init__.py +3 -0
- angr/procedures/linux_loader/_dl_initial_error_catch_tsd.py +7 -0
- angr/procedures/linux_loader/_dl_rtld_lock.py +15 -0
- angr/procedures/linux_loader/sim_loader.py +54 -0
- angr/procedures/linux_loader/tls.py +40 -0
- angr/procedures/msvcr/__getmainargs.py +16 -0
- angr/procedures/msvcr/__init__.py +4 -0
- angr/procedures/msvcr/_initterm.py +38 -0
- angr/procedures/msvcr/fmode.py +31 -0
- angr/procedures/ntdll/__init__.py +0 -0
- angr/procedures/ntdll/exceptions.py +60 -0
- angr/procedures/posix/__init__.py +3 -0
- angr/procedures/posix/accept.py +29 -0
- angr/procedures/posix/bind.py +13 -0
- angr/procedures/posix/bzero.py +9 -0
- angr/procedures/posix/chroot.py +27 -0
- angr/procedures/posix/close.py +9 -0
- angr/procedures/posix/closedir.py +7 -0
- angr/procedures/posix/dup.py +56 -0
- angr/procedures/posix/fcntl.py +10 -0
- angr/procedures/posix/fdopen.py +76 -0
- angr/procedures/posix/fileno.py +18 -0
- angr/procedures/posix/fork.py +13 -0
- angr/procedures/posix/getenv.py +35 -0
- angr/procedures/posix/gethostbyname.py +43 -0
- angr/procedures/posix/getpass.py +19 -0
- angr/procedures/posix/getsockopt.py +11 -0
- angr/procedures/posix/htonl.py +11 -0
- angr/procedures/posix/htons.py +11 -0
- angr/procedures/posix/inet_ntoa.py +59 -0
- angr/procedures/posix/listen.py +13 -0
- angr/procedures/posix/mmap.py +144 -0
- angr/procedures/posix/open.py +18 -0
- angr/procedures/posix/opendir.py +10 -0
- angr/procedures/posix/poll.py +55 -0
- angr/procedures/posix/pread64.py +46 -0
- angr/procedures/posix/pthread.py +87 -0
- angr/procedures/posix/pwrite64.py +46 -0
- angr/procedures/posix/read.py +13 -0
- angr/procedures/posix/readdir.py +62 -0
- angr/procedures/posix/recv.py +13 -0
- angr/procedures/posix/recvfrom.py +13 -0
- angr/procedures/posix/select.py +48 -0
- angr/procedures/posix/send.py +23 -0
- angr/procedures/posix/setsockopt.py +9 -0
- angr/procedures/posix/sigaction.py +23 -0
- angr/procedures/posix/sim_time.py +48 -0
- angr/procedures/posix/sleep.py +8 -0
- angr/procedures/posix/socket.py +18 -0
- angr/procedures/posix/strcasecmp.py +26 -0
- angr/procedures/posix/strdup.py +18 -0
- angr/procedures/posix/strtok_r.py +64 -0
- angr/procedures/posix/syslog.py +15 -0
- angr/procedures/posix/tz.py +9 -0
- angr/procedures/posix/unlink.py +11 -0
- angr/procedures/posix/usleep.py +8 -0
- angr/procedures/posix/write.py +13 -0
- angr/procedures/procedure_dict.py +50 -0
- angr/procedures/stubs/CallReturn.py +13 -0
- angr/procedures/stubs/NoReturnUnconstrained.py +13 -0
- angr/procedures/stubs/Nop.py +7 -0
- angr/procedures/stubs/PathTerminator.py +9 -0
- angr/procedures/stubs/Redirect.py +18 -0
- angr/procedures/stubs/ReturnChar.py +11 -0
- angr/procedures/stubs/ReturnUnconstrained.py +24 -0
- angr/procedures/stubs/UnresolvableCallTarget.py +9 -0
- angr/procedures/stubs/UnresolvableJumpTarget.py +9 -0
- angr/procedures/stubs/UserHook.py +18 -0
- angr/procedures/stubs/__init__.py +3 -0
- angr/procedures/stubs/b64_decode.py +15 -0
- angr/procedures/stubs/caller.py +14 -0
- angr/procedures/stubs/crazy_scanf.py +20 -0
- angr/procedures/stubs/format_parser.py +669 -0
- angr/procedures/stubs/syscall_stub.py +24 -0
- angr/procedures/testing/__init__.py +3 -0
- angr/procedures/testing/manyargs.py +9 -0
- angr/procedures/testing/retreg.py +8 -0
- angr/procedures/tracer/__init__.py +4 -0
- angr/procedures/tracer/random.py +9 -0
- angr/procedures/tracer/receive.py +23 -0
- angr/procedures/tracer/transmit.py +26 -0
- angr/procedures/uclibc/__init__.py +3 -0
- angr/procedures/uclibc/__uClibc_main.py +10 -0
- angr/procedures/win32/EncodePointer.py +7 -0
- angr/procedures/win32/ExitProcess.py +9 -0
- angr/procedures/win32/GetCommandLine.py +12 -0
- angr/procedures/win32/GetCurrentProcessId.py +7 -0
- angr/procedures/win32/GetCurrentThreadId.py +7 -0
- angr/procedures/win32/GetLastInputInfo.py +40 -0
- angr/procedures/win32/GetModuleHandle.py +29 -0
- angr/procedures/win32/GetProcessAffinityMask.py +37 -0
- angr/procedures/win32/InterlockedExchange.py +15 -0
- angr/procedures/win32/IsProcessorFeaturePresent.py +7 -0
- angr/procedures/win32/VirtualAlloc.py +114 -0
- angr/procedures/win32/VirtualProtect.py +60 -0
- angr/procedures/win32/__init__.py +3 -0
- angr/procedures/win32/critical_section.py +12 -0
- angr/procedures/win32/dynamic_loading.py +104 -0
- angr/procedures/win32/file_handles.py +47 -0
- angr/procedures/win32/gethostbyname.py +12 -0
- angr/procedures/win32/heap.py +45 -0
- angr/procedures/win32/is_bad_ptr.py +26 -0
- angr/procedures/win32/local_storage.py +88 -0
- angr/procedures/win32/mutex.py +11 -0
- angr/procedures/win32/sim_time.py +135 -0
- angr/procedures/win32/system_paths.py +35 -0
- angr/procedures/win32_kernel/ExAllocatePool.py +13 -0
- angr/procedures/win32_kernel/ExFreePoolWithTag.py +8 -0
- angr/procedures/win32_kernel/__fastfail.py +15 -0
- angr/procedures/win32_kernel/__init__.py +3 -0
- angr/procedures/win_user32/__init__.py +0 -0
- angr/procedures/win_user32/chars.py +15 -0
- angr/procedures/win_user32/keyboard.py +14 -0
- angr/procedures/win_user32/messagebox.py +49 -0
- angr/project.py +860 -0
- angr/protos/__init__.py +19 -0
- angr/protos/cfg_pb2.py +42 -0
- angr/protos/function_pb2.py +38 -0
- angr/protos/primitives_pb2.py +59 -0
- angr/protos/variables_pb2.py +55 -0
- angr/protos/xrefs_pb2.py +36 -0
- angr/py.typed +1 -0
- angr/rustylib.cpython-311-darwin.so +0 -0
- angr/serializable.py +66 -0
- angr/sim_manager.py +971 -0
- angr/sim_options.py +436 -0
- angr/sim_procedure.py +626 -0
- angr/sim_state.py +926 -0
- angr/sim_state_options.py +403 -0
- angr/sim_type.py +4026 -0
- angr/sim_variable.py +470 -0
- angr/simos/__init__.py +47 -0
- angr/simos/cgc.py +153 -0
- angr/simos/javavm.py +458 -0
- angr/simos/linux.py +509 -0
- angr/simos/simos.py +444 -0
- angr/simos/snimmuc_nxp.py +149 -0
- angr/simos/userland.py +163 -0
- angr/simos/windows.py +615 -0
- angr/simos/xbox.py +32 -0
- angr/slicer.py +352 -0
- angr/state_hierarchy.py +262 -0
- angr/state_plugins/__init__.py +84 -0
- angr/state_plugins/callstack.py +478 -0
- angr/state_plugins/cgc.py +155 -0
- angr/state_plugins/debug_variables.py +192 -0
- angr/state_plugins/filesystem.py +463 -0
- angr/state_plugins/gdb.py +148 -0
- angr/state_plugins/globals.py +65 -0
- angr/state_plugins/heap/__init__.py +15 -0
- angr/state_plugins/heap/heap_base.py +128 -0
- angr/state_plugins/heap/heap_brk.py +136 -0
- angr/state_plugins/heap/heap_freelist.py +213 -0
- angr/state_plugins/heap/heap_libc.py +46 -0
- angr/state_plugins/heap/heap_ptmalloc.py +620 -0
- angr/state_plugins/heap/utils.py +22 -0
- angr/state_plugins/history.py +564 -0
- angr/state_plugins/inspect.py +375 -0
- angr/state_plugins/javavm_classloader.py +134 -0
- angr/state_plugins/jni_references.py +95 -0
- angr/state_plugins/libc.py +1263 -0
- angr/state_plugins/light_registers.py +168 -0
- angr/state_plugins/log.py +84 -0
- angr/state_plugins/loop_data.py +92 -0
- angr/state_plugins/plugin.py +176 -0
- angr/state_plugins/posix.py +703 -0
- angr/state_plugins/preconstrainer.py +196 -0
- angr/state_plugins/scratch.py +173 -0
- angr/state_plugins/sim_action.py +326 -0
- angr/state_plugins/sim_action_object.py +271 -0
- angr/state_plugins/sim_event.py +59 -0
- angr/state_plugins/solver.py +1128 -0
- angr/state_plugins/symbolizer.py +291 -0
- angr/state_plugins/trace_additions.py +738 -0
- angr/state_plugins/uc_manager.py +94 -0
- angr/state_plugins/unicorn_engine.py +1920 -0
- angr/state_plugins/view.py +340 -0
- angr/storage/__init__.py +15 -0
- angr/storage/file.py +1210 -0
- angr/storage/memory_mixins/__init__.py +317 -0
- angr/storage/memory_mixins/actions_mixin.py +72 -0
- angr/storage/memory_mixins/address_concretization_mixin.py +384 -0
- angr/storage/memory_mixins/bvv_conversion_mixin.py +73 -0
- angr/storage/memory_mixins/clouseau_mixin.py +137 -0
- angr/storage/memory_mixins/conditional_store_mixin.py +25 -0
- angr/storage/memory_mixins/convenient_mappings_mixin.py +256 -0
- angr/storage/memory_mixins/default_filler_mixin.py +144 -0
- angr/storage/memory_mixins/dirty_addrs_mixin.py +11 -0
- angr/storage/memory_mixins/hex_dumper_mixin.py +82 -0
- angr/storage/memory_mixins/javavm_memory_mixin.py +392 -0
- angr/storage/memory_mixins/keyvalue_memory_mixin.py +43 -0
- angr/storage/memory_mixins/label_merger_mixin.py +31 -0
- angr/storage/memory_mixins/memory_mixin.py +175 -0
- angr/storage/memory_mixins/multi_value_merger_mixin.py +79 -0
- angr/storage/memory_mixins/name_resolution_mixin.py +67 -0
- angr/storage/memory_mixins/paged_memory/__init__.py +0 -0
- angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +266 -0
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +743 -0
- angr/storage/memory_mixins/paged_memory/paged_memory_multivalue_mixin.py +65 -0
- angr/storage/memory_mixins/paged_memory/pages/__init__.py +26 -0
- angr/storage/memory_mixins/paged_memory/pages/base.py +31 -0
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +341 -0
- angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +92 -0
- angr/storage/memory_mixins/paged_memory/pages/ispo_mixin.py +55 -0
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +338 -0
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +324 -0
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +419 -0
- angr/storage/memory_mixins/paged_memory/pages/permissions_mixin.py +36 -0
- angr/storage/memory_mixins/paged_memory/pages/refcount_mixin.py +52 -0
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +529 -0
- angr/storage/memory_mixins/paged_memory/privileged_mixin.py +36 -0
- angr/storage/memory_mixins/paged_memory/stack_allocation_mixin.py +74 -0
- angr/storage/memory_mixins/regioned_memory/__init__.py +17 -0
- angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +36 -0
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +31 -0
- angr/storage/memory_mixins/regioned_memory/region_category_mixin.py +9 -0
- angr/storage/memory_mixins/regioned_memory/region_data.py +246 -0
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +241 -0
- angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +119 -0
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +442 -0
- angr/storage/memory_mixins/regioned_memory/static_find_mixin.py +69 -0
- angr/storage/memory_mixins/simple_interface_mixin.py +71 -0
- angr/storage/memory_mixins/simplification_mixin.py +15 -0
- angr/storage/memory_mixins/size_resolution_mixin.py +143 -0
- angr/storage/memory_mixins/slotted_memory.py +140 -0
- angr/storage/memory_mixins/smart_find_mixin.py +161 -0
- angr/storage/memory_mixins/symbolic_merger_mixin.py +16 -0
- angr/storage/memory_mixins/top_merger_mixin.py +25 -0
- angr/storage/memory_mixins/underconstrained_mixin.py +67 -0
- angr/storage/memory_mixins/unwrapper_mixin.py +26 -0
- angr/storage/memory_object.py +195 -0
- angr/tablespecs.py +91 -0
- angr/unicornlib.dylib +0 -0
- angr/utils/__init__.py +46 -0
- angr/utils/ail.py +176 -0
- angr/utils/algo.py +34 -0
- angr/utils/balancer.py +776 -0
- angr/utils/bits.py +46 -0
- angr/utils/constants.py +9 -0
- angr/utils/cowdict.py +63 -0
- angr/utils/cpp.py +17 -0
- angr/utils/doms.py +150 -0
- angr/utils/dynamic_dictlist.py +89 -0
- angr/utils/endness.py +18 -0
- angr/utils/enums_conv.py +97 -0
- angr/utils/env.py +12 -0
- angr/utils/formatting.py +128 -0
- angr/utils/funcid.py +244 -0
- angr/utils/graph.py +981 -0
- angr/utils/lazy_import.py +13 -0
- angr/utils/library.py +236 -0
- angr/utils/loader.py +55 -0
- angr/utils/mp.py +66 -0
- angr/utils/orderedset.py +74 -0
- angr/utils/ssa/__init__.py +455 -0
- angr/utils/ssa/tmp_uses_collector.py +23 -0
- angr/utils/ssa/vvar_uses_collector.py +36 -0
- angr/utils/strings.py +20 -0
- angr/utils/tagged_interval_map.py +112 -0
- angr/utils/timing.py +74 -0
- angr/utils/types.py +193 -0
- angr/utils/vex.py +11 -0
- angr/vaults.py +367 -0
- angr-9.2.192.dist-info/METADATA +112 -0
- angr-9.2.192.dist-info/RECORD +1442 -0
- angr-9.2.192.dist-info/WHEEL +6 -0
- angr-9.2.192.dist-info/entry_points.txt +2 -0
- angr-9.2.192.dist-info/licenses/LICENSE +27 -0
- angr-9.2.192.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1043 @@
|
|
|
1
|
+
# pylint:disable=arguments-renamed,global-statement
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import copy
|
|
4
|
+
import os
|
|
5
|
+
import logging
|
|
6
|
+
import json
|
|
7
|
+
import inspect
|
|
8
|
+
from collections import defaultdict
|
|
9
|
+
from typing import Any, TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
import msgspec
|
|
12
|
+
import pydemumble
|
|
13
|
+
import archinfo
|
|
14
|
+
|
|
15
|
+
from angr.errors import AngrMissingTypeError
|
|
16
|
+
from angr.sim_type import parse_cpp_file, parse_file, SimTypeFunction, SimTypeBottom, SimType
|
|
17
|
+
from angr.calling_conventions import DEFAULT_CC, CC_NAMES
|
|
18
|
+
from angr.misc import autoimport
|
|
19
|
+
from angr.misc.ux import once
|
|
20
|
+
from angr.procedures.stubs.ReturnUnconstrained import ReturnUnconstrained
|
|
21
|
+
from angr.procedures.stubs.syscall_stub import syscall as stub_syscall
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from angr.calling_conventions import SimCCSyscall
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
l = logging.getLogger(name=__name__)
|
|
28
|
+
SIM_LIBRARIES: dict[str, list[SimLibrary]] = {}
|
|
29
|
+
SIM_TYPE_COLLECTIONS: dict[str, SimTypeCollection] = {}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class SimTypeCollection:
|
|
33
|
+
"""
|
|
34
|
+
A type collection is the mechanism for describing types. Types in a type collection can be referenced using
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self):
|
|
38
|
+
self.names: list[str] | None = None
|
|
39
|
+
self.types: dict[str, SimType] = {}
|
|
40
|
+
self.types_json: dict[str, Any] = {}
|
|
41
|
+
|
|
42
|
+
def __contains__(self, name: str) -> bool:
|
|
43
|
+
return name in self.types or name in self.types_json
|
|
44
|
+
|
|
45
|
+
def set_names(self, *names: str):
|
|
46
|
+
self.names = list(names)
|
|
47
|
+
for name in names:
|
|
48
|
+
SIM_TYPE_COLLECTIONS[name] = self
|
|
49
|
+
|
|
50
|
+
def add(self, name: str, t: SimType) -> None:
|
|
51
|
+
"""
|
|
52
|
+
Add a type to the collection.
|
|
53
|
+
|
|
54
|
+
:param name: Name of the type to add.
|
|
55
|
+
:param t: The SimType object to add to the collection.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
self.types[name] = t
|
|
59
|
+
|
|
60
|
+
def get(self, name: str, bottom_on_missing: bool = False) -> SimType:
|
|
61
|
+
"""
|
|
62
|
+
Get a SimType object from the collection as identified by the name.
|
|
63
|
+
|
|
64
|
+
:param name: Name of the type to get.
|
|
65
|
+
:param bottom_on_missing: Return a SimTypeBottom object if the required type does not exist.
|
|
66
|
+
:return: The SimType object.
|
|
67
|
+
"""
|
|
68
|
+
if bottom_on_missing and name not in self:
|
|
69
|
+
return SimTypeBottom(label=name)
|
|
70
|
+
if name not in self:
|
|
71
|
+
raise AngrMissingTypeError(name)
|
|
72
|
+
if name not in self.types and name in self.types_json:
|
|
73
|
+
d = self.types_json[name]
|
|
74
|
+
if isinstance(d, str):
|
|
75
|
+
d = msgspec.json.decode(d.replace("'", '"').encode("utf-8"))
|
|
76
|
+
try:
|
|
77
|
+
t = SimType.from_json(d)
|
|
78
|
+
except (TypeError, ValueError) as ex:
|
|
79
|
+
l.warning("Failed to load type %s from JSON", name, exc_info=True)
|
|
80
|
+
# the type is missing
|
|
81
|
+
if bottom_on_missing:
|
|
82
|
+
return SimTypeBottom(label=name)
|
|
83
|
+
raise AngrMissingTypeError(name) from ex
|
|
84
|
+
self.types[name] = t
|
|
85
|
+
return self.types[name]
|
|
86
|
+
|
|
87
|
+
def init_str(self) -> str:
|
|
88
|
+
lines = [
|
|
89
|
+
"typelib = SimTypeCollection()",
|
|
90
|
+
"" if not self.names else f"typelib.set_names(*{self.names})",
|
|
91
|
+
"typelib.types = {",
|
|
92
|
+
]
|
|
93
|
+
for name in sorted(self.types):
|
|
94
|
+
t = self.types[name]
|
|
95
|
+
lines.append(f' "{name}": {t._init_str()},')
|
|
96
|
+
lines.append("}")
|
|
97
|
+
|
|
98
|
+
return "\n".join(lines)
|
|
99
|
+
|
|
100
|
+
def to_json(self, types_as_string: bool = False) -> dict[str, Any]:
|
|
101
|
+
d = {"_t": "types", "names": [*self.names] if self.names else [], "types": {}}
|
|
102
|
+
for name in sorted(self.types):
|
|
103
|
+
t = self.types[name]
|
|
104
|
+
d["types"][name] = json.dumps(t.to_json()).replace('"', "'") if types_as_string else t.to_json()
|
|
105
|
+
return d
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def from_json(cls, d: dict[str, Any]) -> SimTypeCollection:
|
|
109
|
+
typelib = SimTypeCollection()
|
|
110
|
+
if d.get("_t", "") != "types":
|
|
111
|
+
raise TypeError("Not a SimTypeCollection JSON object")
|
|
112
|
+
if "names" in d:
|
|
113
|
+
typelib.set_names(*d["names"])
|
|
114
|
+
if "types" in d:
|
|
115
|
+
for name, t_value in d["types"].items():
|
|
116
|
+
typelib.types_json[name] = t_value
|
|
117
|
+
return typelib
|
|
118
|
+
|
|
119
|
+
def __repr__(self):
|
|
120
|
+
keys = set(self.types) | set(self.types_json)
|
|
121
|
+
return f"<SimTypeCollection with {len(keys)} types>"
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
_ARCH_NAME_CACHE: dict[str, str] = {}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class SimLibrary:
|
|
128
|
+
"""
|
|
129
|
+
A SimLibrary is the mechanism for describing a dynamic library's API, its functions and metadata.
|
|
130
|
+
|
|
131
|
+
Any instance of this class (or its subclasses) found in the ``angr.procedures.definitions`` package will be
|
|
132
|
+
automatically picked up and added to ``angr.SIM_LIBRARIES`` via all its names.
|
|
133
|
+
|
|
134
|
+
:ivar fallback_cc: A mapping from architecture to the default calling convention that should be used if no
|
|
135
|
+
other information is present. Contains some sane defaults for linux.
|
|
136
|
+
:ivar fallback_proc: A SimProcedure class that should be used to provide stub procedures. By default,
|
|
137
|
+
``ReturnUnconstrained``.
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
def __init__(self):
|
|
141
|
+
self.type_collection_names: list[str] = []
|
|
142
|
+
self.procedures = {}
|
|
143
|
+
self.non_returning = set()
|
|
144
|
+
self.prototypes: dict[str, SimTypeFunction] = {}
|
|
145
|
+
self.prototypes_json: dict[str, Any] = {}
|
|
146
|
+
self.default_ccs = {}
|
|
147
|
+
self.names = []
|
|
148
|
+
self.fallback_cc = dict(DEFAULT_CC)
|
|
149
|
+
self.fallback_proc = ReturnUnconstrained
|
|
150
|
+
|
|
151
|
+
@staticmethod
|
|
152
|
+
def from_json(d: dict[str, Any]) -> SimLibrary:
|
|
153
|
+
lib = SimLibrary()
|
|
154
|
+
if d.get("_t", "") != "lib":
|
|
155
|
+
raise TypeError("Not a SimLibrary JSON object")
|
|
156
|
+
if "type_collection_names" in d:
|
|
157
|
+
lib.type_collection_names = d["type_collection_names"]
|
|
158
|
+
if "default_cc" in d:
|
|
159
|
+
if not isinstance(d["default_cc"], dict):
|
|
160
|
+
raise TypeError("default_cc must be a dict")
|
|
161
|
+
for arch_name, cc_name in d["default_cc"].items():
|
|
162
|
+
cc = CC_NAMES[cc_name]
|
|
163
|
+
lib.set_default_cc(arch_name, cc)
|
|
164
|
+
if "library_names" in d:
|
|
165
|
+
lib.set_library_names(*d["library_names"])
|
|
166
|
+
else:
|
|
167
|
+
raise KeyError("library_names is required")
|
|
168
|
+
if "non_returning" in d:
|
|
169
|
+
lib.set_non_returning(*d["non_returning"])
|
|
170
|
+
if "functions" in d:
|
|
171
|
+
lib.prototypes_json = {k: v["proto"] for k, v in d["functions"].items() if "proto" in v}
|
|
172
|
+
return lib
|
|
173
|
+
|
|
174
|
+
def copy(self):
|
|
175
|
+
"""
|
|
176
|
+
Make a copy of this SimLibrary, allowing it to be mutated without affecting the global version.
|
|
177
|
+
|
|
178
|
+
:return: A new SimLibrary object with the same library references but different dict/list references
|
|
179
|
+
"""
|
|
180
|
+
o = SimLibrary()
|
|
181
|
+
o.procedures = dict(self.procedures)
|
|
182
|
+
o.non_returning = set(self.non_returning)
|
|
183
|
+
o.prototypes = dict(self.prototypes)
|
|
184
|
+
o.prototypes_json = self.prototypes_json
|
|
185
|
+
o.default_ccs = dict(self.default_ccs)
|
|
186
|
+
o.names = list(self.names)
|
|
187
|
+
return o
|
|
188
|
+
|
|
189
|
+
def update(self, other: SimLibrary):
|
|
190
|
+
"""
|
|
191
|
+
Augment this SimLibrary with the information from another SimLibrary
|
|
192
|
+
|
|
193
|
+
:param other: The other SimLibrary
|
|
194
|
+
"""
|
|
195
|
+
self.procedures.update(other.procedures)
|
|
196
|
+
self.non_returning.update(other.non_returning)
|
|
197
|
+
self.prototypes.update(other.prototypes)
|
|
198
|
+
self.default_ccs.update(other.default_ccs)
|
|
199
|
+
|
|
200
|
+
@property
|
|
201
|
+
def name(self):
|
|
202
|
+
"""
|
|
203
|
+
The first common name of this library, e.g. libc.so.6, or '??????' if none are known.
|
|
204
|
+
"""
|
|
205
|
+
return self.names[0] if self.names else "??????"
|
|
206
|
+
|
|
207
|
+
def set_library_names(self, *names):
|
|
208
|
+
"""
|
|
209
|
+
Set some common names of this library by which it may be referred during linking
|
|
210
|
+
|
|
211
|
+
:param names: Any number of string library names may be passed as varargs.
|
|
212
|
+
"""
|
|
213
|
+
for name in names:
|
|
214
|
+
self.names.append(name)
|
|
215
|
+
if name in SIM_LIBRARIES:
|
|
216
|
+
SIM_LIBRARIES[name].append(self)
|
|
217
|
+
else:
|
|
218
|
+
SIM_LIBRARIES[name] = [self]
|
|
219
|
+
|
|
220
|
+
def set_default_cc(self, arch_name, cc_cls):
|
|
221
|
+
"""
|
|
222
|
+
Set the default calling convention used for this library under a given architecture
|
|
223
|
+
|
|
224
|
+
:param arch_name: The string name of the architecture, i.e. the ``.name`` field from archinfo.
|
|
225
|
+
:parm cc_cls: The SimCC class (not an instance!) to use
|
|
226
|
+
"""
|
|
227
|
+
if arch_name not in _ARCH_NAME_CACHE:
|
|
228
|
+
_ARCH_NAME_CACHE[arch_name] = archinfo.arch_from_id(arch_name).name
|
|
229
|
+
arch_name = _ARCH_NAME_CACHE[arch_name]
|
|
230
|
+
self.default_ccs[arch_name] = cc_cls
|
|
231
|
+
|
|
232
|
+
def set_non_returning(self, *names):
|
|
233
|
+
"""
|
|
234
|
+
Mark some functions in this class as never returning, i.e. loops forever or terminates execution
|
|
235
|
+
|
|
236
|
+
:param names: Any number of string function names may be passed as varargs
|
|
237
|
+
"""
|
|
238
|
+
for name in names:
|
|
239
|
+
self.non_returning.add(name)
|
|
240
|
+
|
|
241
|
+
def set_prototype(self, name, proto: SimTypeFunction) -> None:
|
|
242
|
+
"""
|
|
243
|
+
Set the prototype of a function in the form of a SimTypeFunction containing argument and return types
|
|
244
|
+
|
|
245
|
+
:param name: The name of the function as a string
|
|
246
|
+
:param proto: The prototype of the function as a SimTypeFunction
|
|
247
|
+
"""
|
|
248
|
+
self.prototypes[name] = proto
|
|
249
|
+
|
|
250
|
+
def set_prototypes(self, protos: dict[str, SimTypeFunction]) -> None:
|
|
251
|
+
"""
|
|
252
|
+
Set the prototypes of many functions
|
|
253
|
+
|
|
254
|
+
:param protos: Dictionary mapping function names to SimTypeFunction objects
|
|
255
|
+
"""
|
|
256
|
+
self.prototypes.update(protos)
|
|
257
|
+
|
|
258
|
+
def set_c_prototype(self, c_decl: str) -> tuple[str, SimTypeFunction]:
|
|
259
|
+
"""
|
|
260
|
+
Set the prototype of a function in the form of a C-style function declaration.
|
|
261
|
+
|
|
262
|
+
:param str c_decl: The C-style declaration of the function.
|
|
263
|
+
:return: A tuple of (function name, function prototype)
|
|
264
|
+
"""
|
|
265
|
+
|
|
266
|
+
parsed = parse_file(c_decl)
|
|
267
|
+
parsed_decl = parsed[0]
|
|
268
|
+
if not parsed_decl:
|
|
269
|
+
raise ValueError("Cannot parse the function prototype.")
|
|
270
|
+
func_name, func_proto = next(iter(parsed_decl.items()))
|
|
271
|
+
|
|
272
|
+
self.set_prototype(func_name, func_proto)
|
|
273
|
+
|
|
274
|
+
return func_name, func_proto
|
|
275
|
+
|
|
276
|
+
def add(self, name, proc_cls, **kwargs):
|
|
277
|
+
"""
|
|
278
|
+
Add a function implementation to the library.
|
|
279
|
+
|
|
280
|
+
:param name: The name of the function as a string
|
|
281
|
+
:param proc_cls: The implementation of the function as a SimProcedure _class_, not instance
|
|
282
|
+
:param kwargs: Any additional parameters to the procedure class constructor may be passed as kwargs
|
|
283
|
+
"""
|
|
284
|
+
self.procedures[name] = proc_cls(display_name=name, **kwargs)
|
|
285
|
+
|
|
286
|
+
def add_all_from_dict(self, dictionary, **kwargs):
|
|
287
|
+
"""
|
|
288
|
+
Batch-add function implementations to the library.
|
|
289
|
+
|
|
290
|
+
:param dictionary: A mapping from name to procedure class, i.e. the first two arguments to add()
|
|
291
|
+
:param kwargs: Any additional kwargs will be passed to the constructors of _each_ procedure class
|
|
292
|
+
"""
|
|
293
|
+
for name, procedure in dictionary.items():
|
|
294
|
+
self.add(name, procedure, **kwargs)
|
|
295
|
+
|
|
296
|
+
def add_alias(self, name, *alt_names):
|
|
297
|
+
"""
|
|
298
|
+
Add some duplicate names for a given function. The original function's implementation must already be
|
|
299
|
+
registered.
|
|
300
|
+
|
|
301
|
+
:param name: The name of the function for which an implementation is already present
|
|
302
|
+
:param alt_names: Any number of alternate names may be passed as varargs
|
|
303
|
+
"""
|
|
304
|
+
old_procedure = self.procedures[name]
|
|
305
|
+
for alt in alt_names:
|
|
306
|
+
new_procedure = copy.deepcopy(old_procedure)
|
|
307
|
+
new_procedure.display_name = alt
|
|
308
|
+
self.procedures[alt] = new_procedure
|
|
309
|
+
if self.has_prototype(name):
|
|
310
|
+
self.prototypes[alt] = self.get_prototype(name) # type:ignore
|
|
311
|
+
if name in self.non_returning:
|
|
312
|
+
self.non_returning.add(alt)
|
|
313
|
+
|
|
314
|
+
def _apply_metadata(self, proc, arch):
|
|
315
|
+
if proc.cc is None and arch.name in self.default_ccs:
|
|
316
|
+
proc.cc = self.default_ccs[arch.name](arch)
|
|
317
|
+
if proc.cc is None and arch.name in self.fallback_cc:
|
|
318
|
+
proc.cc = self.fallback_cc[arch.name]["Linux"](arch)
|
|
319
|
+
if self.has_prototype(proc.display_name):
|
|
320
|
+
proc.prototype = self.get_prototype(proc.display_name, deref=True).with_arch(arch) # type:ignore
|
|
321
|
+
proc.guessed_prototype = False
|
|
322
|
+
if proc.prototype.arg_names is None:
|
|
323
|
+
# Use inspect to extract the parameters from the run python function
|
|
324
|
+
proc.prototype.arg_names = tuple(inspect.getfullargspec(proc.run).args[1:])
|
|
325
|
+
if not proc.ARGS_MISMATCH:
|
|
326
|
+
proc.num_args = len(proc.prototype.args)
|
|
327
|
+
if proc.display_name in self.non_returning:
|
|
328
|
+
proc.returns = False
|
|
329
|
+
proc.library_name = self.name
|
|
330
|
+
|
|
331
|
+
def get(self, name, arch):
|
|
332
|
+
"""
|
|
333
|
+
Get an implementation of the given function specialized for the given arch, or a stub procedure if none exists.
|
|
334
|
+
|
|
335
|
+
:param name: The name of the function as a string
|
|
336
|
+
:param arch: The architecure to use, as either a string or an archinfo.Arch instance
|
|
337
|
+
:return: A SimProcedure instance representing the function as found in the library
|
|
338
|
+
"""
|
|
339
|
+
if type(arch) is str:
|
|
340
|
+
arch = archinfo.arch_from_id(arch)
|
|
341
|
+
if name in self.procedures:
|
|
342
|
+
proc = copy.deepcopy(self.procedures[name])
|
|
343
|
+
self._apply_metadata(proc, arch)
|
|
344
|
+
return proc
|
|
345
|
+
return self.get_stub(name, arch)
|
|
346
|
+
|
|
347
|
+
def get_stub(self, name, arch):
|
|
348
|
+
"""
|
|
349
|
+
Get a stub procedure for the given function, regardless of if a real implementation is available. This will
|
|
350
|
+
apply any metadata, such as a default calling convention or a function prototype.
|
|
351
|
+
|
|
352
|
+
By stub, we pretty much always mean a ``ReturnUnconstrained`` SimProcedure with the appropriate display name
|
|
353
|
+
and metadata set. This will appear in ``state.history.descriptions`` as ``<SimProcedure display_name (stub)>``
|
|
354
|
+
|
|
355
|
+
:param name: The name of the function as a string
|
|
356
|
+
:param arch: The architecture to use, as either a string or an archinfo.Arch instance
|
|
357
|
+
:return: A SimProcedure instance representing a plausable stub as could be found in the library.
|
|
358
|
+
"""
|
|
359
|
+
proc = self.fallback_proc(display_name=name, is_stub=True)
|
|
360
|
+
self._apply_metadata(proc, arch)
|
|
361
|
+
return proc
|
|
362
|
+
|
|
363
|
+
def get_prototype(self, name: str, arch=None, deref: bool = False) -> SimTypeFunction | None:
|
|
364
|
+
"""
|
|
365
|
+
Get a prototype of the given function name, optionally specialize the prototype to a given architecture.
|
|
366
|
+
|
|
367
|
+
:param name: Name of the function.
|
|
368
|
+
:param arch: The architecture to specialize to.
|
|
369
|
+
:param deref: True if any SimTypeRefs in the prototype should be dereferenced using library information.
|
|
370
|
+
:return: Prototype of the function, or None if the prototype does not exist.
|
|
371
|
+
"""
|
|
372
|
+
if name not in self.prototypes and name in self.prototypes_json:
|
|
373
|
+
d = self.prototypes_json[name]
|
|
374
|
+
if isinstance(d, str):
|
|
375
|
+
d = msgspec.json.decode(d.replace("'", '"').encode("utf-8"))
|
|
376
|
+
if not isinstance(d, dict):
|
|
377
|
+
l.warning("Failed to load prototype %s from JSON", name)
|
|
378
|
+
proto = None
|
|
379
|
+
else:
|
|
380
|
+
try:
|
|
381
|
+
proto = SimTypeFunction.from_json(d)
|
|
382
|
+
except (TypeError, ValueError):
|
|
383
|
+
l.warning("Failed to load prototype %s from JSON", name, exc_info=True)
|
|
384
|
+
proto = None
|
|
385
|
+
if proto is not None:
|
|
386
|
+
assert isinstance(proto, SimTypeFunction)
|
|
387
|
+
self.prototypes[name] = proto
|
|
388
|
+
else:
|
|
389
|
+
proto = self.prototypes.get(name, None)
|
|
390
|
+
if proto is None:
|
|
391
|
+
return None
|
|
392
|
+
if deref:
|
|
393
|
+
from angr.utils.types import dereference_simtype_by_lib # pylint:disable=import-outside-toplevel
|
|
394
|
+
|
|
395
|
+
proto = dereference_simtype_by_lib(proto, self.name)
|
|
396
|
+
assert isinstance(proto, SimTypeFunction)
|
|
397
|
+
if arch is not None:
|
|
398
|
+
return proto.with_arch(arch)
|
|
399
|
+
return proto
|
|
400
|
+
|
|
401
|
+
def has_metadata(self, name):
|
|
402
|
+
"""
|
|
403
|
+
Check if a function has either an implementation or any metadata associated with it
|
|
404
|
+
|
|
405
|
+
:param name: The name of the function as a string
|
|
406
|
+
:return: A bool indicating if anything is known about the function
|
|
407
|
+
"""
|
|
408
|
+
return self.has_implementation(name) or name in self.non_returning or self.has_prototype(name)
|
|
409
|
+
|
|
410
|
+
def has_implementation(self, name):
|
|
411
|
+
"""
|
|
412
|
+
Check if a function has an implementation associated with it
|
|
413
|
+
|
|
414
|
+
:param name: The name of the function as a string
|
|
415
|
+
:return: A bool indicating if an implementation of the function is available
|
|
416
|
+
"""
|
|
417
|
+
return name in self.procedures
|
|
418
|
+
|
|
419
|
+
def has_prototype(self, func_name):
|
|
420
|
+
"""
|
|
421
|
+
Check if a function has a prototype associated with it.
|
|
422
|
+
|
|
423
|
+
:param str func_name: The name of the function.
|
|
424
|
+
:return: A bool indicating if a prototype of the function is available.
|
|
425
|
+
:rtype: bool
|
|
426
|
+
"""
|
|
427
|
+
|
|
428
|
+
return func_name in self.prototypes or func_name in self.prototypes_json
|
|
429
|
+
|
|
430
|
+
def is_returning(self, name: str) -> bool:
|
|
431
|
+
"""
|
|
432
|
+
Check if a function is known to return.
|
|
433
|
+
|
|
434
|
+
:param name: The name of the function.
|
|
435
|
+
:return: A bool indicating if the function is known to return or not.
|
|
436
|
+
"""
|
|
437
|
+
return name not in self.non_returning
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
class SimCppLibrary(SimLibrary):
|
|
441
|
+
"""
|
|
442
|
+
SimCppLibrary is a specialized version of SimLibrary that will demangle C++ function names before looking for an
|
|
443
|
+
implementation or prototype for it.
|
|
444
|
+
"""
|
|
445
|
+
|
|
446
|
+
@staticmethod
|
|
447
|
+
def _try_demangle(name):
|
|
448
|
+
ast = pydemumble.demangle(name)
|
|
449
|
+
return ast if ast else name
|
|
450
|
+
|
|
451
|
+
@staticmethod
|
|
452
|
+
def _proto_from_demangled_name(name: str) -> SimTypeFunction | None:
|
|
453
|
+
"""
|
|
454
|
+
Attempt to extract arguments and calling convention information for a C++ function whose name was mangled
|
|
455
|
+
according to the Itanium C++ ABI symbol mangling language.
|
|
456
|
+
|
|
457
|
+
:param name: The demangled function name.
|
|
458
|
+
:return: A prototype or None if a prototype cannot be found.
|
|
459
|
+
"""
|
|
460
|
+
|
|
461
|
+
try:
|
|
462
|
+
parsed, _ = parse_cpp_file(name, with_param_names=False)
|
|
463
|
+
except ValueError:
|
|
464
|
+
return None
|
|
465
|
+
if not parsed:
|
|
466
|
+
return None
|
|
467
|
+
_, func_proto = next(iter(parsed.items()))
|
|
468
|
+
return func_proto
|
|
469
|
+
|
|
470
|
+
def get(self, name, arch):
|
|
471
|
+
"""
|
|
472
|
+
Get an implementation of the given function specialized for the given arch, or a stub procedure if none exists.
|
|
473
|
+
Demangle the function name if it is a mangled C++ name.
|
|
474
|
+
|
|
475
|
+
:param str name: The name of the function as a string
|
|
476
|
+
:param arch: The architecure to use, as either a string or an archinfo.Arch instance
|
|
477
|
+
:return: A SimProcedure instance representing the function as found in the library
|
|
478
|
+
"""
|
|
479
|
+
demangled_name = self._try_demangle(name)
|
|
480
|
+
if demangled_name not in self.procedures:
|
|
481
|
+
return self.get_stub(name, arch) # get_stub() might use the mangled name to derive the function prototype
|
|
482
|
+
return super().get(demangled_name, arch)
|
|
483
|
+
|
|
484
|
+
def get_stub(self, name, arch):
|
|
485
|
+
"""
|
|
486
|
+
Get a stub procedure for the given function, regardless of if a real implementation is available. This will
|
|
487
|
+
apply any metadata, such as a default calling convention or a function prototype. Demangle the function name
|
|
488
|
+
if it is a mangled C++ name.
|
|
489
|
+
|
|
490
|
+
:param str name: The name of the function as a string
|
|
491
|
+
:param arch: The architecture to use, as either a string or an archinfo.Arch instance
|
|
492
|
+
:return: A SimProcedure instance representing a plausable stub as could be found in the library.
|
|
493
|
+
"""
|
|
494
|
+
demangled_name = self._try_demangle(name)
|
|
495
|
+
stub = super().get_stub(demangled_name, arch)
|
|
496
|
+
# try to determine a prototype from the function name if possible
|
|
497
|
+
if demangled_name != name:
|
|
498
|
+
# mangled function name
|
|
499
|
+
stub.prototype = self._proto_from_demangled_name(demangled_name)
|
|
500
|
+
if stub.prototype is not None:
|
|
501
|
+
stub.prototype = stub.prototype.with_arch(arch)
|
|
502
|
+
stub.guessed_prototype = False
|
|
503
|
+
if not stub.ARGS_MISMATCH:
|
|
504
|
+
stub.num_args = len(stub.prototype.args)
|
|
505
|
+
return stub
|
|
506
|
+
|
|
507
|
+
def get_prototype(self, name: str, arch=None, deref: bool = False) -> SimTypeFunction | None:
|
|
508
|
+
"""
|
|
509
|
+
Get a prototype of the given function name, optionally specialize the prototype to a given architecture. The
|
|
510
|
+
function name will be demangled first.
|
|
511
|
+
|
|
512
|
+
:param name: Name of the function.
|
|
513
|
+
:param arch: The architecture to specialize to.
|
|
514
|
+
:param deref: True if any SimTypeRefs in the prototype should be dereferenced using library information.
|
|
515
|
+
:return: Prototype of the function, or None if the prototype does not exist.
|
|
516
|
+
"""
|
|
517
|
+
demangled_name = self._try_demangle(name)
|
|
518
|
+
return super().get_prototype(demangled_name, arch=arch, deref=deref)
|
|
519
|
+
|
|
520
|
+
def has_metadata(self, name):
|
|
521
|
+
"""
|
|
522
|
+
Check if a function has either an implementation or any metadata associated with it. Demangle the function name
|
|
523
|
+
if it is a mangled C++ name.
|
|
524
|
+
|
|
525
|
+
:param name: The name of the function as a string
|
|
526
|
+
:return: A bool indicating if anything is known about the function
|
|
527
|
+
"""
|
|
528
|
+
name = self._try_demangle(name)
|
|
529
|
+
return super().has_metadata(name)
|
|
530
|
+
|
|
531
|
+
def has_implementation(self, name):
|
|
532
|
+
"""
|
|
533
|
+
Check if a function has an implementation associated with it. Demangle the function name if it is a mangled C++
|
|
534
|
+
name.
|
|
535
|
+
|
|
536
|
+
:param str name: A mangled function name.
|
|
537
|
+
:return: bool
|
|
538
|
+
"""
|
|
539
|
+
return super().has_implementation(self._try_demangle(name))
|
|
540
|
+
|
|
541
|
+
def has_prototype(self, func_name):
|
|
542
|
+
"""
|
|
543
|
+
Check if a function has a prototype associated with it. Demangle the function name if it is a mangled C++ name.
|
|
544
|
+
|
|
545
|
+
:param str name: A mangled function name.
|
|
546
|
+
:return: bool
|
|
547
|
+
"""
|
|
548
|
+
return super().has_prototype(self._try_demangle(func_name))
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
class SimSyscallLibrary(SimLibrary):
|
|
552
|
+
"""
|
|
553
|
+
SimSyscallLibrary is a specialized version of SimLibrary for dealing not with a dynamic library's API but rather
|
|
554
|
+
an operating system's syscall API. Because this interface is inherently lower-level than a dynamic library, many
|
|
555
|
+
parts of this class has been changed to store data based on an "ABI name" (ABI = application binary interface,
|
|
556
|
+
like an API but for when there's no programming language) instead of an architecture. An ABI name is just an
|
|
557
|
+
arbitrary string with which a calling convention and a syscall numbering is associated.
|
|
558
|
+
|
|
559
|
+
All the SimLibrary methods for adding functions still work, but now there's an additional layer on top that
|
|
560
|
+
associates them with numbers.
|
|
561
|
+
"""
|
|
562
|
+
|
|
563
|
+
def __init__(self):
|
|
564
|
+
super().__init__()
|
|
565
|
+
self.syscall_number_mapping: dict[str, dict[int, str]] = defaultdict(dict) # keyed by abi
|
|
566
|
+
self.syscall_name_mapping: dict[str, dict[str, int]] = defaultdict(dict) # keyed by abi
|
|
567
|
+
self.default_cc_mapping: dict[str, type[SimCCSyscall]] = {} # keyed by abi
|
|
568
|
+
self.syscall_prototypes: dict[str, dict[str, SimTypeFunction]] = defaultdict(dict) # keyed by abi
|
|
569
|
+
self.fallback_proc = stub_syscall
|
|
570
|
+
|
|
571
|
+
def copy(self):
|
|
572
|
+
o = SimSyscallLibrary()
|
|
573
|
+
o.procedures = dict(self.procedures)
|
|
574
|
+
o.non_returning = set(self.non_returning)
|
|
575
|
+
o.prototypes = dict(self.prototypes)
|
|
576
|
+
o.default_ccs = dict(self.default_ccs)
|
|
577
|
+
o.names = list(self.names)
|
|
578
|
+
o.syscall_number_mapping = defaultdict(dict, self.syscall_number_mapping) # {abi: {number: name}}
|
|
579
|
+
o.syscall_name_mapping = defaultdict(dict, self.syscall_name_mapping) # {abi: {name: number}}
|
|
580
|
+
o.syscall_prototypes = defaultdict(dict, self.syscall_prototypes) # as above
|
|
581
|
+
o.default_cc_mapping = dict(self.default_cc_mapping) # {abi: cc}
|
|
582
|
+
return o
|
|
583
|
+
|
|
584
|
+
def update(self, other):
|
|
585
|
+
super().update(other)
|
|
586
|
+
if isinstance(other, SimSyscallLibrary):
|
|
587
|
+
self.syscall_number_mapping.update(other.syscall_number_mapping)
|
|
588
|
+
self.syscall_name_mapping.update(other.syscall_name_mapping)
|
|
589
|
+
self.default_cc_mapping.update(other.default_cc_mapping)
|
|
590
|
+
|
|
591
|
+
def minimum_syscall_number(self, abi):
|
|
592
|
+
"""
|
|
593
|
+
:param abi: The abi to evaluate
|
|
594
|
+
:return: The smallest syscall number known for the given abi
|
|
595
|
+
"""
|
|
596
|
+
if abi not in self.syscall_number_mapping or not self.syscall_number_mapping[abi]:
|
|
597
|
+
return 0
|
|
598
|
+
return min(self.syscall_number_mapping[abi])
|
|
599
|
+
|
|
600
|
+
def maximum_syscall_number(self, abi):
|
|
601
|
+
"""
|
|
602
|
+
:param abi: The abi to evaluate
|
|
603
|
+
:return: The largest syscall number known for the given abi
|
|
604
|
+
"""
|
|
605
|
+
if abi not in self.syscall_number_mapping or not self.syscall_number_mapping[abi]:
|
|
606
|
+
return 0
|
|
607
|
+
return max(self.syscall_number_mapping[abi])
|
|
608
|
+
|
|
609
|
+
def add_number_mapping(self, abi, number, name):
|
|
610
|
+
"""
|
|
611
|
+
Associate a syscall number with the name of a function present in the underlying SimLibrary
|
|
612
|
+
|
|
613
|
+
:param abi: The abi for which this mapping applies
|
|
614
|
+
:param number: The syscall number
|
|
615
|
+
:param name: The name of the function
|
|
616
|
+
"""
|
|
617
|
+
self.syscall_number_mapping[abi][number] = name
|
|
618
|
+
self.syscall_name_mapping[abi][name] = number
|
|
619
|
+
|
|
620
|
+
def add_number_mapping_from_dict(self, abi, mapping):
|
|
621
|
+
"""
|
|
622
|
+
Batch-associate syscall numbers with names of functions present in the underlying SimLibrary
|
|
623
|
+
|
|
624
|
+
:param abi: The abi for which this mapping applies
|
|
625
|
+
:param mapping: A dict mapping syscall numbers to function names
|
|
626
|
+
"""
|
|
627
|
+
self.syscall_number_mapping[abi].update(mapping)
|
|
628
|
+
self.syscall_name_mapping[abi].update({b: a for a, b in mapping.items()})
|
|
629
|
+
|
|
630
|
+
def set_abi_cc(self, abi, cc_cls):
|
|
631
|
+
"""
|
|
632
|
+
Set the default calling convention for an abi
|
|
633
|
+
|
|
634
|
+
:param abi: The name of the abi
|
|
635
|
+
:param cc_cls: A SimCC _class_, not an instance, that should be used for syscalls using the abi
|
|
636
|
+
"""
|
|
637
|
+
self.default_cc_mapping[abi] = cc_cls
|
|
638
|
+
|
|
639
|
+
# pylint: disable=arguments-differ
|
|
640
|
+
def set_prototype(self, abi: str, name: str, proto: SimTypeFunction) -> None: # type:ignore
|
|
641
|
+
"""
|
|
642
|
+
Set the prototype of a function in the form of a SimTypeFunction containing argument and return types
|
|
643
|
+
|
|
644
|
+
:param abi: ABI of the syscall.
|
|
645
|
+
:param name: The name of the syscall as a string
|
|
646
|
+
:param proto: The prototype of the syscall as a SimTypeFunction
|
|
647
|
+
"""
|
|
648
|
+
self.syscall_prototypes[abi][name] = proto
|
|
649
|
+
|
|
650
|
+
# pylint: disable=arguments-differ
|
|
651
|
+
def set_prototypes(self, abi: str, protos: dict[str, SimTypeFunction]) -> None: # type:ignore
|
|
652
|
+
"""
|
|
653
|
+
Set the prototypes of many syscalls.
|
|
654
|
+
|
|
655
|
+
:param abi: ABI of the syscalls.
|
|
656
|
+
:param protos: Dictionary mapping syscall names to SimTypeFunction objects
|
|
657
|
+
"""
|
|
658
|
+
self.syscall_prototypes[abi].update(protos)
|
|
659
|
+
|
|
660
|
+
def _canonicalize(self, number, arch, abi_list):
|
|
661
|
+
if type(arch) is str:
|
|
662
|
+
arch = archinfo.arch_from_id(arch)
|
|
663
|
+
if type(number) is str:
|
|
664
|
+
return number, arch, None
|
|
665
|
+
for abi in abi_list:
|
|
666
|
+
mapping = self.syscall_number_mapping[abi]
|
|
667
|
+
if number in mapping:
|
|
668
|
+
return mapping[number], arch, abi
|
|
669
|
+
return f"sys_{number}", arch, None
|
|
670
|
+
|
|
671
|
+
def _apply_numerical_metadata(self, proc, number, arch, abi):
|
|
672
|
+
proc.syscall_number = number
|
|
673
|
+
proc.abi = abi
|
|
674
|
+
if abi in self.default_cc_mapping:
|
|
675
|
+
cc = self.default_cc_mapping[abi](arch)
|
|
676
|
+
proc.cc = cc
|
|
677
|
+
elif arch.name in self.default_ccs:
|
|
678
|
+
proc.cc = self.default_ccs[arch.name](arch)
|
|
679
|
+
# a bit of a hack.
|
|
680
|
+
name = proc.display_name
|
|
681
|
+
if self.has_prototype(abi, name):
|
|
682
|
+
proc.guessed_prototype = False
|
|
683
|
+
proto = self.get_prototype(abi, name, deref=True)
|
|
684
|
+
assert proto is not None
|
|
685
|
+
proc.prototype = proto.with_arch(arch)
|
|
686
|
+
|
|
687
|
+
def add_alias(self, name, *alt_names):
|
|
688
|
+
"""
|
|
689
|
+
Add some duplicate names for a given function. The original function's implementation must already be
|
|
690
|
+
registered.
|
|
691
|
+
|
|
692
|
+
:param name: The name of the function for which an implementation is already present
|
|
693
|
+
:param alt_names: Any number of alternate names may be passed as varargs
|
|
694
|
+
"""
|
|
695
|
+
old_procedure = self.procedures[name]
|
|
696
|
+
for alt in alt_names:
|
|
697
|
+
new_procedure = copy.deepcopy(old_procedure)
|
|
698
|
+
new_procedure.display_name = alt
|
|
699
|
+
self.procedures[alt] = new_procedure
|
|
700
|
+
for abi in self.syscall_prototypes:
|
|
701
|
+
if self.has_prototype(abi, name):
|
|
702
|
+
self.syscall_prototypes[abi][alt] = self.get_prototype(abi, name) # type:ignore
|
|
703
|
+
if name in self.non_returning:
|
|
704
|
+
self.non_returning.add(alt)
|
|
705
|
+
|
|
706
|
+
def _apply_metadata(self, proc, arch):
|
|
707
|
+
# this function is a no-op in SimSyscallLibrary; users are supposed to explicitly call
|
|
708
|
+
# _apply_numerical_metadata instead.
|
|
709
|
+
pass
|
|
710
|
+
|
|
711
|
+
# pylint: disable=arguments-differ
|
|
712
|
+
def get(self, number, arch, abi_list=()): # type:ignore
|
|
713
|
+
"""
|
|
714
|
+
The get() function for SimSyscallLibrary looks a little different from its original version.
|
|
715
|
+
|
|
716
|
+
Instead of providing a name, you provide a number, and you additionally provide a list of abi names that are
|
|
717
|
+
applicable. The first abi for which the number is present in the mapping will be chosen. This allows for the
|
|
718
|
+
easy abstractions of architectures like ARM or MIPS linux for which there are many ABIs that can be used at any
|
|
719
|
+
time by using syscall numbers from various ranges. If no abi knows about the number, the stub procedure with
|
|
720
|
+
the name "sys_%d" will be used.
|
|
721
|
+
|
|
722
|
+
:param number: The syscall number
|
|
723
|
+
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
|
|
724
|
+
:param abi_list: A list of ABI names that could be used
|
|
725
|
+
:return: A SimProcedure representing the implementation of the given syscall, or a stub if no
|
|
726
|
+
implementation is available
|
|
727
|
+
"""
|
|
728
|
+
name, arch, abi = self._canonicalize(number, arch, abi_list)
|
|
729
|
+
proc = super().get(name, arch)
|
|
730
|
+
proc.is_syscall = True
|
|
731
|
+
self._apply_numerical_metadata(proc, number, arch, abi)
|
|
732
|
+
return proc
|
|
733
|
+
|
|
734
|
+
def get_stub(self, number, arch, abi_list=()): # type:ignore
|
|
735
|
+
"""
|
|
736
|
+
Pretty much the intersection of SimLibrary.get_stub() and SimSyscallLibrary.get().
|
|
737
|
+
|
|
738
|
+
:param number: The syscall number
|
|
739
|
+
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
|
|
740
|
+
:param abi_list: A list of ABI names that could be used
|
|
741
|
+
:return: A SimProcedure representing a plausable stub that could model the syscall
|
|
742
|
+
"""
|
|
743
|
+
name, arch, abi = self._canonicalize(number, arch, abi_list)
|
|
744
|
+
proc = super().get_stub(name, arch)
|
|
745
|
+
self._apply_numerical_metadata(proc, number, arch, abi)
|
|
746
|
+
l.debug("unsupported syscall: %s", number)
|
|
747
|
+
return proc
|
|
748
|
+
|
|
749
|
+
def get_prototype( # type:ignore
|
|
750
|
+
self, abi: str, name: str, arch=None, deref: bool = False
|
|
751
|
+
) -> SimTypeFunction | None:
|
|
752
|
+
"""
|
|
753
|
+
Get a prototype of the given syscall name and its ABI, optionally specialize the prototype to a given
|
|
754
|
+
architecture.
|
|
755
|
+
|
|
756
|
+
:param abi: ABI of the prototype to get.
|
|
757
|
+
:param name: Name of the syscall.
|
|
758
|
+
:param arch: The architecture to specialize to.
|
|
759
|
+
:param deref: True if any SimTypeRefs in the prototype should be dereferenced using library information.
|
|
760
|
+
:return: Prototype of the syscall, or None if the prototype does not exist.
|
|
761
|
+
"""
|
|
762
|
+
if abi not in self.syscall_prototypes:
|
|
763
|
+
return None
|
|
764
|
+
proto = self.syscall_prototypes[abi].get(name, None)
|
|
765
|
+
if proto is None:
|
|
766
|
+
return None
|
|
767
|
+
if deref:
|
|
768
|
+
from angr.utils.types import dereference_simtype_by_lib # pylint:disable=import-outside-toplevel
|
|
769
|
+
|
|
770
|
+
proto = dereference_simtype_by_lib(proto, self.name)
|
|
771
|
+
assert isinstance(proto, SimTypeFunction)
|
|
772
|
+
return proto.with_arch(arch=arch)
|
|
773
|
+
|
|
774
|
+
def has_metadata(self, number, arch, abi_list=()): # type:ignore
|
|
775
|
+
"""
|
|
776
|
+
Pretty much the intersection of SimLibrary.has_metadata() and SimSyscallLibrary.get().
|
|
777
|
+
|
|
778
|
+
:param number: The syscall number
|
|
779
|
+
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
|
|
780
|
+
:param abi_list: A list of ABI names that could be used
|
|
781
|
+
:return: A bool of whether or not any implementation or metadata is known about the given syscall
|
|
782
|
+
"""
|
|
783
|
+
name, _, abi = self._canonicalize(number, arch, abi_list)
|
|
784
|
+
return (
|
|
785
|
+
name in self.procedures or name in self.non_returning or (abi is not None and self.has_prototype(abi, name))
|
|
786
|
+
)
|
|
787
|
+
|
|
788
|
+
def has_implementation(self, number, arch, abi_list=()): # type:ignore
|
|
789
|
+
"""
|
|
790
|
+
Pretty much the intersection of SimLibrary.has_implementation() and SimSyscallLibrary.get().
|
|
791
|
+
|
|
792
|
+
:param number: The syscall number
|
|
793
|
+
:param arch: The architecture being worked with, as either a string name or an archinfo.Arch
|
|
794
|
+
:param abi_list: A list of ABI names that could be used
|
|
795
|
+
:return: A bool of whether or not an implementation of the syscall is available
|
|
796
|
+
"""
|
|
797
|
+
name, _, _ = self._canonicalize(number, arch, abi_list)
|
|
798
|
+
return super().has_implementation(name)
|
|
799
|
+
|
|
800
|
+
def has_prototype(self, abi: str, name: str) -> bool: # type:ignore
|
|
801
|
+
"""
|
|
802
|
+
Check if a function has a prototype associated with it. Demangle the function name if it is a mangled C++ name.
|
|
803
|
+
|
|
804
|
+
:param abi: Name of the ABI.
|
|
805
|
+
:param name: The syscall name.
|
|
806
|
+
:return: bool
|
|
807
|
+
"""
|
|
808
|
+
if abi not in self.syscall_prototypes:
|
|
809
|
+
return False
|
|
810
|
+
return name in self.syscall_prototypes[abi]
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
#
|
|
814
|
+
# Autoloading
|
|
815
|
+
#
|
|
816
|
+
|
|
817
|
+
# By default we only load common API definitions (as defined in COMMON_LIBRARIES). For loading more definitions, the
|
|
818
|
+
# following logic is followed:
|
|
819
|
+
# - We will load all Windows APIs them if the loaded binary is a Windows binary, or when load_win32api_definitions() is
|
|
820
|
+
# called.
|
|
821
|
+
# - We will load all APIs when load_all_definitions() is called.
|
|
822
|
+
|
|
823
|
+
_DEFINITIONS_BASEDIR = os.path.dirname(os.path.realpath(__file__))
|
|
824
|
+
_EXTERNAL_DEFINITIONS_DIRS: list[str] | None = None
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
def load_type_collections(only=None, skip=None) -> None:
|
|
828
|
+
if skip is None:
|
|
829
|
+
skip = set()
|
|
830
|
+
|
|
831
|
+
# recursively list and load all _types.json files
|
|
832
|
+
types_json_files = []
|
|
833
|
+
for root, _, files in os.walk(_DEFINITIONS_BASEDIR):
|
|
834
|
+
for filename in files:
|
|
835
|
+
if filename.endswith(".json") and filename.startswith("_types_"):
|
|
836
|
+
module_name = filename[7:-5]
|
|
837
|
+
if only is not None and module_name not in only:
|
|
838
|
+
continue
|
|
839
|
+
if module_name in skip:
|
|
840
|
+
continue
|
|
841
|
+
types_json_files.append(os.path.join(root, filename))
|
|
842
|
+
|
|
843
|
+
for f in types_json_files:
|
|
844
|
+
with open(f, "rb") as fp:
|
|
845
|
+
data = fp.read()
|
|
846
|
+
d = msgspec.json.decode(data)
|
|
847
|
+
if not isinstance(d, dict) or d.get("_t", "") != "types":
|
|
848
|
+
l.warning("Invalid type collection JSON file: %s", f)
|
|
849
|
+
continue
|
|
850
|
+
if (
|
|
851
|
+
"names" in d
|
|
852
|
+
and isinstance(d["names"], list)
|
|
853
|
+
and any(libname in SIM_TYPE_COLLECTIONS for libname in d["names"])
|
|
854
|
+
):
|
|
855
|
+
# the type collection is already loaded
|
|
856
|
+
continue
|
|
857
|
+
try:
|
|
858
|
+
SimTypeCollection.from_json(d)
|
|
859
|
+
except TypeError:
|
|
860
|
+
l.warning("Failed to load type collection from %s", f, exc_info=True)
|
|
861
|
+
|
|
862
|
+
# supporting legacy type collections defined as Python files
|
|
863
|
+
for _ in autoimport.auto_import_modules(
|
|
864
|
+
"angr.procedures.definitions",
|
|
865
|
+
_DEFINITIONS_BASEDIR,
|
|
866
|
+
filter_func=lambda module_name: module_name.startswith("types_")
|
|
867
|
+
and (only is None or (only is not None and module_name[6:] in only))
|
|
868
|
+
and module_name[6:] not in skip,
|
|
869
|
+
):
|
|
870
|
+
pass
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
def load_win32_type_collections() -> None:
|
|
874
|
+
if once("load_win32_type_collections"):
|
|
875
|
+
load_type_collections(only={"win32"})
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
def _load_definitions(base_dir: str, only: set[str] | None = None, skip: set[str] | None = None):
|
|
879
|
+
if skip is None:
|
|
880
|
+
skip = set()
|
|
881
|
+
|
|
882
|
+
for f in os.listdir(base_dir):
|
|
883
|
+
if f.endswith(".json") and not f.startswith("_types_"):
|
|
884
|
+
module_name = f[:-5]
|
|
885
|
+
if only is not None and module_name not in only:
|
|
886
|
+
continue
|
|
887
|
+
if module_name in skip:
|
|
888
|
+
continue
|
|
889
|
+
with open(os.path.join(base_dir, f), "rb") as f:
|
|
890
|
+
d = msgspec.json.decode(f.read())
|
|
891
|
+
if not (isinstance(d, dict) and d.get("_t", "") == "lib"):
|
|
892
|
+
l.warning("Invalid SimLibrary JSON file: %s", f)
|
|
893
|
+
continue
|
|
894
|
+
try:
|
|
895
|
+
SimLibrary.from_json(d)
|
|
896
|
+
except (TypeError, KeyError):
|
|
897
|
+
l.warning("Failed to load SimLibrary from %s", f, exc_info=True)
|
|
898
|
+
|
|
899
|
+
# support for loading legacy prototype definitions defined as Python modules
|
|
900
|
+
for _ in autoimport.auto_import_modules(
|
|
901
|
+
"angr.procedures.definitions",
|
|
902
|
+
base_dir,
|
|
903
|
+
filter_func=lambda module_name: (only is None or (only is not None and module_name in only))
|
|
904
|
+
and module_name not in skip,
|
|
905
|
+
):
|
|
906
|
+
pass
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
def load_external_definitions():
|
|
910
|
+
"""
|
|
911
|
+
Load library definitions from specific directories. By default it parses ANGR_EXTERNAL_DEFINITIONS_DIRS as a
|
|
912
|
+
semicolon separated list of directory paths. Then it loads all .py files in each directory. These .py files should
|
|
913
|
+
declare SimLibrary() objects and call .set_library_names() to register themselves in angr.SIM_LIBRARIES.
|
|
914
|
+
"""
|
|
915
|
+
|
|
916
|
+
global _EXTERNAL_DEFINITIONS_DIRS
|
|
917
|
+
|
|
918
|
+
if _EXTERNAL_DEFINITIONS_DIRS is None and "ANGR_EXTERNAL_DEFINITIONS_DIRS" in os.environ:
|
|
919
|
+
_EXTERNAL_DEFINITIONS_DIRS = os.environ["ANGR_EXTERNAL_DEFINITIONS_DIRS"].strip('"').split(";")
|
|
920
|
+
l.debug("Using external library definitions from %s", _EXTERNAL_DEFINITIONS_DIRS)
|
|
921
|
+
for d in _EXTERNAL_DEFINITIONS_DIRS:
|
|
922
|
+
if not os.path.isdir(d):
|
|
923
|
+
l.warning("External library definitions directory %s does not exist or is not a directory.", d)
|
|
924
|
+
|
|
925
|
+
if _EXTERNAL_DEFINITIONS_DIRS:
|
|
926
|
+
# we must load all definitions prior to any external definitions are loaded. otherwise external definitions may
|
|
927
|
+
# be overwritten by embedded definitions in angr, which is undesirable
|
|
928
|
+
load_all_definitions()
|
|
929
|
+
|
|
930
|
+
for d in _EXTERNAL_DEFINITIONS_DIRS:
|
|
931
|
+
_load_definitions(d)
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
def _update_libkernel32(lib: SimLibrary):
|
|
935
|
+
from angr.procedures.procedure_dict import SIM_PROCEDURES as P # pylint:disable=import-outside-toplevel
|
|
936
|
+
|
|
937
|
+
lib.add_all_from_dict(P["win32"])
|
|
938
|
+
lib.add_alias("EncodePointer", "DecodePointer")
|
|
939
|
+
lib.add_alias("GlobalAlloc", "LocalAlloc")
|
|
940
|
+
|
|
941
|
+
lib.add("lstrcatA", P["libc"]["strcat"])
|
|
942
|
+
lib.add("lstrcmpA", P["libc"]["strcmp"])
|
|
943
|
+
lib.add("lstrcpyA", P["libc"]["strcpy"])
|
|
944
|
+
lib.add("lstrcpynA", P["libc"]["strncpy"])
|
|
945
|
+
lib.add("lstrlenA", P["libc"]["strlen"])
|
|
946
|
+
lib.add("lstrcmpW", P["libc"]["wcscmp"])
|
|
947
|
+
lib.add("lstrcmpiW", P["libc"]["wcscasecmp"])
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
def _update_libntdll(lib: SimLibrary):
|
|
951
|
+
from angr.procedures.procedure_dict import SIM_PROCEDURES as P # pylint:disable=import-outside-toplevel
|
|
952
|
+
|
|
953
|
+
lib.add("RtlEncodePointer", P["win32"]["EncodePointer"])
|
|
954
|
+
lib.add("RtlDecodePointer", P["win32"]["EncodePointer"])
|
|
955
|
+
lib.add("RtlAllocateHeap", P["win32"]["HeapAlloc"])
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
def _update_libuser32(lib: SimLibrary):
|
|
959
|
+
from angr.procedures.procedure_dict import SIM_PROCEDURES as P # pylint:disable=import-outside-toplevel
|
|
960
|
+
from angr.calling_conventions import SimCCCdecl # pylint:disable=import-outside-toplevel
|
|
961
|
+
|
|
962
|
+
lib.add_all_from_dict(P["win_user32"])
|
|
963
|
+
lib.add("wsprintfA", P["libc"]["sprintf"], cc=SimCCCdecl(archinfo.ArchX86()))
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
def _update_libntoskrnl(lib: SimLibrary):
|
|
967
|
+
from angr.procedures.procedure_dict import SIM_PROCEDURES as P # pylint:disable=import-outside-toplevel
|
|
968
|
+
|
|
969
|
+
lib.add_all_from_dict(P["win32_kernel"])
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
def _update_glibc(libc: SimLibrary):
|
|
973
|
+
from angr.procedures.procedure_dict import SIM_PROCEDURES as P # pylint:disable=import-outside-toplevel
|
|
974
|
+
|
|
975
|
+
libc.add_all_from_dict(P["libc"])
|
|
976
|
+
libc.add_all_from_dict(P["posix"])
|
|
977
|
+
libc.add_all_from_dict(P["glibc"])
|
|
978
|
+
# gotta do this since there's no distinguishing different libcs without analysis. there should be no naming
|
|
979
|
+
# conflicts in the functions.
|
|
980
|
+
libc.add_all_from_dict(P["uclibc"])
|
|
981
|
+
|
|
982
|
+
# aliases for SimProcedures
|
|
983
|
+
libc.add_alias("abort", "__assert_fail", "__stack_chk_fail")
|
|
984
|
+
libc.add_alias("memcpy", "memmove", "bcopy")
|
|
985
|
+
libc.add_alias("getc", "_IO_getc")
|
|
986
|
+
libc.add_alias("putc", "_IO_putc")
|
|
987
|
+
libc.add_alias("gets", "_IO_gets")
|
|
988
|
+
libc.add_alias("puts", "_IO_puts")
|
|
989
|
+
libc.add_alias("exit", "_exit", "_Exit")
|
|
990
|
+
libc.add_alias("sprintf", "siprintf")
|
|
991
|
+
libc.add_alias("snprintf", "sniprintf")
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
def load_win32api_definitions():
|
|
995
|
+
load_win32_type_collections()
|
|
996
|
+
if once("load_win32api_definitions"):
|
|
997
|
+
api_base_dirs = ["win32", "wdk"]
|
|
998
|
+
for api_base_dir in api_base_dirs:
|
|
999
|
+
base_dir = os.path.join(_DEFINITIONS_BASEDIR, api_base_dir)
|
|
1000
|
+
if not os.path.isdir(base_dir):
|
|
1001
|
+
continue
|
|
1002
|
+
_load_definitions(base_dir)
|
|
1003
|
+
|
|
1004
|
+
if "kernel32.dll" in SIM_LIBRARIES:
|
|
1005
|
+
_update_libkernel32(SIM_LIBRARIES["kernel32.dll"][0])
|
|
1006
|
+
if "ntdll.dll" in SIM_LIBRARIES:
|
|
1007
|
+
_update_libntdll(SIM_LIBRARIES["ntdll.dll"][0])
|
|
1008
|
+
if "user32.dll" in SIM_LIBRARIES:
|
|
1009
|
+
_update_libuser32(SIM_LIBRARIES["user32.dll"][0])
|
|
1010
|
+
if "ntoskrnl.exe" in SIM_LIBRARIES:
|
|
1011
|
+
_update_libntoskrnl(SIM_LIBRARIES["ntoskrnl.exe"][0])
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
def load_all_definitions():
|
|
1015
|
+
load_type_collections(skip=set())
|
|
1016
|
+
if once("load_all_definitions"):
|
|
1017
|
+
_load_definitions(_DEFINITIONS_BASEDIR)
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
COMMON_LIBRARIES = {
|
|
1021
|
+
# CGC
|
|
1022
|
+
"cgc",
|
|
1023
|
+
# (mostly) Linux
|
|
1024
|
+
"glibc",
|
|
1025
|
+
"gnulib", # really just for .o files in coreutils
|
|
1026
|
+
"libstdcpp",
|
|
1027
|
+
"linux_kernel",
|
|
1028
|
+
"linux_loader",
|
|
1029
|
+
# Windows
|
|
1030
|
+
"msvcr",
|
|
1031
|
+
# Mach O
|
|
1032
|
+
"macho_libsystem",
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
# Load common types
|
|
1037
|
+
load_type_collections(skip={"win32"})
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
# Load common definitions
|
|
1041
|
+
_load_definitions(os.path.join(_DEFINITIONS_BASEDIR, "common"), only=COMMON_LIBRARIES)
|
|
1042
|
+
_load_definitions(_DEFINITIONS_BASEDIR, only=COMMON_LIBRARIES)
|
|
1043
|
+
_update_glibc(SIM_LIBRARIES["libc.so"][0])
|