/
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/envinfo.py
(6633B)
#! /usr/lib/rads/venv/bin/python3 '''Gather information about system environment''' import os import sys import json from argparse import ArgumentParser __maintainer__ = "Daniel K" __email__ = "danielk@inmotionhosting.com" __version__ = "0.1.1" __date__ = "2016-09-22" # Globals DATA = {"status": 'uninitiated', "version": __version__} class EnvInfoError(Exception): '''Custom error class for module.''' def __init__(self, message): '''Init with call to base constructor.''' super().__init__(message) def get_data(min_version=None, max_version=None): ''' Main function for module, used to acquire environment information. min_version - If set, require envinfo.py to have a version greater than min_version max_version - If set, require envinfo.py to have a version less than max_version Returns dictionary of environment information. Currently, the only guaranteed entries are 'type', 'platform', and 'users'. The following are the keys that which may be present: type - General type of environment. Can be 'cpanel' or 'unknown' platform - Operating system information web_server - Type of webserver. Currently only 'apache' users - List of users. Apache related keys: easyapache - Version of EasyApache if present apache_conf - Location of httpd.conf for Apache apache_domlogs - Location of Apache domlogs On error will throw EnvInfoError. ''' if min_version is not None and min_version > __version__: raise EnvInfoError( 'Minimum version {} is greater than current version {}'.format( min_version, __version__ ) ) if max_version is not None and max_version < __version__: raise EnvInfoError( 'Maximum version {} is less than current version {}'.format( max_version, __version__ ) ) if os.path.isdir('/var/cpanel'): DATA['type'] = 'cpanel' else: DATA['type'] = 'unknown' if os.path.isfile('/etc/apache2/conf/httpd.conf'): DATA['apache_conf'] = '/etc/apache2/conf/httpd.conf' DATA['apache_domlogs'] = '/var/log/apache2/domlogs' DATA['web_server'] = 'apache' if DATA['type'] == 'cpanel': DATA['easyapache'] = '4' elif os.path.isfile('/usr/local/apache/conf/httpd.conf'): DATA['apache_conf'] = '/usr/local/apache/conf/httpd.conf' DATA['apache_domlogs'] = '/usr/local/apache/domlogs' DATA['web_server'] = 'apache' if DATA['type'] == 'cpanel': DATA['easyapache'] = '3' user_list = [] if DATA['type'] == 'cpanel': user_list = os.listdir('/var/cpanel/users/') elif os.path.isfile('/etc/passwd'): # If we don't know how else to find users, look to /etc/passwd if os.path.exists('/etc/passwd'): with open('/etc/passwd', encoding='utf-8') as file_handle: try: for line in file_handle: uid = int(line.split(':')[2]) if 500 <= uid < 32000: user_list.append(line.split(':')[0]) except OSError as e: # Catch, and throw back IOErrors. raise EnvInfoError('Could not read from /etc/passwd') from e else: # No known way to find users raise EnvInfoError("Unable to make user list for server type.") DATA['users'] = user_list DATA['status'] = 'initiated' return DATA def parse_args(): ''' Parse command line arguments ''' parser = ArgumentParser(description=__doc__) output_group = parser.add_argument_group("Output options") output_type_group = output_group.add_mutually_exclusive_group() output_type_group.add_argument( "-e", "--environment", action='store_const', dest='output_type', const='env', help=( "Print general system environment information." "This is the defualt." ), ) output_type_group.add_argument( "-u", "--users", action='store_const', dest='output_type', const='users', help="Print list of users rather than general environment.", ) output_type_group.add_argument( "--apache-conf", action='store_const', dest='output_type', const='apache_conf', help="Print location of Apache's httpd.conf.", ) output_group.add_argument( "-j", "--json", action='store_true', help="Print results in JSON" ) parser.add_argument( "-v", "-V", "--version", action='store_true', help="Print version information and exit.", ) args = parser.parse_args() if args.version: print(f"Environment Information tool version {__version__}") print(f"Last modified on {__date__}.") sys.exit(0) return (args.output_type, args.json) def main(): '''Function to be called when run from the command line''' (output_type, use_json) = parse_args() try: data = get_data() except EnvInfoError as error: print("Error:") print(error) if output_type == 'users': users = data['users'] if use_json: print( json.dumps( users, sort_keys=True, indent=4, separators=(',', ': ') ) ) else: print("\n".join(users)) elif output_type == 'apache_conf': if 'apache_conf' not in data: sys.stderr.write('No Apache configuration found\n') sys.exit(255) print(data['apache_conf']) else: if use_json: print( json.dumps( data, sort_keys=True, indent=4, separators=(',', ': ') ) ) else: print() print("Server Environment") print() print("Server Type: {}".format(data['type'])) print( "OS: {}".format(" ".join(data['platform'])) ) print("Web Server: {}".format(data['web_server'])) print("Apache configuration: {}".format(data['apache_conf'])) print("Apache domain logs: {}".format(data['apache_domlogs'])) print() print("Users:") print(" ".join(data['users'])) print() if __name__ == "__main__": main()
Save
cmd:
run