Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
Minor fixups for all examples; add testcases to check for example cov…
Browse files Browse the repository at this point in the history
…erage and API doc coverage
  • Loading branch information
rhelmot committed Dec 21, 2017
1 parent 3a9bd4b commit 70d213e
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 55 deletions.
75 changes: 73 additions & 2 deletions api-doc/source/angr.rst
@@ -1,35 +1,69 @@
:mod:`angr` --- Analysis and Coordination
=========================================

.. automodule:: angr

Project
-------

.. automodule:: angr.project
.. automodule:: angr.factory
.. automodule:: angr.block

Program State
-------------
.. automodule:: angr.sim_state
.. automodule:: angr.sim_options
.. automodule:: angr.state_plugins
.. automodule:: angr.state_plugins.plugin
.. automodule:: angr.state_plugins.inspect
.. automodule:: angr.state_plugins.libc
.. automodule:: angr.state_plugins.posix
.. automodule:: angr.state_plugins.solver
.. automodule:: angr.state_plugins.log
.. automodule:: angr.state_plugins.callstack
.. automodule:: angr.state_plugins.fast_memory
.. automodule:: angr.state_plugins.history
.. automodule:: angr.state_plugins.gdb
.. automodule:: angr.state_plugins.cgc
.. automodule:: angr.state_plugins.trace_additions
.. automodule:: angr.state_plugins.globals
.. automodule:: angr.state_plugins.uc_manager
.. automodule:: angr.state_plugins.scratch
.. automodule:: angr.state_plugins.preconstrainer
.. automodule:: angr.state_plugins.unicorn_engine


Storage
-------

.. automodule:: angr.storage
.. automodule:: angr.state_plugins.view
.. automodule:: angr.storage.file
.. automodule:: angr.storage.memory
.. automodule:: angr.state_plugins.symbolic_memory
.. automodule:: angr.state_plugins.abstract_memory
.. automodule:: angr.storage.memory_object
.. automodule:: angr.storage.pcap
.. automodule:: angr.storage.paged_memory
.. automodule:: angr.concretization_strategies

Concretization Strategies
-------------------------

.. automodule:: angr.concretization_strategies.single
.. automodule:: angr.concretization_strategies.eval
.. automodule:: angr.concretization_strategies.norepeats
.. automodule:: angr.concretization_strategies.solutions
.. automodule:: angr.concretization_strategies.nonzero_range
.. automodule:: angr.concretization_strategies.range
.. automodule:: angr.concretization_strategies.max
.. automodule:: angr.concretization_strategies.norepeats_range
.. automodule:: angr.concretization_strategies.nonzero
.. automodule:: angr.concretization_strategies.any
.. automodule:: angr.concretization_strategies.controlled_data


Simulation Manager
------------------

Expand Down Expand Up @@ -86,6 +120,7 @@ Calling Conventions and Types
.. automodule:: angr.sim_variable
.. automodule:: angr.sim_type
.. automodule:: angr.type_backend
.. automodule:: angr.callable

Knowledge Base
--------------
Expand All @@ -104,36 +139,72 @@ Knowledge Base
.. automodule:: angr.knowledge_plugins.variables
.. automodule:: angr.knowledge_plugins.variables.variable_access
.. automodule:: angr.knowledge_plugins.variables.variable_manager
.. automodule:: angr.keyed_region


Analysis
--------

.. automodule:: angr.analyses
.. automodule:: angr.analyses.analysis
.. automodule:: angr.analyses.forward_analysis
.. automodule:: angr.analyses.backward_slice
.. automodule:: angr.analyses.bindiff
.. automodule:: angr.analyses.boyscout
.. automodule:: angr.analyses.cdg
.. automodule:: angr.analyses.cfg
.. automodule:: angr.analyses.cfg.cfg
.. automodule:: angr.analyses.cfg.cfg_accurate
.. automodule:: angr.analyses.cfg.cfg_base
.. automodule:: angr.analyses.cfg.cfg_fast
.. automodule:: angr.analyses.cfg.cfg_node
.. automodule:: angr.analyses.cfg.cfg_arch_options
.. automodule:: angr.analyses.cfg.cfg_job_base
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.x86_pe_iat
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.mips_elf_fast
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.x86_elf_pic_plt
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.default_resolvers
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.jumptable
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers.resolver
.. automodule:: angr.analyses.cfg.indirect_jump_resolvers
.. automodule:: angr.analyses.cfg.cfg_utils
.. automodule:: angr.analyses.cdg
.. automodule:: angr.analyses.code_location
.. automodule:: angr.analyses.datagraph_meta
.. automodule:: angr.analyses.ddg
.. automodule:: angr.analyses.dfg
.. automodule:: angr.analyses.forward_analysis
.. automodule:: angr.analyses.variable_recovery.annotations
.. automodule:: angr.analyses.variable_recovery.variable_recovery_fast
.. automodule:: angr.analyses.variable_recovery.variable_recovery
.. automodule:: angr.analyses.variable_recovery
.. automodule:: angr.analyses.girlscout
.. automodule:: angr.analyses.identifier.identify
.. automodule:: angr.analyses.loopfinder
.. automodule:: angr.analyses.veritesting
.. automodule:: angr.analyses.vfg
.. automodule:: angr.analyses.vsa_ddg
.. automodule:: angr.analyses.disassembly
.. automodule:: angr.analyses.disassembly_utils
.. automodule:: angr.analyses.reassembler
.. automodule:: angr.analyses.congruency_check
.. automodule:: angr.analyses.static_hooker
.. automodule:: angr.analyses.binary_optimizer
.. automodule:: angr.analyses.callee_cleanup_finder
.. automodule:: angr.blade
.. automodule:: angr.slicer
.. automodule:: angr.annocfg
.. automodule:: angr.codenode


SimOS
-----

.. automodule:: angr.simos
.. automodule:: angr.simos.simos
.. automodule:: angr.simos.linux
.. automodule:: angr.simos.cgc
.. automodule:: angr.simos.userland
.. automodule:: angr.simos.windows

Errors
------
.. automodule:: angr.errors
16 changes: 16 additions & 0 deletions api-doc/source/archinfo.rst
Expand Up @@ -2,6 +2,10 @@
===============================================

.. automodule:: archinfo

Architectures
-------------

.. automodule:: archinfo.arch
.. automodule:: archinfo.arch_aarch64
.. automodule:: archinfo.arch_amd64
Expand All @@ -11,3 +15,15 @@
.. automodule:: archinfo.arch_ppc32
.. automodule:: archinfo.arch_ppc64
.. automodule:: archinfo.arch_x86
.. automodule:: archinfo.arch_avr

Utilities
---------

.. automodule:: archinfo.tls
.. automodule:: archinfo.defines

Errors
------

.. automodule:: archinfo.archerror
6 changes: 6 additions & 0 deletions api-doc/source/claripy.rst
Expand Up @@ -46,6 +46,11 @@ Backends
.. automodule:: claripy.backend_object
.. automodule:: claripy.backends.backend_concrete
.. automodule:: claripy.backends.backend_z3
.. automodule:: claripy.backends.backend_z3_parallel
.. automodule:: claripy.backends.celeryconfig
.. automodule:: claripy.backends.remotetasks
.. automodule:: claripy.backends.backend_vsa
.. automodule:: claripy.backends.backendremote


Frontends
Expand All @@ -59,6 +64,7 @@ Frontends
.. automodule:: claripy.frontends.hybrid_frontend
.. automodule:: claripy.frontends.light_frontend
.. automodule:: claripy.frontends.replacement_frontend
.. automodule:: claripy.solvers


Frontend Mixins
Expand Down
24 changes: 23 additions & 1 deletion api-doc/source/cle.rst
Expand Up @@ -17,24 +17,29 @@ Backends
.. automodule:: cle.backends.externs
.. automodule:: cle.backends.symbol
.. automodule:: cle.backends.regions
.. automodule:: cle.backends.region
.. automodule:: cle.backends.elf
.. automodule:: cle.backends.elf.elf
.. automodule:: cle.backends.elf.elfcore
.. automodule:: cle.backends.elf.metaelf
.. automodule:: cle.backends.elf.symbol
.. automodule:: cle.backends.elf.regions
.. automodule:: cle.backends.elf.hashtable
.. automodule:: cle.backends.pe
.. automodule:: cle.backends.pe.pe
.. automodule:: cle.backends.pe.symbol
.. automodule:: cle.backends.pe.regions
.. automodule:: cle.backends.macho
.. automodule:: cle.backends.macho.macho
.. automodule:: cle.backends.macho.symbol
.. automodule:: cle.backends.macho.section
.. automodule:: cle.backends.macho.segment
.. automodule:: cle.backends.macho.binding
.. automodule:: cle.backends.cgc
.. automodule:: cle.backends.cgc.cgc
.. automodule:: cle.backends.cgc.backedcgc
.. automodule:: cle.backends.ihex
.. automodule:: cle.backends.blob
.. automodule:: cle.backends.ihex
.. automodule:: cle.backends.idabin


Expand All @@ -50,8 +55,25 @@ Look at the existing versions for details.
.. automodule:: cle.backends.relocation
.. automodule:: cle.backends.elf.relocation
.. automodule:: cle.backends.elf.relocation.elfreloc
.. automodule:: cle.backends.elf.relocation.mips64
.. automodule:: cle.backends.elf.relocation.generic
.. automodule:: cle.backends.elf.relocation.armel
.. automodule:: cle.backends.elf.relocation.ppc
.. automodule:: cle.backends.elf.relocation.armhf
.. automodule:: cle.backends.elf.relocation.pcc64
.. automodule:: cle.backends.elf.relocation.i386
.. automodule:: cle.backends.elf.relocation.amd64
.. automodule:: cle.backends.elf.relocation.mips
.. automodule:: cle.backends.elf.relocation.arm
.. automodule:: cle.backends.elf.relocation.arm64
.. automodule:: cle.backends.pe.relocation
.. automodule:: cle.backends.pe.relocation.pereloc
.. automodule:: cle.backends.pe.relocation.generic
.. automodule:: cle.backends.pe.relocation.i386
.. automodule:: cle.backends.pe.relocation.amd64
.. automodule:: cle.backends.pe.relocation.mips
.. automodule:: cle.backends.pe.relocation.arm
.. automodule:: cle.backends.pe.relocation.riscv


Thread-local storage
Expand Down
18 changes: 15 additions & 3 deletions api-doc/source/pyvex.rst
Expand Up @@ -16,10 +16,22 @@ IR Components
.. automodule:: pyvex.stmt
.. automodule:: pyvex.expr
.. automodule:: pyvex.const
.. automodule:: pyvex.enums

Lifting System
--------------

Misc. Things
------------
.. automodule:: pyvex.lift
.. automodule:: pyvex.lift.libvex
.. automodule:: pyvex.lift.fixes
.. automodule:: pyvex.lift.util.irsb_postprocess
.. automodule:: pyvex.lift.util.syntax_wrapper
.. automodule:: pyvex.lift.util
.. automodule:: pyvex.lift.util.vex_helper
.. automodule:: pyvex.lift.util.lifter_helper
.. automodule:: pyvex.lift.util.instr_helper

Errors
------

.. automodule:: pyvex.enums
.. automodule:: pyvex.errors
4 changes: 2 additions & 2 deletions docs/loading.md
Expand Up @@ -94,11 +94,11 @@ You can interact directly with these objects to extract metadata from them:
<.text | offset 0x580, vaddr 0x400580, size 0x338>

# Get the address of the PLT stub for a symbol
>>> addr = obj.plt['__libc_start_main']
>>> addr = obj.plt['abort']
>>> addr
0x400540
>>> obj.reverse_plt[addr]
'__libc_start_main'
'abort'

# Show the prelinked base of the object and the location it was actually mapped into memory by CLE
>>> obj.linked_base
Expand Down
Binary file modified examples/simple_heap_overflow/exploit
Binary file not shown.
8 changes: 5 additions & 3 deletions examples/tumctf2016_zwiebel/solve.py
Expand Up @@ -29,12 +29,15 @@ def main():

assert sm.deadended
flag = sm.deadended[-1].posix.dumps(0).split("\n")[0]
print flag
return flag

# import ipdb; ipdb.set_trace()

def test():
assert main == 'hxp{1_h0p3_y0u_d1dnt_p33l_th3_0ni0n_by_h4nd}'

if __name__ == "__main__":
main()
print main()

"""
Here is the output (after 2 hours and 31 minutes on my machine running Pypy):
Expand All @@ -47,4 +50,3 @@ def main():
hxp{1_h0p3_y0u_d1dnt_p33l_th3_0ni0n_by_h4nd}
:)
"""

2 changes: 1 addition & 1 deletion examples/unmapped_analysis/solve.py
Expand Up @@ -36,7 +36,7 @@ def main():
return keys

def test():
keys = ['e6dba991c1745128787fbc7a9843306cb2bcc63e', '275edf0657388c3a1197cdadfad7b96da0f977a3'].sort()
keys = sorted(['e6dba991c1745128787fbc7a9843306cb2bcc63e', '275edf0657388c3a1197cdadfad7b96da0f977a3'])
assert main() == keys

if __name__ == '__main__':
Expand Down

0 comments on commit 70d213e

Please sign in to comment.