dns.spoof.hosts supports both wildcard (optional) based domain lines and hosts based entries.

if the ip is ommited in a line it defaults to the ip given in dns.spoof.address.

example hosts file contents:
*.example.
google.com 127.0.0.1
*.yahoo.*  127.0.0.2
This commit is contained in:
Moritz Wagner 2019-03-17 03:51:43 +01:00
commit 01ed35fa28
2 changed files with 3 additions and 4 deletions

View file

@ -109,7 +109,7 @@ func (mod *DNSSpoofer) Configure() error {
if hostsFile != "" {
mod.Info("loading hosts from file %s ...", hostsFile)
if err, hosts := HostsFromFile(hostsFile); err != nil {
if err, hosts := HostsFromFile(hostsFile, address); err != nil {
return fmt.Errorf("error reading hosts from file %s: %v", hostsFile, err)
} else {
mod.Hosts = append(mod.Hosts, hosts...)