Skip to content

Commit

Permalink
allow cookie to be set with --cookie. this should be passed around fo…
Browse files Browse the repository at this point in the history
…r the session. Won't work with RPC/HTTP for now
  • Loading branch information
Etienne Stalmans committed Dec 20, 2016
1 parent 8047f81 commit 318ca41
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ruler.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,27 @@ func connect(c *cli.Context) error {
if c.GlobalString("cookie") != "" {
//split into cookies and then into name : value
cookies := strings.Split(c.GlobalString("cookie"), ";")
cookieJarTmp := make([]*http.Cookie, len(cookies))
var cookieJarTmp []*http.Cookie
var cdomain string
//split and get the domain from the email
if eparts := strings.Split(c.GlobalString("email"), "@"); len(eparts) == 2 {
cdomain = eparts[1]
} else {
return fmt.Errorf("[x] Invalid email address")
}

for _, v := range cookies {
cookie := strings.Split(v, "=")
c := &http.Cookie{
Name: cookie[0],
Value: cookie[1],
Path: "/",
Domain: "outlook.com",
Domain: cdomain,
}
cookieJarTmp = append(cookieJarTmp, c)
}
config.CookieJar.SetCookies(&url.URL{Path: "outlook.com"}, cookieJarTmp)
u, _ := url.Parse(fmt.Sprintf("https://%s/", cdomain))
config.CookieJar.SetCookies(u, cookieJarTmp)
}

url := c.GlobalString("url")
Expand Down

0 comments on commit 318ca41

Please sign in to comment.