Crypt0s / FakeDns

A regular-expression based python MITM DNS server with support for DNS Rebinding attacks
MIT License
547 stars 147 forks source link

Throws exception and exits upon parsing rule starting with wildcard #2

Closed NotActuallyTerry closed 9 years ago

NotActuallyTerry commented 9 years ago

I'm trying to set up FakeDns to use with LANcache, and whenever I try to add "*.cs.steampowered.com" as a rule, it throws this:

>> Parse rules...
>> cs.steampowered.com -> 192.168.1.33
Traceback (most recent call last):
  File "./fakedns.py", line 103, in <module>
    rules = ruleEngine(path)
  File "./fakedns.py", line 78, in __init__
    self.re_list.append([re.compile(splitrule[0]),splitrule[1]])
  File "/usr/lib/python2.7/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib/python2.7/re.py", line 244, in _compile
    raise error, v # invalid expression
sre_constants.error: nothing to repeat

Prepending with a hash (my horrible attempt at commenting out) seems to make it work fine.

Crypt0s commented 9 years ago

Ah, a simple fix!

If I remember correctly: The parser expects PCRE expressions, meaning you simply need to reverse the dot and the asterisk (dot being anything, asterisk being any number of times)

change your rule to look thusly: .*cs.steampowered.com