Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
netscape-cookies
is a Python extension that simplifies the process of exporting Selenium WebDriver cookies into the Netscape HTTP Cookie format. This is useful when you need to use cookies in various tools that require the Netscape format.
To install netscape-cookies
, simply run:
pip install netscape-cookies
from netscape_cookies import save_cookies_to_file
from netscape_cookies import to_netscape_string
# Your Selenium WebDriver cookies
cookie_data = [
{
"domain": ".example.com",
"expiry": 1677649426,
"path": "/",
"secure": True,
"name": "cookie_name",
"value": "cookie_value"
}
]
file_path = "cookies.txt"
# Save cookies to file in Netscape format
save_cookies_to_file(cookie_data, file_path)
# Get cookies as String in Netscape format
to_netscape_string(cookie_data)
from selenium import webdriver
from selnet_cookies import save_cookies_to_file
from netscape_cookies import to_netscape_string
browser = webdriver.Firefox()
browser.get("https://www.example.com")
# Get cookies from Selenium WebDriver
cookie_data = browser.get_cookies()
file_path = "cookies.txt"
# Save cookies to file in Netscape format
save_cookies_to_file(cookie_data, file_path)
# Get cookies as String in Netscape format
to_netscape_string(cookie_data)
browser.quit()
netscape-cookies
provides the following functions:
to_netscape_string(cookie_data: List[Dict[str, Any]]) -> str
: Converts the given Selenium WebDriver cookie data into a Netscape HTTP Cookie formatted string.save_cookies_to_file(cookie_data: List[Dict[str, Any]], file_path: str) -> None
: Saves the given Selenium WebDriver cookie data to a file in the Netscape HTTP Cookie format.Contributions to netscape-cookies
are welcome!
netscape-cookies
is released under the MIT License.
FAQs
Convert Cookies to Netscape format
We found that netscape-cookies demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.