Initial Commit

This commit is contained in:
Daniel Dayley 2019-03-11 14:36:13 -06:00
commit cd8fc23f5c
9 changed files with 80 additions and 0 deletions

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Export Cookies
## Introduction
> Several CLI utilities such as `curl`, `wget` and `httrack` accept cookie files formatted as a Netscape cookie file. This chrome extension allows you to export Chrome's cookies as a Netscape cookie file.
## Installation
> * Download and extract the directory.
> * Navigate to **Settings** > **Extensions**.
> * Enable the option **Developer Mode** in the top right corner.
> * Click the newly revealed **Load Unpacked Extension** button.
> * Specify the directory you extracted the directory to.

38
grab_cookie.js Normal file
View File

@ -0,0 +1,38 @@
// document.getElementById("go").addEventListener("click", exportCookies());
// document.getElementById("go").addEventListener("mouseup", window.close());
// chrome.browserAction.onClicked.addListener(exportCookies());
function exportCookies() {
chrome.tabs.query({"status":"complete","windowId":chrome.windows.WINDOW_ID_CURRENT,"active":true}, function(tab){
chrome.cookies.getAll({
domain: undefined
}, function (cookies) {
domain = ""; flag = ""; path = "";
secure = ""; expiration = ""; name = ""
value = ""; tab="\t";
return_block= "# Netscape HTTP Cookie File\n# This file was generated by the export-cookies Google Chrome extension.\n";
for (var i = 0; i < cookies.length; i++) {
domain=cookies[i].domain;
cookies[i].sameSite == "strict" ? flag="FALSE":flag="TRUE";
cookies[i].secure ? secure="TRUE":secure="FALSE";
if (!cookies[i].expirationDate) {
expiration=Math.floor(Date.now() / 1000) + 600;
} else {
expiration=parseInt(cookies[i].expirationDate, 10)
};
name=cookies[i].name;
value = cookies[i].value;
line=domain + tab + flag + tab + path + tab + secure + tab + expiration + tab + name + tab + value + "\n";
return_block = return_block + line;
}
chrome.storage.local.get(null, function() {
url = 'data:application/json;base64,' + btoa(return_block);
chrome.downloads.download({
url: url,
filename: 'cookies.txt'
});
});
});
});
};
exportCookies();
// window.close();

BIN
images/.DS_Store vendored Normal file

Binary file not shown.

BIN
images/cookie_128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
images/cookie_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
images/cookie_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
images/cookie_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

23
manifest.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "Export Cookies",
"version": "1.0",
"description": "Exports all Chrome cookies to a Netscape cookie file.",
"browser_action": {
"default_title": "Export Cookies",
"default_popup": "popup.html"
},
"permissions": [
"cookies",
"downloads",
"storage",
"http://*/*",
"https://*/*"
],
"icons": {
"16": "images/cookie_16.png",
"32": "images/cookie_32.png",
"48": "images/cookie_48.png",
"128": "images/cookie_128.png"
},
"manifest_version": 2
}

5
popup.html Normal file
View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<script id = "go" src="grab_cookie.js"></script>
<p>Cookies exported!</p>
</html>