CookieCollector
class · namespace z3n7 · source Browser/CookieCollector.cs
public class CookieCollector
Collects cookies by visiting sites over plain HTTP (not the browser), starting from an existing cookie set, and returns them as browser-extension style JSON.
Properties
Accept
public string Accept { get; set; }
Accept header of the requests.
AcceptLanguage
public string AcceptLanguage { get; set; }
Accept-Language header of the requests.
AllowRedirects
public bool AllowRedirects { get; set; }
Follow redirects (up to 10).
Log
public Action<string> Log { get; set; }
Receives COOKIES={count} at the end of Run; null for none.
MaxCookieAgeDays
public int MaxCookieAgeDays { get; set; }
Upper bound of the made-up age of new cookies, days.
MaxLastAccessAgeDays
public int MaxLastAccessAgeDays { get; set; }
Made-up last-access dates of new cookies fall within this many days before now.
MinCookieAgeDays
public int MinCookieAgeDays { get; set; }
Lower bound of the made-up age of new cookies, days.
TimeoutSeconds
public int TimeoutSeconds { get; set; }
Timeout of each request, seconds.
UserAgent
public string UserAgent { get; set; }
User-Agent header of the requests.
Methods
Run
public string Run(IEnumerable<string> services, string cookiesJson, string proxy = null)
Loads cookiesJson, sends a GET to each service and saves every cookie of the involved domains. A service that times out or fails is skipped. Cookies without creationDate get random creation and last-access dates within the configured ages.
| Parameter | Description |
|---|---|
services |
URLs or host names; https:// is added when missing. |
cookiesJson |
Starting cookies: JSON array with name, value, domain, path, secure, httpOnly, expirationDate and optional creationDate/lastAccessDate. |
proxy |
[scheme://][user:pass@]host:port; empty for none. |
Returns: JSON array of cookies in the same format.