forked from kgretzky/evilginx2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
253 changed files
with
25,019 additions
and
87,055 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/bin/ | ||
/docs/ | ||
/img/ | ||
/release/ | ||
/build_run.bat | ||
bin/ | ||
docs/ | ||
img/ | ||
release/ | ||
build/ | ||
phishlets/test-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
#### PLEASE READ THE POSTING GUIDELINES AND ANSWER THE QUESTION BEFORE POSTING, OTHERWISE ISSUE WILL BE CLOSED AND MARKED AS INVALID | ||
#### DO NOT ASK FOR PHISHLETS. | ||
#### DO NOT ASK FOR HELP CREATING PHISHLETS. | ||
#### DO NOT ASK TO FIX PHISHLETS. | ||
#### DO NOT ADVERTISE OR TRY TO SELL PHISHLETS. | ||
|
||
* I hereby declare the following issue is a **[tool specific question/bug report]** and it is **NOT** a help request about creating a phishlet. | ||
* I am fully aware that this is not a customer support portal, I can't demand answers and I'm aware I am using a free tool. | ||
* I am not going to use Evilginx to hax my girlfriend's account or use it for any other illegal purpose. | ||
* I am not trying to set up a domain on FreeNOM (also read the sentence above again). | ||
* I am not a robot. | ||
*(Sorry, if you are an adult and a professional and you had to read this.)* | ||
|
||
Please type in "**I CONFIRM**" below if you confirm the sentences above or otherwise make some funny remark: | ||
|
||
*<type_in_here>* | ||
|
||
Thanks! | ||
-- | ||
#### EXPECT A BAN OTHERWISE. THANK YOU! | ||
|
||
#### REPORT ONLY BUGS OR FEATURE SUGGESTIONS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
package core | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"net" | ||
"os" | ||
"strings" | ||
|
||
"github.com/kgretzky/evilginx2/log" | ||
) | ||
|
||
const ( | ||
BLACKLIST_MODE_FULL = 0 | ||
BLACKLIST_MODE_UNAUTH = 1 | ||
BLACKLIST_MODE_OFF = 2 | ||
) | ||
|
||
type BlockIP struct { | ||
ipv4 net.IP | ||
mask *net.IPNet | ||
} | ||
|
||
type Blacklist struct { | ||
ips map[string]*BlockIP | ||
masks []*BlockIP | ||
configPath string | ||
mode int | ||
} | ||
|
||
func NewBlacklist(path string) (*Blacklist, error) { | ||
f, err := os.OpenFile(path, os.O_CREATE|os.O_RDONLY, 0644) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer f.Close() | ||
|
||
bl := &Blacklist{ | ||
ips: make(map[string]*BlockIP), | ||
configPath: path, | ||
mode: BLACKLIST_MODE_OFF, | ||
} | ||
|
||
fs := bufio.NewScanner(f) | ||
fs.Split(bufio.ScanLines) | ||
|
||
for fs.Scan() { | ||
l := fs.Text() | ||
// remove comments | ||
if n := strings.Index(l, ";"); n > -1 { | ||
l = l[:n] | ||
} | ||
l = strings.Trim(l, " ") | ||
|
||
if len(l) > 0 { | ||
if strings.Contains(l, "/") { | ||
ipv4, mask, err := net.ParseCIDR(l) | ||
if err == nil { | ||
bl.masks = append(bl.masks, &BlockIP{ipv4: ipv4, mask: mask}) | ||
} else { | ||
log.Error("blacklist: invalid ip/mask address: %s", l) | ||
} | ||
} else { | ||
ipv4 := net.ParseIP(l) | ||
if ipv4 != nil { | ||
bl.ips[ipv4.String()] = &BlockIP{ipv4: ipv4, mask: nil} | ||
} else { | ||
log.Error("blacklist: invalid ip address: %s", l) | ||
} | ||
} | ||
} | ||
} | ||
|
||
log.Info("blacklist: loaded %d ip addresses or ip masks", len(bl.ips)+len(bl.masks)) | ||
return bl, nil | ||
} | ||
|
||
func (bl *Blacklist) AddIP(ip string) error { | ||
if bl.IsBlacklisted(ip) { | ||
return nil | ||
} | ||
|
||
ipv4 := net.ParseIP(ip) | ||
if ipv4 != nil { | ||
bl.ips[ipv4.String()] = &BlockIP{ipv4: ipv4, mask: nil} | ||
} else { | ||
return fmt.Errorf("blacklist: invalid ip address: %s", ip) | ||
} | ||
|
||
// write to file | ||
f, err := os.OpenFile(bl.configPath, os.O_APPEND|os.O_WRONLY, 0644) | ||
if err != nil { | ||
return err | ||
} | ||
defer f.Close() | ||
|
||
_, err = f.WriteString(ipv4.String() + "\n") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (bl *Blacklist) IsBlacklisted(ip string) bool { | ||
ipv4 := net.ParseIP(ip) | ||
if ipv4 == nil { | ||
return false | ||
} | ||
|
||
if _, ok := bl.ips[ip]; ok { | ||
return true | ||
} | ||
for _, m := range bl.masks { | ||
if m.mask != nil && m.mask.Contains(ipv4) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
Oops, something went wrong.