├── LICENSE ├── curlc ├── __init__.py └── curlc.py ├── readme.md ├── requirements.txt ├── setup.cfg └── setup.py /LICENSE: -------------------------------------------------------------------------------- 1 | curlc - A small curl wrapper borrowing chrome's cookies 2 | Copyright (C) 2015 William Casarin 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -------------------------------------------------------------------------------- /curlc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jb55/curlc/40edc71fd9389bc0abec1fed300a8c556a27fef2/curlc/__init__.py -------------------------------------------------------------------------------- /curlc/curlc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from pycookiecheat import chrome_cookies 4 | import subprocess 5 | import sys 6 | import os 7 | 8 | def main(): 9 | if len(sys.argv) < 2: 10 | print("usage: curlc [url] ") 11 | sys.exit(1) 12 | 13 | curlargs = sys.argv[1:] 14 | for arg in curlargs: 15 | if arg[0] != '-': 16 | url = arg 17 | break 18 | 19 | browser = "chrome" 20 | if "BROWSER" in os.environ and os.environ["BROWSER"] == "chromium": 21 | browser = "chromium" 22 | chrome = chrome_cookies(url, browser=browser) 23 | 24 | cargs = [] 25 | carg = "cookie: " 26 | for k, v in chrome.items(): 27 | cargs.append(k + "=" + v) 28 | carg += "; ".join(cargs) 29 | 30 | args = ["curl", "-H", carg] 31 | args.extend(curlargs) 32 | subprocess.run(args) 33 | 34 | 35 | if __name__ == '__main__': 36 | main() 37 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | # curlc 3 | 4 | Wrapper around curl that uses chrome's cookie store 5 | 6 | ## Installation 7 | 8 | Install with pip3 9 | 10 | $ pip3 install curlc 11 | 12 | ## Example Usage 13 | 14 | $ curlc -L 'http://dropbox.com/secret-file' 15 | $ export BROWSER=chromium && curlc -L 'http://dropbox.com/secret-file' 16 | 17 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jb55/curlc/40edc71fd9389bc0abec1fed300a8c556a27fef2/requirements.txt -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | description-file = readme.md -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | version = '0.0.3' 4 | 5 | setup( 6 | name='curlc', 7 | version=version, 8 | packages = ['curlc'], 9 | description="curl wrapper to borrow cookies from your browser's authenticated session", 10 | author='William Casarin', 11 | author_email='bill@casarin.me', 12 | url='https://github.com/jb55/curlc', 13 | include_package_data=True, 14 | install_requires=[ "pycookiecheat >= 0.2.0" ], 15 | entry_points = {'console_scripts': ['curlc=curlc.curlc:main'] }, 16 | license="GPLv2", 17 | keywords='curlc', 18 | classifiers=[ 19 | 'Programming Language :: Python :: 3', 20 | 'Environment :: Console', 21 | 'Intended Audience :: Developers', 22 | 'Intended Audience :: System Administrators', 23 | 'Topic :: Internet :: WWW/HTTP', 24 | 'Topic :: Software Development', 25 | 'Topic :: System :: Networking', 26 | 'Topic :: Terminals', 27 | 'Topic :: Utilities' 28 | ], 29 | ) 30 | --------------------------------------------------------------------------------