Hackfut Security File Manager
Current Path:
/opt/alt/python37/lib/python3.7/site-packages
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
📁
..
📁
Babel-2.9.1-py3.7.egg-info
📁
Jinja2-3.0.3-py3.7.egg-info
📁
Mako-1.1.0-py3.7.egg-info
📁
PyJWT-1.7.1-py3.7.egg-info
📄
PySocks-1.5.7-py3.7.egg-info
(322 B)
📁
__pycache__
📁
_distutils_hack
📁
aiosignal
📁
aiosignal-1.2.0a0-py3.7.egg-info
📁
alembic
📁
alembic-0.8.3-py3.7.egg-info
📁
async_timeout
📁
async_timeout-4.0.2-py3.7.egg-info
📁
attr
📁
attrs-17.4.0-py3.7.egg-info
📁
babel
📁
beautifulsoup4-4.5.1-py3.7.egg-info
📁
bs4
📁
certifi
📁
certifi-2018.4.16-py3.7.egg-info
📁
chardet
📁
chardet-3.0.4-py3.7.egg-info
📁
charset_normalizer
📁
charset_normalizer-2.0.12-py3.7.egg-info
📁
cl_dom_collector
📄
cl_proc_hidepid.py
(4.44 KB)
📁
clcommon
📁
clconfig
📁
clconfigure
📄
clcontrollib.py
(51.88 KB)
📁
cldashboard
📄
cldetectlib.py
(18.31 KB)
📄
cldiaglib.py
(47.53 KB)
📁
clevents
📄
clhooklib.py
(1.4 KB)
📄
cli_utils.py
(1.73 KB)
📁
cllicense
📄
cllicenselib.py
(8.03 KB)
📁
cllimits
📁
cllimits_validator
📁
cllimitslib_v2
📁
clpackages
📁
clquota
📁
clselect
📁
clselector
📁
clsentry
📄
clsetuplib.py
(4.32 KB)
📄
clsudo.py
(14.7 KB)
📁
clsummary
📁
clveconfig
📁
clwizard
📁
clwpos
📄
cpanel.py
(28.99 KB)
📁
cssselect
📁
cssselect-0.9.2-py3.7.egg-info
📁
distlib
📄
distlib-0.3.4-py3.7.egg-info
(1.13 KB)
📄
distutils-precedence.pth
(152 B)
📁
docopt-0.6.2-py3.7.egg-info
📄
docopt.py
(19.48 KB)
📄
editor.py
(2.49 KB)
📄
editor.pyc
(3.6 KB)
📄
editor.pyo
(3.6 KB)
📁
filelock
📁
filelock-0.0.0-py3.7.egg-info
📁
future
📁
future-0.17.0-py3.7.egg-info
📁
html5lib
📁
html5lib-1.0.1-py3.7.egg-info
📁
idna
📁
idna-2.5-py3.7.egg-info
📁
importlib_metadata
📁
importlib_metadata-0.0.0-py3.7.egg-info
📁
jinja2
📁
jsonschema
📁
jsonschema-3.2.0-py3.7.egg-info
📁
jwt
📁
libfuturize
📁
libpasteurize
📄
lve_stats-2.0-py3.7.egg-info
(185 B)
📁
lve_utils
📄
lveapi.py
(19.24 KB)
📄
lvectllib.py
(92.33 KB)
📁
lvemanager
📄
lvestat.py
(6.94 KB)
📁
lvestats
📁
mako
📁
nose
📁
nose-1.3.7-py3.7.egg-info
📁
past
📁
pip
📁
pip-20.2.4.dist-info
📁
pkg_resources
📁
platformdirs
📁
platformdirs-0.0.0-py3.7.egg-info
📁
prettytable-0.7.2-py3.7.egg-info
📄
prettytable.py
(52.93 KB)
📁
pyparsing-2.1.10-py3.7.egg-info
📄
pyparsing.py
(224.48 KB)
📁
python_editor-0.4-py3.7.egg-info
📁
pytz
📁
pytz-2017.2-py3.7.egg-info
📁
raven
📁
raven-6.3.0-py3.7.egg-info
📄
remove_ubc.py
(5.54 KB)
📁
requests
📁
requests-2.26.0-py3.7.egg-info
📁
schema-0.7.1-py3.7.egg-info
📄
schema.py
(28.51 KB)
📄
secureio.py
(16.98 KB)
📁
sentry_sdk
📁
sentry_sdk-0.19.4-py3.7.egg-info
📁
setuptools
📁
setuptools-58.3.0.dist-info
📁
six-1.15.0-py3.7.egg-info
📄
six.py
(33.36 KB)
📄
socks.py
(29.25 KB)
📄
sockshandler.py
(2.84 KB)
📁
svgwrite
📁
svgwrite-1.3.0-py3.7.egg-info
📁
typing_extensions-3.7.4.3-py3.7.egg-info
📄
typing_extensions.py
(81.76 KB)
📁
urllib3
📁
urllib3-1.26.6-py3.7.egg-info
📁
vendors_api
📁
virtualenv
📁
virtualenv-20.13.0-py3.7.egg-info
📁
webencodings
📁
webencodings-0.5.1-py3.7.egg-info
📁
wmt
📁
zipp-0.0.0-py3.7.egg-info
📄
zipp.py
(8.23 KB)
Editing: cl_proc_hidepid.py
# -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT # Module contains functions for remounting /proc with hidepid=2 option # see CAG-796 for details from __future__ import print_function from __future__ import absolute_import import subprocess from clcommon.cpapi import Feature, is_panel_feature_supported from clcommon.sysctl import SysCtlConf, SYSCTL_CL_CONF_FILE from clcommon.utils import grep, proc_can_see_other_uid_and_hidepid_synced def hidepid_found(): """ Search for line like "proc /proc proc defaults,hidepid=2,gid=clsupergid 0 0" in /etc/fstab Return True if /proc is mounted with hidepid option in /etc/fstab """ fstab = '/etc/fstab' try: with open(fstab, 'r') as f: for line in f: line = line.strip() if line and not line.startswith('#'): splitted_line = line.split() if splitted_line and splitted_line[0] == 'proc' and 'hidepid=' in splitted_line[3]: return True except (IOError, IndexError) as e: print('Error: failed to parse', fstab, ':', str(e)) return False def execute(cmd, verbose): if verbose: print('executing', ' '.join(cmd)) return subprocess.call(cmd) def remount_proc(verbose=False): """ Remount /proc with hidepid=2 option when needed """ # In latest versions of the kernel on CL8 # no need to remount /proc with hidepid option # because it is synchronized with fs.proc_can_see_other_uid option if proc_can_see_other_uid_and_hidepid_synced(): return if not is_panel_feature_supported(Feature.LVE): if verbose: print('environment without LVE detected - remounting /proc is skipped') return sysctl = SysCtlConf(config_file=SYSCTL_CL_CONF_FILE) if verbose: print('apply sysctl settings') if hidepid_found(): # admin can override hidepid option via /etc/fstab if verbose: print('hidepid option is found in /etc/fstab - remounting /proc with options from /etc/fstab') return execute(['/bin/mount', '-o', 'remount', '/proc'], verbose) proc_can_see_other_uid = sysctl.get('fs.proc_can_see_other_uid') super_gid = sysctl.get('fs.proc_super_gid') if proc_can_see_other_uid != '0': if verbose: print('virtualized procfs feature is not enabled in sysctl conf - disable hidepid') return execute(['/bin/mount', '-o', 'remount,hidepid=0,gid=0', '/proc'], verbose) if verbose: print('enable hidepid for /proc') return execute(['/bin/mount', '-o', 'remount,hidepid=2,gid='+super_gid, '/proc'], verbose) def get_gid_from_mounts(): """ Retrieve hidepid gid from /proc/mounts :return: gid, 0 if absent """ lines_gen = grep(',hidepid=', '/proc/mounts') gid_prefix = ',gid=' try: for line in lines_gen: line = line.strip() if gid_prefix not in line: continue # Search gid=xxxx in line pos = line.find(gid_prefix) if pos == -1: continue pos += 5 line = line[pos:] pos = line.find(',') if pos != -1: line = line[:pos] else: pos = line.find(' ') if pos != -1: line = line[:pos] else: # Invalid or unsupported proc format return -1 return int(line) except (IOError, IndexError, ValueError): pass # hidepid not found in /proc/mounts return -1 def get_hidepid_typing_from_mounts() -> int: """ Retrieve hidepid value from /proc/mounts :return: hidepid, 0 is absent """ mounts_path = '/proc/mounts' hidepid_prefix = 'hidepid=' try: # Parse mounts file output for proc lines and get the hidepid with open(mounts_path, mode='r') as file: for line in file: if (not line.strip().startswith('proc /proc') or hidepid_prefix not in line): continue pos = line.find(hidepid_prefix) + len(hidepid_prefix) return int(line[pos]) except (OSError, IOError, IndexError, ValueError): pass # hidepid not found in /proc/mounts return 0
Upload File
Create Folder