Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple changes; python 2 support, dictionary, mutator refactor #26

Merged
merged 15 commits into from Jan 19, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add support for escaped strings to the dictionary.

The dictionary reader can now handle escaped strings in its
vales, as given in the AFL examples.
  • Loading branch information
gerph committed Jan 7, 2020
commit b0cd504146f6cc9c8a51202f2dd6d0e0b463fa55
@@ -1,3 +1,14 @@
"""
Basic reader for libfuzzer/AFL style dictionaries.
See documentation at:
https://llvm.org/docs/LibFuzzer.html#dictionaries
https://github.com/google/AFL/blob/master/dictionaries/README.dictionaries
For our use, we only support reading the content of the dictionary values.
"""

import codecs
import random
import re
import os
@@ -18,7 +29,10 @@ def __init__(self, dict_path=None):
continue
word = self.line_re.search(line)
if word:
_dict.add(word.group(1))
# Decode any escaped characters, giving us a bytes object
value = word.group(1)
(value, _) = codecs.escape_decode(value)
_dict.add(value)
self._dict = list(_dict)

def get_word(self):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.