OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
azurelinuxagent
/
common
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/14/2020 08:39:36 AM
rwxr-xr-x
📄
__init__.py
630 bytes
11/07/2019 12:36:56 AM
rw-r--r--
📁
__pycache__
-
10/14/2020 08:39:36 AM
rwxr-xr-x
📄
cgroup.py
8.6 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
cgroupapi.py
25.69 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
cgroupconfigurator.py
9.27 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
cgroupstelemetry.py
7.47 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
conf.py
11.08 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
datacontract.py
2.6 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
dhcp.py
14.58 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
errorstate.py
1.12 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
event.py
19.03 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
exception.py
6.38 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
future.py
3.08 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
logger.py
7.64 KB
11/07/2019 12:36:56 AM
rw-r--r--
📁
osutil
-
10/14/2020 08:39:36 AM
rwxr-xr-x
📁
protocol
-
10/14/2020 08:39:36 AM
rwxr-xr-x
📄
rdma.py
16.13 KB
11/07/2019 12:36:56 AM
rw-r--r--
📄
telemetryevent.py
1.52 KB
11/07/2019 12:36:56 AM
rw-r--r--
📁
utils
-
10/14/2020 08:39:36 AM
rwxr-xr-x
📄
version.py
7.36 KB
11/07/2019 12:36:56 AM
rw-r--r--
Editing: future.py
Close
import platform import sys import os import re # Note broken dependency handling to avoid potential backward # compatibility issues on different distributions try: import distro except Exception: pass """ Add alias for python2 and python3 libs and functions. """ if sys.version_info[0] == 3: import http.client as httpclient from urllib.parse import urlparse """Rename Python3 str to ustr""" ustr = str bytebuffer = memoryview elif sys.version_info[0] == 2: import httplib as httpclient from urlparse import urlparse """Rename Python2 unicode to ustr""" ustr = unicode bytebuffer = buffer else: raise ImportError("Unknown python version: {0}".format(sys.version_info)) def get_linux_distribution(get_full_name, supported_dists): """Abstract platform.linux_distribution() call which is deprecated as of Python 3.5 and removed in Python 3.7""" try: supported = platform._supported_dists + (supported_dists,) osinfo = list( platform.linux_distribution( full_distribution_name=get_full_name, supported_dists=supported ) ) # The platform.linux_distribution() lib has issue with detecting OpenWRT linux distribution. # Merge the following patch provided by OpenWRT as a temporary fix. if os.path.exists("/etc/openwrt_release"): osinfo = get_openwrt_platform() if not osinfo or osinfo == ['', '', '']: return get_linux_distribution_from_distro(get_full_name) full_name = platform.linux_distribution()[0].strip() osinfo.append(full_name) except AttributeError: return get_linux_distribution_from_distro(get_full_name) return osinfo def get_linux_distribution_from_distro(get_full_name): """Get the distribution information from the distro Python module.""" # If we get here we have to have the distro module, thus we do # not wrap the call in a try-except block as it would mask the problem # and result in a broken agent installation osinfo = list( distro.linux_distribution( full_distribution_name=get_full_name ) ) full_name = distro.linux_distribution()[0].strip() osinfo.append(full_name) return osinfo def get_openwrt_platform(): """ Add this workaround for detecting OpenWRT products because the version and product information is contained in the /etc/openwrt_release file. """ result = [None, None, None] openwrt_version = re.compile(r"^DISTRIB_RELEASE=['\"](\d+\.\d+.\d+)['\"]") openwrt_product = re.compile(r"^DISTRIB_ID=['\"]([\w-]+)['\"]") with open('/etc/openwrt_release', 'r') as fh: content = fh.readlines() for line in content: version_matches = openwrt_version.match(line) product_matches = openwrt_product.match(line) if version_matches: result[1] = version_matches.group(1) elif product_matches: if product_matches.group(1) == "OpenWrt": result[0] = "openwrt" return result