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; }

source

Accept header of the requests.

AcceptLanguage

public string AcceptLanguage { get; set; }

source

Accept-Language header of the requests.

AllowRedirects

public bool AllowRedirects { get; set; }

source

Follow redirects (up to 10).

Log

public Action<string> Log { get; set; }

source

Receives COOKIES={count} at the end of Run; null for none.

MaxCookieAgeDays

public int MaxCookieAgeDays { get; set; }

source

Upper bound of the made-up age of new cookies, days.

MaxLastAccessAgeDays

public int MaxLastAccessAgeDays { get; set; }

source

Made-up last-access dates of new cookies fall within this many days before now.

MinCookieAgeDays

public int MinCookieAgeDays { get; set; }

source

Lower bound of the made-up age of new cookies, days.

TimeoutSeconds

public int TimeoutSeconds { get; set; }

source

Timeout of each request, seconds.

UserAgent

public string UserAgent { get; set; }

source

User-Agent header of the requests.

Methods

Run

public string Run(IEnumerable<string> services, string cookiesJson, string proxy = null)

source

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.