Skip to content
Snippets Groups Projects
Commit ba852cbc authored by ulif's avatar ulif
Browse files

Fix refine_wordlist_entry: strip dash-esceptd entries.

Make sure signed entries are stripped also if dash-escaped.
parent e2d9a988
No related branches found
No related tags found
No related merge requests found
......@@ -64,9 +64,9 @@ def refine_wordlist_entry(entry, signed=False):
Set `signed` to `True` if the entry is part of a cryptographically
signed wordlist.
"""
entry = entry.strip()
if signed and entry.startswith('- '):
entry = entry[2:]
entry = entry.strip()
match = RE_NUMBERED_WORDLIST_ENTRY.match(entry)
if match:
entry = match.groups()[0]
......
......@@ -181,3 +181,11 @@ class TestWordlistModule(object):
# we handle dash-escaped lines correctly when in signed mode
assert refine_wordlist_entry("- foo") == "- foo"
assert refine_wordlist_entry("- foo", signed=True) == "foo"
def test_refine_wordlist_strips_also_dash_quoted(self):
# also dash-escaped lines in signed wordlistgs are stripped.
assert refine_wordlist_entry("- \tfoo\n", signed=True) == "foo"
def test_refine_wordlist_strips_also_numbered(self):
# also numbered entries are stripped
assert refine_wordlist_entry("11111 \t foo\n") == "foo"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment