Skip to content

Commit

Permalink
code and mod cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
kgretzky committed Mar 1, 2024
1 parent 3b0f5c9 commit e7a6866
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 67 deletions.
6 changes: 3 additions & 3 deletions core/http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ func NewHttpProxy(hostname string, port int, cfg *Config, crt_db *CertDb, db *da
// handle ip blacklist
from_ip := req.RemoteAddr
if strings.Contains(from_ip, ":") {
from_ip = strings.Split(from_ip, ":")[0]
from_ip = strings.SplitN(from_ip, ":", 2)[0]
}

if p.cfg.GetBlacklistMode() != "off" {
if p.bl.IsBlacklisted(from_ip) {
if p.bl.IsVerbose() {
Expand Down Expand Up @@ -186,8 +187,7 @@ func NewHttpProxy(hostname string, port int, cfg *Config, crt_db *CertDb, db *da
}

pl := p.getPhishletByPhishHost(req.Host)
parts := strings.SplitN(req.RemoteAddr, ":", 2)
remote_addr := parts[0]
remote_addr := from_ip

redir_re := regexp.MustCompile("^\\/s\\/([^\\/]*)")
js_inject_re := regexp.MustCompile("^\\/s\\/([^\\/]*)\\/([^\\/]*)")
Expand Down
8 changes: 4 additions & 4 deletions core/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func (t *Terminal) handleSessions(args []string) error {
s_found := false
for _, s := range sessions {
if s.Id == id {
pl, err := t.cfg.GetPhishlet(s.Phishlet)
_, err := t.cfg.GetPhishlet(s.Phishlet)
if err != nil {
log.Error("%v", err)
break
Expand Down Expand Up @@ -446,7 +446,7 @@ func (t *Terminal) handleSessions(args []string) error {
log.Printf("[ %s ]\n%s\n", lgreen.Sprint("tokens"), AsRows(tkeys, tvals))
}
if len(s.CookieTokens) > 0 {
json_tokens := t.cookieTokensToJSON(pl, s.CookieTokens)
json_tokens := t.cookieTokensToJSON(s.CookieTokens)
log.Printf("[ %s ]\n%s\n\n", lyellow.Sprint("cookies"), json_tokens)
}
}
Expand Down Expand Up @@ -1215,7 +1215,7 @@ func (t *Terminal) createHelp() {
t.hlp = h
}

func (t *Terminal) cookieTokensToJSON(pl *Phishlet, tokens map[string]map[string]*database.CookieToken) string {
func (t *Terminal) cookieTokensToJSON(tokens map[string]map[string]*database.CookieToken) string {
type Cookie struct {
Path string `json:"path"`
Domain string `json:"domain"`
Expand Down Expand Up @@ -1259,7 +1259,7 @@ func (t *Terminal) cookieTokensToJSON(pl *Phishlet, tokens map[string]map[string
return string(json)
}

func (t *Terminal) tokensToJSON(pl *Phishlet, tokens map[string]string) string {
func (t *Terminal) tokensToJSON(tokens map[string]string) string {
var ret string
white := color.New(color.FgHiWhite)
for k, v := range tokens {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/mwitkow/go-http-dialer v0.0.0-20161116154839-378f744fb2b8
github.com/spf13/viper v1.10.1
github.com/tidwall/buntdb v1.1.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.21.0
)

Expand Down Expand Up @@ -42,9 +43,7 @@ require (
github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e // indirect
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/sys v0.17.0 // indirect
Expand Down
Loading

0 comments on commit e7a6866

Please sign in to comment.