-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcmds_webtools.py
36 lines (29 loc) · 1.01 KB
/
cmds_webtools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
from oldezpykitext.appkit import *
from oldezpykitext.extlib.termcolor import *
from oldezpykitext.webclient import *
apr = argparse.ArgumentParserWrapper()
def main():
logging.init_root(fmt=logging.FMT_MESSAGE_ONLY)
apr.parse()
apr.run()
@apr.sub(aliases=['get-cookies', 'getck'])
@apr.opt('s', 'src')
@apr.opt('d', 'dst')
@apr.true('v', 'verbose')
@apr.map('src', 'dst', verbose='verbose')
def get_netscape_cookies(src, dst, verbose=False):
"""get netscape format cookies, from src to dst"""
if verbose:
logging.set_root_level('INFO')
lg = logging.get_logger(__name__, get_netscape_cookies.__name__)
src = get_from_source(src)
lg.info(colored(str(src), 'grey', 'on_white', ['bold']))
cj = cookie.EzCookieJar()
cj_kw = dict(ignore_expires=True, ignore_discard=True)
cj.smart_load(src, **cj_kw)
r = cj.get_netscape_text(**cj_kw)
lg.info(colored(str(r), 'grey', None, ['bold']))
give_to_sink(r, dst)
if __name__ == '__main__':
main()