/
opt
/
dedrads
/
/opt/dedrads
mkdir
upload
Name
Size
Mode
Actions
account_review/
-
0555
rm
check_software_mods/
-
0555
rm
cms_tools/
-
0555
rm
etc/
-
0555
rm
extras/
-
0555
rm
mailparse/
-
0555
rm
mysql/
-
0555
rm
nlp_scripts/
-
0555
rm
oldrads/
-
0555
rm
perl/
-
0555
rm
provision/
-
0555
rm
python/
-
0555
rm
suspended/
-
0555
rm
__pycache__/
-
0555
rm
account-review
799
0555
edit
dl
rm
allfw
6259
0555
edit
dl
rm
alp.py
16553
0555
edit
dl
rm
autossl_sync
6267
0555
edit
dl
rm
check_apache
9205
0555
edit
dl
rm
check_bandwidth
4546
0555
edit
dl
rm
check_boxtrapper
1684
0555
edit
dl
rm
check_cpu
12212
0555
edit
dl
rm
check_crons
1827
0555
edit
dl
rm
check_dcpumon
1973
0555
edit
dl
rm
check_dns
1827
0555
edit
dl
rm
check_domlogs
61
0555
edit
dl
rm
check_exim
3731
0555
edit
dl
rm
check_hacks
22604
0555
edit
dl
rm
check_imap
5249
0555
edit
dl
rm
check_io
6635
0555
edit
dl
rm
check_max_children
16341
0555
edit
dl
rm
check_mem
1660
0555
edit
dl
rm
check_misc
1510
0555
edit
dl
rm
check_pacct
5201
0555
edit
dl
rm
check_php
4344
0555
edit
dl
rm
check_pop3
2295
0555
edit
dl
rm
check_prov.py
4714
0555
edit
dl
rm
check_server
696
0555
edit
dl
rm
check_size
490
0555
edit
dl
rm
check_software
9849
0555
edit
dl
rm
check_spamd
2426
0555
edit
dl
rm
check_traffic
1933
0555
edit
dl
rm
check_user
1887
0555
edit
dl
rm
clean_exim.py
6390
0555
edit
dl
rm
clusterfix
5343
0555
edit
dl
rm
cmspass.py
3970
0555
edit
dl
rm
cms_check.py
9825
0555
edit
dl
rm
cms_counter.py
36734
0555
edit
dl
rm
cms_creds
713
0555
edit
dl
rm
cms_dumpdb
4485
0555
edit
dl
rm
cms_pw
1416
0555
edit
dl
rm
cpanel-api
7040
0555
edit
dl
rm
cpanel_postgres_manager.py
29004
0555
edit
dl
rm
cpmerge
4631
0555
edit
dl
rm
cpumon
2195
0555
edit
dl
rm
dcpumon.pl
1239
0555
edit
dl
rm
dedcheck
18127
0555
edit
dl
rm
dns-sync
14386
0555
edit
dl
rm
docroot.py
4425
0555
edit
dl
rm
du-tree
7450
0555
edit
dl
rm
envinfo.py
6633
0555
edit
dl
rm
exclude_rbl.py
5249
0555
edit
dl
rm
extract-vhost
2691
0555
edit
dl
rm
filescan
3566
0555
edit
dl
rm
find_warez
1460
0555
edit
dl
rm
first_setup.py
19120
0555
edit
dl
rm
fixwpcron.py
4822
0555
edit
dl
rm
fix_dns_cluster
353
0555
edit
dl
rm
goaccess
1217720
0555
edit
dl
rm
hostsfilemods
4467
0555
edit
dl
rm
imap_io
2323
0555
edit
dl
rm
innodb_converter.py
9343
0555
edit
dl
rm
killall911
530
0555
edit
dl
rm
killdns
941
0555
edit
dl
rm
lastcommcache.sh
1374
0555
edit
dl
rm
legal_lock_down.sh
7450
0555
edit
dl
rm
lil-cpanel
52002
0555
edit
dl
rm
listacct
4575
0555
edit
dl
rm
mailscan
4544
0555
edit
dl
rm
mail_sources.py
7407
0555
edit
dl
rm
megaclisas-status
38664
0555
edit
dl
rm
migrate2central.sh
14418
0555
edit
dl
rm
modify-account
40631
0555
edit
dl
rm
modsec_disable.py
11461
0555
edit
dl
rm
monarxctl
8912
0555
edit
dl
rm
msp.pl
27714
0555
edit
dl
rm
mysql_dstat
474
0555
edit
dl
rm
mysql_selector.py
73102
0555
edit
dl
rm
nlp
4582
0555
edit
dl
rm
procscrape
1863
0555
edit
dl
rm
quarantine
11083
0555
edit
dl
rm
radsfunctions.sh
863
0555
edit
dl
rm
recent-cp
16148
0555
edit
dl
rm
remote_dump
18347
0555
edit
dl
rm
reset_cpanel
3205
0555
edit
dl
rm
server-load
2192
0555
edit
dl
rm
show-conns
20105
0555
edit
dl
rm
show-conns-adv.py
54667
0555
edit
dl
rm
sparta.py
382498
0555
edit
dl
rm
sqltop
27129
0555
edit
dl
rm
telcheck
2411
0555
edit
dl
rm
temprootreset
186
0555
edit
dl
rm
unsuspend_user
1307
0555
edit
dl
rm
unsusprunner.sh
1840
0555
edit
dl
rm
updatednsadmin
526
0555
edit
dl
rm
update_spf
14972
0555
edit
dl
rm
upgrade-check
9216
0555
edit
dl
rm
vhost_data.py
6221
0555
edit
dl
rm
wp-xray.sh
85816
0555
edit
dl
rm
Edit:
/opt/dedrads/cms_dumpdb
(4485B)
#! /usr/lib/rads/venv/bin/python3 """Display database credentials for CMS in path.""" # Author: Daniel K import sys import logging from argparse import ArgumentParser from rads import setup_logging from rads.color import yellow, red, green from cms_tools.cms import CMSFind from cms_tools.cms import CMSStatus from cms_tools.cms import load_modules from cms_tools.helpers import dump_db from cms_tools.common import find_start_path LOGGER = logging.getLogger(__name__) def parse_args(): """Parse command line arguments""" parser = ArgumentParser(description=__doc__) # fmt: off parser.add_argument( "-m", "--modules", metavar='MODULE', nargs='+', help="Search only for specified modules.", ) parser.add_argument( "-l", "--list", action='store_true', help="List available modules and quit.", ) parser.add_argument( "-d", "--depth", action='store', type=int, default=0, help="Set the maximum depth to search. " "The default is 1 if path is set, or 8 otherwise.", ) output_group = parser.add_mutually_exclusive_group() output_group.add_argument( '-v', '--verbose', dest='loglevel', action='store_const', const='debug', help="Use verbose logging.", ) output_group.add_argument( '-q', '--quiet', dest='loglevel', action='store_const', const='critical', help='Log only critical errors', ) output_group.add_argument( '--loglevel', dest='loglevel', choices=['error', 'info', 'debug', 'warning', 'critical'], help="Specify the verbosity of logging output. " "The default is 'warning'.", ) parser.add_argument( "-o", "--output", help="Output logging to the specified file." ) parser.add_argument( "-p", "--dumppath", help="Path to dump databases." ) parser.add_argument( 'user_path', metavar='(USER|PATH)', nargs='?', help="cPanel user. Path must be in this user's home directory, " "and cannot be a relative path.", ) # fmt: on args = parser.parse_args() if args.loglevel is None: logging_level = logging.WARNING else: logging_level: int = getattr(logging, args.loglevel.upper()) if args.output: setup_logging(path=args.output, loglevel=logging_level, print_out=False) else: setup_logging( path='/var/log/messages', loglevel=logging_level, print_out=sys.stderr, ) if args.list: cms_search = CMSFind('List modules', 0) modules_list = load_modules(cms_search, args.modules) print("Available modules: %s" % ', '.join(modules_list)) sys.exit(0) path = find_start_path(args.user_path) if path is None: sys.exit(1) if args.depth == 0: if '/' in args.user_path: depth = 1 else: depth = 8 else: depth = args.depth return depth, path, args.modules, args.dumppath def main(): """Main function for script""" max_depth, start_path, include_modules, dumppath = parse_args() cms_search = CMSFind(start_path, max_depth, 0) load_modules(cms_search, include_modules) LOGGER.debug("Starting path: %s, Maxumim depth: %d", start_path, max_depth) failed_cms = [] failed_dbs = [] dumped_dbs = {} for the_cms in cms_search.find_cms(): if the_cms.status >= CMSStatus.db_is_set: dump_file = dump_db( dbuser=the_cms.db_user, password=the_cms.db_pass, dbname=the_cms.db_name, dump_path=dumppath or the_cms.directory_root, ) if dump_file: dumped_dbs[the_cms.db_name] = dump_file else: failed_dbs.append(the_cms.db_name) else: failed_cms.append(the_cms.directory_root) print(yellow(" === Summary ===")) if failed_cms: print("\nFailed to find credentials for the follwoing CMS:") for docroot in failed_cms: print(red(docroot)) if failed_dbs: print("\nFailed to export the following databases:") for database in failed_dbs: print(red(database)) if dumped_dbs: print("\nSuccessful database dumps:") for database, file in dumped_dbs.items(): print(green(f"{database} {file}")) if __name__ == "__main__": main()
Save
cmd:
run