HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //usr/lib/python2.7/site-packages/lap/lvsrs.py
#!/usr/bin/python
import struct
import socket
import sys
import yaml
import platform

def __run__(params):
    try:
        dist = platform.dist()
        if dist[0] == 'debian' and dist[1] < 7.0:
            net_route = open('/proc/net/route')
            ips = []
            for line in net_route.readlines():
                if 'lo' in line.split()[0]:
                    addr_long = int(line.split()[1],16)
                    ip = socket.inet_ntoa(struct.pack("<L", addr_long))
                    ips.append(ip)
            ips = [ip for ip in ips if not ip.startswith('127.0')]
            net_route.close()
        else:
            import netifaces
            addresses = [netifaces.ifaddresses(interface)[netifaces.AF_INET]
                            for interface in netifaces.interfaces()
                            if interface.startswith('lo') and
                            interface != 'lo']
            ips = [address[0]['addr'] for address in addresses]

        lvsrs_ips = params.get('vip_ips').split()
        a = lvsrs_ips
        b = ips
        ip_equal = False

        if len(a) == len(b):
            for i in a:
                if a.count(i) == b.count(i):
                    ip_equal = True
                else:
                    return [2,"CRITICAL %s IS DOWN" % (i)]
            if ip_equal:
                return [0,"OK - lvsrs is running"]
    except ImportError:
        return [2, "CRITICAL - Error: Please install python-netifaces"]
    except Exception, e:
        return [2, 'CRITICAL: {0}'.format(str(e))]