[-]
[+]
|
Changed |
_service:set_version:ix-inventory-system.spec
|
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/client/inventory-system.conf
^
|
@@ -24,4 +24,9 @@
#
CUSTOM_FUNCTIONS=""
#
-
+## Description: Disable listed functions (space separated)
+## Type: string
+## Default: ""
+#
+DISABLE_FUNCTIONS=""
+#
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/client/inventory-system.sh
^
|
@@ -1,8 +1,8 @@
#!/bin/bash
# Inventory System
# Author: Carsten Schoene
-# $LastChangedDate: 2012-08-12 12:42:39 +0200 (Sun, 12 Aug 2012) $
-# $Rev: 1694 $
+# $LastChangedDate: 2012-09-11 17:01:05 +0200 (Tue, 11 Sep 2012) $
+# $Rev: 1772 $
#
# Default options (can be changed by inventory-system.conf)
DEBUG="yes"
@@ -35,10 +35,14 @@
ip
rpm
ls
+df
date
modprobe
ipmitool
getopt
+readlink
+fdisk
+dmsetup
"
# clean old logfile
@@ -82,9 +86,11 @@
# script usage
function usage {
- echo "Usage: $0 [--help|--uuid|--systemtype|--serial|--cpu|--mem|--product|--arch|--os|--kernel|--mgmtmac|--mgmtip]"
+ echo "Usage: $0 [--help|--uuid|--all-disks|--disks|--systemtype|--serial|--cpu|--mem|--product|--arch|--os|--kernel|--mgmtmac|--mgmtip|--update]"
echo -e "\t--help\t\tShows this help"
echo -e "\t--uuid\t\tUUID of this system"
+ echo -e "\t--disk\t\tRoot disk size of this system"
+ echo -e "\t--all-disks\t\tAll disk devices with size"
echo -e "\t--systemtype\tSystem image type"
echo -e "\t--serial\tSystem serial number (Service Tag)"
echo -e "\t--cpu\t\tCPU type"
@@ -95,11 +101,12 @@
echo -e "\t--kernel\tRunning kernel version"
echo -e "\t--mgmtmac\tIPMI management MAC address"
echo -e "\t--mgmtip\tIPMI management IP address"
+ echo -e "\t--update\trun update of this script"
exit
}
RUN_FUNCTIONS=""
-args=`${GETOPT} -a -o h -l help,uuid,systemtype,serial,cpu,mem,product,arch,os,kernel,mgmtmac,mgmtip -- "$@"`
+args=`${GETOPT} -a -o h -l help,uuid,disk,all-disks,systemtype,serial,cpu,mem,product,arch,os,kernel,mgmtmac,mgmtip,update -- "$@"`
if [ $? != 0 ] ; then
usage
fi
@@ -114,6 +121,14 @@
RUN_FUNCTIONS="${RUN_FUNCTIONS} get_system_uuid"
shift
;;
+ -d|--disk)
+ RUN_FUNCTIONS="${RUN_FUNCTIONS} get_system_disk_size_bootdev"
+ shift
+ ;;
+ --all-disks)
+ RUN_FUNCTIONS="${RUN_FUNCTIONS} get_system_disk_sizes"
+ shift
+ ;;
-t|--systemtype)
RUN_FUNCTIONS="${RUN_FUNCTIONS} get_system_type"
shift
@@ -154,6 +169,10 @@
RUN_FUNCTIONS="${RUN_FUNCTIONS} get_system_mgmt_ip"
shift
;;
+ -u|--update)
+ RUN_FUNCTIONS="${RUN_FUNCTIONS} autoupdate"
+ shift
+ ;;
--)
shift
break
@@ -161,8 +180,42 @@
esac
done
+# function to check if called function is in DISABLE_FUNCTIONS
+function is_disabled {
+ FUNC_TO_CHECK=$1
+ RETVAL=0
+ for FUNC in ${DISABLE_FUNCTIONS} ; do
+ if [ "${FUNC}" == "${FUNC_TO_CHECK}" ] ; then
+ RETVAL=1
+ fi
+ done
+ echo ${RETVAL}
+}
+
+# autoupdate function
+function autoupdate {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
+ PKG=`rpm -qf --queryformat '%{name}\n' $0 | ${GREP} -v "^file /"`
+ YUM=`which yum 2>/dev/null`
+ ZYP=`which zypper 2>/dev/null`
+ if [ -n "${PKG}" ] ; then
+ if [ -n "${YUM}" ] ; then
+ CUPD="`${YUM} check-update ${PK} | ${TAIL} -n1 | ${AWK} '{print $1}'`"
+ if [ -n "${CUPD}" ] ; then
+ ${YUM} -q -y update ${PKG}
+ fi
+ elif [ -n "${ZYP}" ] ; then
+ CUPD="`${ZYP} -q lu | ${GREP} ${PKG}`"
+ if [ -n "${CUPD}" ] ; then
+ ${ZYP} -q -n update ${PKG}
+ fi
+ fi
+ fi
+}
+
# get unique system uuid
function get_system_uuid {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
# newer systems have uuid integrated
UUID=`${LSHW} -quiet -C system | ${GREP} "configuration:" | ${GREP} -i uuid | ${SED} -e 's@.*[ \s]uuid=@@i'`
# for older systems or virtual create one and save it for later use
@@ -179,6 +232,7 @@
# read serialnumber / service tag with dmidecode
function get_system_serial {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
SYSSERIAL=`${DMIDECODE} -s system-serial-number`
debug "SYSTEM-SERIAL: ${SYSSERIAL}"
echo ${SYSSERIAL}
@@ -186,12 +240,14 @@
# get list of MAC addresses from lshw
function get_system_macs {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
${LSHW} -quiet -C network | ${GREP} serial: | ${AWK} '{print tolower($NF)}' | ${SORT} -u | \
${GREP} -i -E '([0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2})'
}
# get interface name from MAC address
function get_iface_name_from_mac {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
MAC=${1}
debug ${MAC}
${IFCONFIG} -a | ${GREP} -i ${MAC} | ${AWK} '{print $1}' | ${HEAD} -n1
@@ -199,6 +255,7 @@
# get link state for interface from ethtool
function get_iface_link_state {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
IFACE=${1}
debug ${IFACE}
${ETHTOOL} ${IFACE} | ${GREP} -i "Link detected:" | ${AWK} '{print tolower($NF)}'
@@ -206,6 +263,7 @@
# get system type
function get_system_type {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
RETVAL=`${VIRTWHAT}`
if [ $? == 0 ] ; then
TYPE=`${VIRTWHAT} | ${TAIL} -n1`
@@ -221,6 +279,7 @@
# get system cpu type
function get_system_cpu {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
CPU=`${LSHW} -quiet -C processor | ${GREP} "product:" | ${SORT} -u | ${AWK} -F"product: " '{ print $NF}' | ${HEAD} -n1 | ${SED} -e 's@\s\+@ @g'`
debug "SYSTEM-CPU: ${CPU}"
echo ${CPU}
@@ -228,6 +287,7 @@
# get system memory in MB
function get_system_memory {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
INSTMEM=0
case `get_system_type` in
xen-domU|openvz)
@@ -244,8 +304,95 @@
echo ${INSTMEM}
}
+# get the disk size of boot device
+function get_system_disk_size_bootdev {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
+ case `get_system_type` in
+ openvz)
+ SIZE=`LANG=C ${DF} / | ${GREP} -v ^Filesystem| ${AWK} '{print $2 / 1024}'`
+ debug "SYSTEM-ROOTDEV-SIZE: ${SIZE}"
+ echo ${SIZE}
+ ;;
+ kvm)
+ ROOTDEV=`${READLINK} -f /dev/root`
+ if [ "${ROOTDEV}" == "/dev/root" ] ; then
+ # on kvm /dev/root is not always a symlink - ugly hack
+ MAJOR=`${DMSETUP} deps /dev/root | ${AWK} -F": " '{print $2}' | ${AWK} -F, '{print $1}' | ${SED} -e 's@(@@'`
+ DEV=`${LS} -al /dev/ | ${GREP} -E '(disk\s*${MAJOR},\s*0)' | ${AWK} '{print $NF}' | ${HEAD} -n1`
+ if [ -b /dev/${DEV} ] ; then
+ RD=/dev/${DEV}
+ else
+ # fallback to partition
+ RD=/dev/root
+ fi
+ else
+ RD=`echo ${ROOTDEV} | ${SED} -r 's@(/dev/x?[hsv]d[a-z]).*@\1@'`
+ fi
+ # / 1000 nicht / 1024 bei physikalischen Festplatten
+ SIZE=`LANG=C ${FDISK} -l ${RD} 2>/dev/null | ${GREP} "^Disk /" | ${AWK} '{print $(NF-1)/1000/1000 }'`
+ debug "SYSTEM-ROOT-DEV: ${RD}"
+ debug "SYSTEM-ROOTDEV-SIZE: ${SIZE}"
+ echo ${SIZE}
+ ;;
+ *)
+ ROOTDEV=`${READLINK} -f /dev/root`
+ # HP
+ HP_ROOTDISK=`echo ${ROOTDEV} | ${GREP} "/dev/cciss" | ${SED} -r 's@(/dev/cciss/c[0-9]d[0-9]).*@\1@'`
+ # linux software raid
+ MD_ROOTDISK=`echo ${ROOTDEV} | ${GREP} "/dev/md" | ${SED} -r 's@(/dev/md[0-9]).*@\1@'`
+ # linux lvm
+ LV_ROOTDISK=`echo ${ROOTDEV} | ${GREP} "/dev/dm-" | ${SED} -r 's@(/dev/dm-[0-9]).*@\1@'`
+ # block device
+ BL_ROOTDISK=`echo ${ROOTDEV} | ${SED} -r 's@(/dev/x?[hsv]d[a-z]).*@\1@'`
+ if [ -n "${HP_ROOTDISK}" ] ; then
+ # hp Raid
+ RD=${HP_ROOTDISK}
+ elif [ -n "${MD_ROOTDISK}" ] ; then
+ # linux software raid
+ RD=${MD_ROOTDISK}
+ elif [ -n "${LV_ROOTDISK}" ] ; then
+ # linux lvm
+ # on HP
+ HP_RD=`${LS} -1A /sys/block/${LV_ROOTDISK}/slaves/ 2>/dev/null | ${GREP} "/dev/cciss" | ${SED} -r 's@(/dev/cciss/c[0-9]d[0-9]).*@\1@'`
+ # on linux softraid
+ MD_RD=`${LS} -1A /sys/block/${LV_ROOTDISK}/slaves/ 2>/dev/null | ${GREP} "/dev/md" | ${SED} -r 's@(/dev/md[0-9]).*@\1@'`
+ # on block device
+ B_RD=`${LS} -1A /sys/block/${LV_ROOTDISK}/slaves/ 2>/dev/null | ${SED} -r 's@(/dev/x?[hsv]d[a-z]).*@\1@'`
+
+ if [ -n "${HP_RD}" ] ; then
+ # hp raid
+ RD=${HP_RD}
+ elif [ -n "${MD_RD}" ] ; then
+ # linux software raid
+ RD=${MD_RD}
+ else
+ # block device
+ RD=${B_RD}
+ fi
+ else
+ # linux block device
+ RD=${BL_ROOTDISK}
+ fi
+ # / 1000 nicht / 1024 bei physikalischen Festplatten
+ SIZE=`LANG=C ${FDISK} -l ${RD} 2>/dev/null | ${GREP} "^Disk /" | ${AWK} '{print int($(NF-1)/1000/1000) }'`
+ debug "SYSTEM-ROOT-DEV: ${RD}"
+ debug "SYSTEM-ROOTDEV-SIZE: ${SIZE}"
+ echo ${SIZE}
+ ;;
+ esac
+}
+
+# get all (v)disks with sizes
+function get_system_disk_sizes {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
+ DEV_SIZES=`LANG=C ${FDISK} -l 2>/dev/null | ${GREP} "^Disk /" | ${SORT} | ${AWK} '{print $2","int($(NF-1)/1000/1000)}' | ${SED} -e 's@:,@,@' | ${GREP} -E '(/dev/cciss/c[0-9]d[0-9]|/dev/x?[hsv]d[a-z],[0-9]{1,9})'`
+ debug "SYSTEM-DEVS-SIZES: ${DEV_SIZES}"
+ echo ${DEV_SIZES}
+}
+
# get product name
function get_system_productname {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
PRODNAME=`${DMIDECODE} -s system-product-name`
debug "SYSTEM-PRODUCTNAME: ${PRODNAME}"
echo ${PRODNAME}
@@ -253,6 +400,7 @@
# get system vendor
function get_system_manufacturer {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
SYSMANUF=`${DMIDECODE} -s system-manufacturer`
debug "SYSTEM-MANUFACTURER: ${SYSMANUF}"
echo ${SYSMANUF}
@@ -260,6 +408,7 @@
# get system bios version
function get_system_biosversion {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
BIOSV=`${DMIDECODE} -s bios-version`
debug "BIOS-VERSION: ${BIOSV}"
echo ${BIOSV}
@@ -267,6 +416,7 @@
# get comma seperated list of ethernet devices (mac,iface,link)
function get_system_net_info {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
for MAC in `get_system_macs` ; do
IF=`get_iface_name_from_mac ${MAC}`
IFL=`get_iface_link_state ${IF}`
@@ -276,6 +426,7 @@
# get kernel version
function get_system_kernelversion {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
KERNEL=`${UNAME} -r`
debug "KERNEL-VERSION: ${KERNEL}"
echo ${KERNEL}
@@ -283,6 +434,7 @@
# get system architecture
function get_system_arch {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
SYSARCH=`${UNAME} -m`
debug "SYSTEM-ARCHITECTURE: ${SYSARCH}"
echo ${SYSARCH}
@@ -291,6 +443,7 @@
# get distribution
function get_system_os {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
OSREL=`${LSB_RELEASE} -d | ${AWK} -F":\t" '{print $NF}'`
debug "SYSTEM-OS: ${OSREL}"
echo ${OSREL}
@@ -298,6 +451,7 @@
# get hostname
function get_system_hostname {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
HN=`${HOSTNAME} -f`
debug "SYSTEM-HOSTNAME: ${HN}"
echo ${HN}
@@ -305,6 +459,7 @@
# get all system ipv4 addresses
function get_system_ipv4 {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
IPV4ADDR=`${IP} -4 addr show scope global | ${GREP} inet | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}' | ${SORT} -u`
debug "SYSTEM-IPV4-ADDRESSES: ${IPV4ADDR}"
echo ${IPV4ADDR}
@@ -312,6 +467,7 @@
# get all system ipv6 addresses
function get_system_ipv6 {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
IPV6ADDR=`${IP} -6 addr show scope global | ${GREP} inet | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}' | ${SORT} -u`
debug "SYSTEM-IPV6-ADDRESSES: ${IPV6ADDR}"
echo ${IPV6ADDR}
@@ -319,6 +475,7 @@
# get primary network interface from default route
function get_system_default_interface {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
INT=`${IP} -4 route show default | ${AWK} '{print $NF}'`
debug "SYSTEM-DEFAULT-IFACE: ${INT}"
echo ${INT}
@@ -326,6 +483,7 @@
# get primary ip from interface
function get_system_default_interface_ip_from_int {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
DEVICE=${1}
DEFAULTIP=`${IP} -4 addr show dev ${DEVICE} | ${GREP} inet | ${HEAD} -n1 | ${AWK} '{print $2}' | ${AWK} -F/ '{print $1}'`
debug "SYSTEM-DEFAULT-IP: ${DEFAULTIP}"
@@ -334,11 +492,13 @@
# get system default ip
function get_system_default_ip {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
get_system_default_interface_ip_from_int `get_system_default_interface`
}
# get ipmi mac
function get_system_mgmt_mac {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
case `get_system_type` in
xen-dom0|baremetal)
${MODPROBE} ipmi_devintf >/dev/null 2>&1
@@ -366,6 +526,7 @@
# get ipmi ip
function get_system_mgmt_ip {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
case `get_system_type` in
xen-dom0|baremetal)
${MODPROBE} ipmi_devintf >/dev/null 2>&1
@@ -392,6 +553,7 @@
# get rpm package list
function get_system_software {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
PACKAGES=`${RPM} -qa --queryformat '%{name}-%{version}-%{release}.%{arch} '`
debug "SYSTEM-SOFTWARE: ${PACKAGES}"
echo ${PACKAGES}
@@ -399,6 +561,7 @@
# get current date
function get_system_date {
+ [ "`is_disabled $FUNCNAME`" == "1" ] && return
LANG=C
DATUM=`${DATE}`
debug "SYSTEM-DATE: ${DATUM}"
@@ -449,6 +612,8 @@
request=""
for VAR in get_system_uuid \
get_system_serial \
+ get_system_disk_size_bootdev \
+ get_system_disk_sizes \
get_system_cpu \
get_system_memory \
get_system_manufacturer \
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/server/config.inc.php
^
|
@@ -1,5 +1,6 @@
<?php
-$config["isdf"]["postvars"] = array("get_system_uuid","get_system_serial","get_system_cpu","get_system_memory","get_system_manufacturer","get_system_productname","get_system_biosversion","get_system_net_info","get_system_default_ip","get_system_ipv4","get_system_ipv6","get_system_hostname","get_system_mgmt_mac","get_system_mgmt_ip","get_system_type","get_system_kernelversion","get_system_arch","get_system_os","get_system_software","get_system_date");
+$config["isdf"]["postvars"] = array("get_system_uuid","get_system_serial","get_system_cpu","get_system_memory","get_system_manufacturer","get_system_productname","get_system_biosversion","get_system_net_info","get_system_default_ip","get_system_ipv4","get_system_ipv6","get_system_hostname","get_system_mgmt_mac","get_system_mgmt_ip","get_system_type","get_system_kernelversion","get_system_arch","get_system_os","get_system_software","get_system_date","get_system_disk_size_bootdev","get_system_disk_sizes");
+$config["isdf"]["dhcp"]["macblacklist"] = array("00:00:00:00:00:00","ff:ff:ff:ff:ff:ff");
?>
|
[-]
[+]
|
Added |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/server/inet4.class.php
^
|
@@ -0,0 +1,163 @@
+<?php
+// $LastChangedDate: 2012-08-12 17:00:15 +0200 (Sun, 12 Aug 2012) $
+// $Rev: 1696 $
+
+class IPv4
+{
+ private $ip_long;
+ public $ip;
+ public $cidr;
+
+ function __construct($ip,$cidr)
+ {
+ $this->ip = $ip;
+ $this->ip_long = ip2long($ip);
+ $this->cidr = $cidr;
+ }
+
+ function __toString(){
+ $methods = get_class_methods($this);
+
+ foreach($methods as $meth){
+ if(substr($meth, 0, 2) != '__' && $meth != 'mask2cidr' && $meth != 'cidr2mask'){
+ $r[] = $this->$meth();
+ }
+ }
+
+ return json_encode($r);
+ }
+
+ static function mask2cidr($mask)
+ {
+ $mask = ip2long($mask);
+ $base = ((1<<32)-1);
+ return 32-log(($mask ^ $base)+1,2);
+ }
+
+ static function cidr2mask($cidr)
+ {
+ $mask = ip2long('255.255.255.255');
+ $base = ((1<<$cidr)-1);
+ return 32-log(($mask ^ $base)+1,2);
+ }
+
+ function address(){
+ return $this->ip;
+ }
+
+ function cidr() {
+ return $this->cidr;
+ }
+
+ function netmask()
+ {
+ $netmask = ((1<<32) -1) << (32-$this->cidr);
+ return long2ip($netmask);
+ }
+
+ function network()
+ {
+ $network = $this->ip_long & (ip2long($this->netmask()));
+ return long2ip($network);
+ }
+
+ function broadcast()
+ {
+ $broadcast = ip2long($this->network()) | (~(ip2long($this->netmask())));
+ return long2ip($broadcast);
+ }
+
+ function wildcard()
+ {
+ $inverse = ~(((1<<32) -1) << (32-$this->cidr));
+ return long2ip($inverse);
+ }
+
+ function availablehosts()
+ {
+ $hosts = (ip2long($this->broadcast()) - ip2long($this->network())) -1;
+ return $hosts;
+ }
+
+ function availablenetworks()
+ {
+ return pow(2, 24)/($this->availablehosts()+2);
+ }
+
+ function isipin($ip)
+ {
+ $lnet=ip2long($this->network());
+ $lip=ip2long($ip);
+ $binnet=str_pad( decbin($lnet),32,"0","STR_PAD_LEFT" );
+ $firstpart=substr($binnet,0,$this->mask2cidr($this->netmask()));
+ $binip=str_pad( decbin($lip),32,"0","STR_PAD_LEFT" );
+ $firstip=substr($binip,0,$this->mask2cidr($this->netmask()));
+ return(strcmp($firstpart,$firstip)==0);
+ }
+
+ function increment($start,$end)
+ {
+ $start_arr = explode('.',$start);
+ $end_arr = explode('.',$end);
+
+ while($start_arr <= $end_arr)
+ {
+ $start_arr[3]++;
+ if($start_arr[3] == 256)
+ {
+ $start_arr[3] = 0;
+ $start_arr[2]++;
+ if($start_arr[2] == 256)
+ {
+ $start_arr[2] = 0;
+ $start_arr[1]++;
+ if($start_arr[1] == 256)
+ {
+ $start_arr[1] = 0;
+ $start_arr[0]++;
+ } else {
+ return implode('.',$start_arr);
+ }
+ } else {
+ return implode('.',$start_arr);
+ }
+ } else {
+ return implode('.',$start_arr);
+ }
+ }
+ }
+
+ function is_ip4($ip)
+ {
+ if ( preg_match('/^([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])$/',$ip))
+ {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function is_net4($net)
+ {
+ if ( preg_match('/^([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]{1,2}|[01][0-9]{2}|2[0-4][0-9]|25[0-5])\/[0-9]{1,2}$/', $net ))
+ {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function reverse_ip4($ip)
+ {
+ if ( is_ip( $ip ) )
+ {
+ $iparr = explode(".", $ip);
+ $rip = $iparr[3] . "." . $iparr[2] . "." . $iparr[1] . "." . $iparr[0];
+ return $rip;
+ } else {
+ return false;
+ }
+ }
+
+}
+?>
|
[-]
[+]
|
Added |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/server/inv-dhcp4.class.php
^
|
@@ -0,0 +1,40 @@
+<?php
+// $LastChangedDate: 2012-08-12 20:31:53 +0200 (Sun, 12 Aug 2012) $
+// $Rev: 1697 $
+
+class inv_dhcp4 {
+ function mac_is_valid($mac)
+ {
+ $mac = strtolower(trim($mac));
+ if ( preg_match('/[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}:[0-9a-f]{2}/', $mac) )
+ {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function mac_is_blacklisted($mac)
+ {
+ global $config;
+ $mac = strtolower(trim($mac));
+ if ( $mac == "none" )
+ {
+ return false;
+ }
+ elseif ( $this->mac_is_valid($mac) )
+ {
+ if ( array_search($mac, $config["isdf"]["dhcp"]["macblacklist"]) === false )
+ {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+}
+
+?>
|
[-]
[+]
|
Changed |
_service:recompress:tar_scm:inventory-system-0.0.rev1772.tar.bz2/server/isdf.php
^
|
@@ -3,8 +3,8 @@
// isdf - inventory system deployment feed
// Author: Carsten Schoene
//
-// $LastChangedDate: 2012-08-11 16:22:17 +0200 (Sat, 11 Aug 2012) $
-// $Rev: 1690 $
+// $LastChangedDate: 2012-09-10 17:22:56 +0200 (Mon, 10 Sep 2012) $
+// $Rev: 1760 $
*/
// define our name
@@ -34,7 +34,7 @@
// function valid_uuid
function valid_uuid ( $uuid ) {
$uuid = trim($uuid);
- $regex = '/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/';
+ $regex = '/[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}/';
if ( strlen($uuid) == 36 && preg_match($regex,$uuid) ) {
return true;
} else {
|
[-]
[+]
|
Changed |
inventory-system.conf
^
|
@@ -24,3 +24,9 @@
#
CUSTOM_FUNCTIONS="get_system_type_ix"
#
+## Description: Disable listed functions (space separated)
+## Type: string
+## Default: ""
+#
+DISABLE_FUNCTIONS=""
+#
|