Skip to content

Commit

Permalink
Make grub testable
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Nov 14, 2017
1 parent b077f11 commit a66f3e8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/grub/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import angr
import logging

logging.getLogger('angr.manager').setLevel('DEBUG')

# This is the important logic that makes this problemt tractable
class CheckUniqueness(angr.ExplorationTechnique):
def __init__(self):
Expand Down Expand Up @@ -73,7 +71,12 @@ def find_bug(project, function, args):
print 'we found a crashing input!'
print 'crashing state:', simgr.found[0]
print 'input:', repr(simgr.found[0].posix.dumps(0))
return simgr.found[0].posix.dumps(0)

def test():
assert find_bug(setup_project(), 'grub_password_get', (angr.PointerWrapper('\0'*64), 64)) == '\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\r'

if __name__ == '__main__':
logging.getLogger('angr.manager').setLevel('DEBUG')
p = setup_project()
find_bug(p, 'grub_password_get', (angr.PointerWrapper('\0'*64), 64))

0 comments on commit a66f3e8

Please sign in to comment.