Skip to content

Commit

Permalink
Small bug fix related to rules param
Browse files Browse the repository at this point in the history
  • Loading branch information
drk1wi committed Jun 6, 2019
1 parent c4e16ed commit fc63cd5
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
5 changes: 3 additions & 2 deletions config/config.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type Options struct {
LogPostOnly *bool `json:"logPostOnly"` LogPostOnly *bool `json:"logPostOnly"`
DisableSecurity *bool `json:"disableSecurity"` DisableSecurity *bool `json:"disableSecurity"`
DynamicMode *bool `json:"dynamicMode"` DynamicMode *bool `json:"dynamicMode"`
LogFile *string `json:"log"` LogRequestFile *string `json:"log"`
Plugins *string `json:"plugins"` Plugins *string `json:"plugins"`
*TLSConfig *TLSConfig
} }
Expand Down Expand Up @@ -80,7 +80,8 @@ var (
ForceHTTP: flag.Bool("forceHTTP", false, "Strip all TLS from the traffic and proxy through HTTP only"), ForceHTTP: flag.Bool("forceHTTP", false, "Strip all TLS from the traffic and proxy through HTTP only"),
ForceHTTPS: flag.Bool("forceHTTPS", false, "Strip all clear-text from the traffic and proxy through HTTPS only"), ForceHTTPS: flag.Bool("forceHTTPS", false, "Strip all clear-text from the traffic and proxy through HTTPS only"),


LogFile: flag.String("log", "", "Local file to which fetched requests will be written (appended)"), LogRequestFile: flag.String("log", "", "Local file to which fetched requests will be written (appended)"),

LogPostOnly: flag.Bool("postOnly", false, "Log only HTTP POST requests"), LogPostOnly: flag.Bool("postOnly", false, "Log only HTTP POST requests"),


Plugins: flag.String("plugins", "all", "Comma separated list of enabled plugin names"), Plugins: flag.String("plugins", "all", "Comma separated list of enabled plugin names"),
Expand Down
3 changes: 2 additions & 1 deletion log/log.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ var (
type LoggingOptions struct { type LoggingOptions struct {
GET bool GET bool
POST bool POST bool
FilePath string LogRequestPath string

} }


func Wrap(s, effect string) string { func Wrap(s, effect string) string {
Expand Down
15 changes: 8 additions & 7 deletions log/util.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ func FunctionTracking(start time.Time, name string) {
} }
} }


func toFile(data string) { func LogRequestFile(data string) {


if Options.FilePath != "" { if Options.LogRequestPath != "" {
if file == nil { if file == nil {
file, _ = os.OpenFile(Options.FilePath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) file, _ = os.OpenFile(Options.LogRequestPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)


} }


Expand All @@ -49,11 +49,12 @@ func toFile(data string) {


} }



func Cookies(userID string, URL string, cookies []string, IP string) { func Cookies(userID string, URL string, cookies []string, IP string) {


cookieString := strings.Join(cookies, "####") cookieString := strings.Join(cookies, "####")


toFile("\nCOOKIES" + LogRequestFile("\nCOOKIES" +
"\n======\nTimestamp: " + time.Now().Format(time.RFC850) + "\n======\nTimestamp: " + time.Now().Format(time.RFC850) +
"\n======\nRemoteIP: " + IP + "\n======\nRemoteIP: " + IP +
"\n======\nUUID: " + userID + "\n======\nUUID: " + userID +
Expand All @@ -63,7 +64,7 @@ func Cookies(userID string, URL string, cookies []string, IP string) {


} }


func HTTPRequest(req *http.Request, phishUser string) { func HTTPRequest(req *http.Request, userID string) {


if Options.POST && req.Method != "POST" { if Options.POST && req.Method != "POST" {
return return
Expand All @@ -75,10 +76,10 @@ func HTTPRequest(req *http.Request, phishUser string) {
Errorf("Error dumping request: %s", err) Errorf("Error dumping request: %s", err)
} }


toFile("\nREQUEST" + LogRequestFile("\nREQUEST" +
"\n======\nTimestamp: " + time.Now().Format(time.RFC850) + "\n======\nTimestamp: " + time.Now().Format(time.RFC850) +
"\n======\nRemoteIP: " + req.RemoteAddr + "\n======\nRemoteIP: " + req.RemoteAddr +
"\n======\nUUID: " + phishUser + "\n======\nUUID: " + userID +
"\n======\n" + string(requestDump) + "\n======\n" + string(requestDump) +
"\n======\n") "\n======\n")


Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ func (c *Configuration) initLogging() {
log.Options = log.LoggingOptions{ log.Options = log.LoggingOptions{
GET: logGET, GET: logGET,
POST: *c.LogPostOnly, POST: *c.LogPostOnly,
FilePath: *c.LogFile, LogRequestPath: *c.LogRequestFile,

} }
} }


Expand Down
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func TestCmdLineFlags(t *testing.T) {
"TargetRules": "eHh4:eXl5", //xxx:yyy "TargetRules": "eHh4:eXl5", //xxx:yyy
"TrackingCookie": "id", "TrackingCookie": "id",
"TrackingParam": "id", "TrackingParam": "id",
"LogFile": "logfile", "LogRequestFile": "logfile",
"Plugins": "plugin1,plugin2,plugin2", "Plugins": "plugin1,plugin2,plugin2",
} }


Expand All @@ -235,7 +235,7 @@ func TestCmdLineFlags(t *testing.T) {
" -rules " + in["TargetRules"] + " -rules " + in["TargetRules"] +
" -trackingCookie " + in["TrackingCookie"] + " -trackingCookie " + in["TrackingCookie"] +
" -trackingParam " + in["TrackingParam"] + " -trackingParam " + in["TrackingParam"] +
" -log " + in["LogFile"] + " -log " + in["LogRequestFile"] +
" -plugins " + in["Plugins"] " -plugins " + in["Plugins"]


if in_bool["Debug"] { if in_bool["Debug"] {
Expand Down Expand Up @@ -386,7 +386,7 @@ func TestJSONConfig(t *testing.T) {
"TargetRules": "eHh4:eXl5", //xxx:yyy "TargetRules": "eHh4:eXl5", //xxx:yyy
"TrackingCookie": "id", "TrackingCookie": "id",
"TrackingParam": "id", "TrackingParam": "id",
"LogFile": "logfile", "LogRequestFile": "logfile",
"Plugins": "plugin1,plugin2,plugin2", "Plugins": "plugin1,plugin2,plugin2",
"TLSCertificate": "-----BEGIN CERTIFICATE-----\nMIIDEDCCAfigAwIBAgIEKfekOzANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQKEwdB\nY21lIENvMB4XDTE4MTIwMjIwMTc1NloXDTI0MDUwNzE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exWtAvIJx8\nhl+lKUECgYEAu9sAdc0pbzmdTeNterIScCXnclpANW1jsfCQvOv3qWqvU0uBreyd\nhVW67M9XzMzn6baZ3jLi0RxmIkxnLwkfLUTpMcmQO+1WY77MkROXDBmDQ87sBIDP\nluG0g5iz09m0QIt8nFUAZlogqgUXoMsBTtNk/jY4jpdTSzoh1kUeZIw=\n-----END PRIVATE KEY-----\n",
Expand Down
2 changes: 1 addition & 1 deletion templates/google.com_gsuite.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"proxyAddress": "", "proxyAddress": "",
"target": "google.com", "target": "google.com",
"targetResources": "content.googleapis.com,www.gstatic.com,ssl.gstatic.com,ogs.google.com,accounts.google.com,clients1.google.com,clients2.google.com,clients3.google.com,clients4.google.com,clients5.google.com,clients6.google.com", "targetResources": "content.googleapis.com,www.gstatic.com,ssl.gstatic.com,ogs.google.com,accounts.google.com,clients1.google.com,clients2.google.com,clients3.google.com,clients4.google.com,clients5.google.com,clients6.google.com",
"targetRules": "", "rules": "",
"terminateTriggers": "", "terminateTriggers": "",
"terminateRedirectUrl": "", "terminateRedirectUrl": "",
"trackingCookie": "ident", "trackingCookie": "ident",
Expand Down
2 changes: 1 addition & 1 deletion templates/office365.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"proxyAddress": "", "proxyAddress": "",
"target": "microsoftonline.com", "target": "microsoftonline.com",
"targetResources": "", "targetResources": "",
"targetRules": "by5zZXRBdHRyaWJ1dGUoImludGVncml0eSI=:by5zZXRBdHRyaWJ1dGUoImludGVnZHJpdHki,aW50ZWdyaXR5PQ==:aW50ZWdyaWN0eT0=,PC9oZWFkPg==:", "rules": "by5zZXRBdHRyaWJ1dGUoImludGVncml0eSI=:by5zZXRBdHRyaWJ1dGUoImludGVnZHJpdHki,aW50ZWdyaXR5PQ==:aW50ZWdyaWN0eT0=,PC9oZWFkPg==:",
"terminateTriggers": "", "terminateTriggers": "",
"terminateRedirectUrl": "", "terminateRedirectUrl": "",
"trackingCookie": "id", "trackingCookie": "id",
Expand Down

0 comments on commit fc63cd5

Please sign in to comment.