commit cd8fc23f5caea88d6081122915da44d173ac9779 Author: Daniel Dayley Date: Mon Mar 11 14:36:13 2019 -0600 Initial Commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..80eeb3b --- /dev/null +++ b/README.md @@ -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. + diff --git a/grab_cookie.js b/grab_cookie.js new file mode 100644 index 0000000..08443fc --- /dev/null +++ b/grab_cookie.js @@ -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(); diff --git a/images/.DS_Store b/images/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/images/.DS_Store differ diff --git a/images/cookie_128.png b/images/cookie_128.png new file mode 100644 index 0000000..3b2cc66 Binary files /dev/null and b/images/cookie_128.png differ diff --git a/images/cookie_16.png b/images/cookie_16.png new file mode 100644 index 0000000..4705876 Binary files /dev/null and b/images/cookie_16.png differ diff --git a/images/cookie_32.png b/images/cookie_32.png new file mode 100644 index 0000000..0eb798c Binary files /dev/null and b/images/cookie_32.png differ diff --git a/images/cookie_48.png b/images/cookie_48.png new file mode 100644 index 0000000..1bdf665 Binary files /dev/null and b/images/cookie_48.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..e384974 --- /dev/null +++ b/manifest.json @@ -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 +} diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..c875244 --- /dev/null +++ b/popup.html @@ -0,0 +1,5 @@ + + + +

Cookies exported!

+