arcgis python 获得硬件id
import time
import wmi, zlib
def get_cpu_info():
tmpdict = {}
tmpdict["CpuCores"] = 0
c = wmi.WMI()
# print c.Win32_Processor().['ProcessorId']
# print c.Win32_DiskDrive()
for cpu in c.Win32_Processor():
# print cpu
#print("cpu id:", cpu.ProcessorId.strip())
tmpdict["CpuId"] = cpu.ProcessorId.strip()
tmpdict["CpuType"] = cpu.Name
try:
tmpdict["CpuCores"] = cpu.NumberOfCores
except:
tmpdict["CpuCores"] += 1
tmpdict["CpuClock"] = cpu.MaxClockSpeed
return tmpdict
def _read_cpu_usage():
c = wmi.WMI()
for cpu in c.Win32_Processor():
return cpu.LoadPercentage
def get_cpu_usage():
cpustr1 = _read_cpu_usage()
if not cpustr1:
return 0
time.sleep(2)
cpustr2 = _read_cpu_usage()
if not cpustr2:
return 0
cpuper = int(cpustr1) + int(cpustr2) / 2
return cpuper
def get_disk_info():
tmplist = []
encrypt_str = ""
c = wmi.WMI()
for cpu in c.Win32_Processor():
# cpu 序列号
encrypt_str = encrypt_str + cpu.ProcessorId.strip()
print("cpu id:", cpu.ProcessorId.strip())
for physical_disk in c.Win32_DiskDrive():
encrypt_str = encrypt_str + physical_disk.SerialNumber.strip()
# 硬盘序列号
print('disk id:', physical_disk.SerialNumber.strip())
tmpdict = {}
tmpdict["Caption"] = physical_disk.Caption
tmpdict["Size"] = int(physical_disk.Size) / 1000 / 1000 / 1000
tmplist.append(tmpdict)
for board_id in c.Win32_BaseBoard():
# 主板序列号
encrypt_str = encrypt_str + board_id.SerialNumber.strip()
print("main board id:", board_id.SerialNumber.strip())
# for mac in c.Win32_NetworkAdapter():
# mac 地址(包括虚拟机的)
# print "mac addr:", mac.MACAddress:
for bios_id in c.Win32_BIOS():
# bios 序列号
encrypt_str = encrypt_str #+ bios_id.SerialNumber.strip()
print("bios number:", bios_id.SerialNumber.strip())
print("encrypt_str:", encrypt_str)
# 加密算法
print("加密算法:%d" % zlib.adler32(encrypt_str.encode()))
return encrypt_str
if __name__ == "__main__":
# a = get_cpu_info()
# print("cpu: %s" % a)
get_disk_info()
arcgis python 获得硬件id的更多相关文章
- arcgis python arcpy add data script添加数据脚本
arcgis python arcpy add data script添加数据脚本mxd = arcpy.mapping.MapDocument("CURRENT")... df ...
- ArcGIS Python编程案例-电子资料链接
ArcGIS Python编程案例(1)-Python语言基础 https://www.jianshu.com/p/dd90816d019b ArcGIS Python编程案例(2)-使用ArcPy编 ...
- python 插入数据获取id
python 插入数据获取id 学习了:https://blog.csdn.net/qq_37788558/article/details/78151972 commit之前获取 cursor.las ...
- python入门3 python变量,id(),is运算符
python变量无需声明数据类型,可以直接赋值使用. 比如: num=100 #整数 str="字符串" #字符串 turple1 =('mon','tue','wed','thu ...
- arcgis python脚本工具实例教程—栅格范围提取至多边形要素类
arcgis python脚本工具实例教程-栅格范围提取至多边形要素类 商务合作,科技咨询,版权转让:向日葵,135-4855_4328,xiexiaokui#qq.com 功能:提取栅格数据的范围, ...
- ArcGIS Python人门到精通目录基于ArcGIS10.2,100以上案例15章42个视频806分钟,51GIS网站上线
ArcGIS Python人门到精通目录 闫老师 QQ:276529800 微信13108507190 1. ArcGIS Python基础 1.1 ArcGIS为什么学习Python 1.2 A ...
- arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)
arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算) 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 此地理处理工具 ...
- arcgis python获得字段唯一值
arcgis python获得字段唯一值 # Import native arcgisscripting moduleimport arcgisscripting, sys# Create the g ...
- ArcGis Python常用脚本
ArcGis Python脚本——ArcGIS 中使用的 Python 是什么版本 ArcGis Python脚本——批量添加字段 ArcGis Python脚本——批量删除字段 ArcGis Pyt ...
随机推荐
- 珠宝juelrye英语juelrye宝石
jewellery (usually uncountable, plural jewelleries) 1.(British spelling, Canadian) Collectively, per ...
- 供应链管理如何提高效率?APS系统成优化引擎
APS系统,虽然它的起兴只有短短的十几年,但是在这段时间里面,它为很多企业解决了很多人工手动.脑力不可解决的问题. 所以APS被誉为供应链优化引擎,APS常常被称为高级计划与排程,但也有称为高级计划系 ...
- 如何在SAP Cloud Platform上进行第一个integration flow开发
登录SAP Cloud Platform integration tenant,点击Edit图标: 创建一个新的Content package: 保存content package后,点击artifa ...
- CentOS7安装VNC
#安装 yum -y install tigervnc-server 将配置表复制到etc .service 修改配置文件 vim /etc/systemd/system/vncserver@\:.s ...
- 【HICP Gauss】数据库 数据库管理(连接方式 会话模式 存储表空间)-6
数据库连接方式:驱动连接和客户端连接 驱动连接 : JDBC GSC ODBC 客户端连接 zsql工具 zsql / as sysdba -q #管理员身份登陆 zsql omm/ - #普通身份登 ...
- Linux操作系统的计划任务
Linux操作系统的计划任务 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.任务计划概述 Linux任务计划.周期性任务执行 未来的某时间点执行一次任务: at: 指定时间点, ...
- 【MySQL】FIND_IN_SET、LIKE、IN的区别
现在有张新闻表,里面有新闻名称name字段,有新闻类型type字段,1代表头条,2代表推荐,11代表热点,22代表最新,现在表中有两条记录,存储形式如下,现在的需求是查找头条新闻,及type中包含1的 ...
- typeScript学习随笔(一)
TypeScript学习随笔(一) 这么久了还不没好好学习哈这么火的ts,边学边练边记吧! 啥子是TypeScript TypeScript 是 JavaScript 的一个超集,支持 es6 标准 ...
- 动态管理upsteam---nginx_http_dyups_module
nginx_http_dyups_module nginx_http_dyups_module是第三方开源软件,它提供API动态修改upstream的配置,并且支持Nginx的ip_hash.kee ...
- Linux跑脚本用sh和./有什么区别?
一个很有意思的例子: sh是一个shell.运行sh a.sh,表示我使用sh来解释这个脚本:如果我直接运行./a.sh,首先你会查找脚本第一行是否指定了解释器,如果没指定,那么就用当前系统默认的sh ...