Skip to content

Commit

Permalink
Fix python2 configparser issue
Browse files Browse the repository at this point in the history
Some python2 installs do not have `read_file` on their RawConfigParser
  • Loading branch information
nathan-muir committed Mar 13, 2019
1 parent ca49f10 commit 5d113f9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion credsmash/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def parse_manifest(source, format):
def parse_config(fp):
config = {}
cp = configparser.RawConfigParser()
cp.read_file(fp)
if hasattr(cp, 'read_file'):
cp.read_file(fp)
else:
cp.readfp(fp)
for section in cp.sections():
config[section] = {}
for option in cp.options(section):
Expand Down

0 comments on commit 5d113f9

Please sign in to comment.