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 ...
随机推荐
- 源码解析-url状态检测神器ping-url
前言 ping-url是我最近开源的一个小工具,这篇文章也是专门写它设计理念的科普文. 为什么会做这个ping-url开源工具呢? 起因是:本小哥在某天接到一个特殊的需求,要用前端的方式判断任意一个u ...
- vue中使用echart柱状图
一: <template> <Layout> <Content> <Card :style="{minHeight:'300px'}"&g ...
- App抓包代理设置
1.设置Fiddler 打开Fiddler,Tools --> Fiddler Options --> HTPS (配置完后记得要重启Fiddler) 选中"Decrpt ...
- Windows系统Apache下载和安装
一.Apache的下载 1.访问Apache官网:https://httpd.apache.org 2.选择Windows版本下载 3.下载完成后解压缩,把文件放到自己想放的盘 二.Apache的安装 ...
- 《大象 Thinking in UML》读书笔记:Process-oriented vs. Object-oriented
前言 面向过程 还是 面向对象?这不仅仅是个软件工程术语,其问题甚至可以追溯到亚里士多德:您把这个世界视为过程还是对象? 回归到现今的软件行业,这不仅仅是个某个具体编程技术问题,更是认识论问题. 认识 ...
- kubernetes里面的GC--转发
什么是GC GC 是 Garbage Collector 的简称.从功能层面上来说,它和编程语言当中的「GC」 基本上是一样的.它清理 Kubernetes 中「符合特定条件」的 Resource O ...
- MySQL/MariaDB数据库的视图(VIEW)
MySQL/MariaDB数据库的视图(VIEW) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.视图概述 1>.什么是视图 视图就是一个虚拟的表,保存有实表的查询结果 ...
- 如何预防SQL注入?预编译机制
1.预编译机制(一次编译多次执行,防止sql注入) 2.预编译机制
- HTML常用全部代码--第二部分--JAVASCRIPT( 小伙伴要牢记😁😁😁😁 )
html代码大全--js部分:小技巧 (1) 点击关闭窗口<a href="javascript.:top.window.close();">点击关闭窗口</a& ...
- 最大m子段和
最大m子段和 定义一串子段s1,s2,s3 ... sn-1,sn 求m段不交叉最大子段和 解:设dp[i][j]代表前j个数分成i段的最大和(包括a[j]) 状态转移方程: dp[i][j]=Max ...