mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
Add blacklist and whitelist logic.
This commit is contained in:
parent
27d245625c
commit
40f3906115
3 changed files with 61 additions and 39 deletions
|
@ -41,6 +41,24 @@ type DNSProxy struct {
|
|||
tag string
|
||||
}
|
||||
|
||||
func (p *DNSProxy) shouldProxy(clientIP string) bool {
|
||||
// check if this client is in the whitelist
|
||||
for _, ip := range p.Whitelist {
|
||||
if clientIP == ip {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// check if this client is in the blacklist
|
||||
for _, ip := range p.Blacklist {
|
||||
if clientIP == ip {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (p *DNSProxy) Configure(address string, dnsPort int, doRedirect bool, nameserver string, netProtocol string, proxyPort int, scriptPath string, certFile string, keyFile string) error {
|
||||
var err error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue