def collect(id='all'): cmd={ "platform":"/usr/sbin/dmidecode -s system-product-name|tail -1", "os":"""awk 'NR==1{print}' /etc/issue""", "bit":"getconf LONG_BIT", "cpu_num":"grep 'physical id' /proc/cpuinfo| sort| uniq| wc -l", "core_num":"""grep "processor" /proc/cpuinfo| wc -l""", "cpu_type":"""grep name /proc/cpuinfo| cut -f2 -d: | uniq -c""", "serial_num":"""/usr/sbin/dmidecode -s system-serial-number|sed 's/ //g'""", "interface":"""lspci|grep 'Ethernet'""", "mem":"""/usr/bin/free -m|awk '$1=="Mem:"{printf("%sMB",$2)}'""", "disk":"""parted -l | grep -E '^Disk' | grep -v mapper""", "mac":"""/sbin/ifconfig -a |awk '$0~/HWaddr/{print $NF}'""", "hostname":"hostname", "swap":"""/usr/bin/free -m|awk '$1=="Swap:"{printf("%sMB",$2)}'"""} for a in cmd.keys(): Data=DataConf.DataConf() cheungssh_web.main(cmd[a],'all-ie',id,Data,'hardware',a)
def collect(id='all'): cmd = { "platform": "/usr/sbin/dmidecode -s system-product-name|tail -1", "os": """awk 'NR==1{print}' /etc/issue""", "bit": "getconf LONG_BIT", "cpu_num": "grep 'physical id' /proc/cpuinfo| sort| uniq| wc -l", "core_num": """grep "processor" /proc/cpuinfo| wc -l""", "cpu_type": """grep name /proc/cpuinfo| cut -f2 -d: | uniq -c""", "serial_num": """/usr/sbin/dmidecode -s system-serial-number|sed 's/ //g'""", "interface": """lspci|grep 'Ethernet'""", "mem": """/usr/bin/free -m|awk '$1=="Mem:"{printf("%sMB",$2)}'""", "disk": """parted -l | grep -E '^Disk' | grep -v mapper""", "mac": """/sbin/ifconfig -a |awk '$0~/HWaddr/{print $NF}'""", "hostname": "hostname", "swap": """/usr/bin/free -m|awk '$1=="Swap:"{printf("%sMB",$2)}'""" } for a in cmd.keys(): Data = DataConf.DataConf() cheungssh_web.main(cmd[a], 'all-ie', id, Data, 'hardware', a)
raw_str += chr(ord(d) ^ ord(masks[i % 4])) i += 1 if '\x03\xe9' in raw_str.split(): sys.exit() print "输入[%s]" % raw_str try: raw_str_source = eval(raw_str) raw_str = raw_str_source["cmd"] selectserver = raw_str_source["selectserver"] #print "主机: ",selectserver except Exception, e: print "命令格式错误", e sys.exit(1) cheungssh_web.main(raw_str, ie_key, selectserver) return raw_str def sendMessage(message): global message_tmp #test if len(message) == 0: sys.exit() try: message_tmp = eval(message.strip('\r\n')) except Exception, e: print "解析错误", e sys.exit(1) ie_key = str(message_tmp.keys()[0]) message = str(message_tmp.values()[0]) try:
raw_str += chr(ord(d) ^ ord(masks[i%4])) i += 1 if '\x03\xe9' in raw_str.split():sys.exit() print "输入[%s]"%raw_str try: raw_str_source=eval(raw_str) raw_str=raw_str_source["cmd"] selectserver=raw_str_source["selectserver"] #print "主机: ",selectserver except Exception,e: print "命令格式错误",e sys.exit(1) cheungssh_web.main(raw_str,ie_key,selectserver) return raw_str def sendMessage(message): global message_tmp #test if len(message)==0:sys.exit() try: message_tmp=eval(message.strip('\r\n')) except Exception,e: print "解析错误",e sys.exit(1) ie_key=str(message_tmp.keys()[0]) message=str(message_tmp.values()[0]) try: