python---硬件序列号

安装wmi :
pip install wmi -i https://pypi.douban.com/simple
还要安装 pip install pywin32
import wmi c = wmi.WMI()
zuban=c.Win32_BaseBoard()[0].SerialNumber.strip() #获取主板序列号
#BSN12345678901234567 cpu=c.Win32_Processor()[0].ProcessorId.strip() #获取cpu序列号
#BFEBFBFF000306A9 yinpan=c.Win32_DiskDrive()[0].SerialNumber.strip() #硬盘序列号
#S2Y4J9ADA29166 neicun=c.Win32_PhysicalMemory()[0].SerialNumber.strip() #内存序列号
#E3806262 #网卡mac地址:
def macAddress():#获取网卡mac信息函数
macs = []
for n in c.Win32_NetworkAdapter():
mactmp = n.MACAddress
if mactmp and len(mactmp.strip()) > 5:
tmpmsg = {}
tmpmsg['MACAddress'] = n.MACAddress
tmpmsg['Name'] = n.Name
tmpmsg['DeviceID'] = n.DeviceID
tmpmsg['AdapterType'] = n.AdapterType
tmpmsg['Speed'] = n.Speed
macs.append(tmpmsg)
return macs[0]['MACAddress'] #返回第一个网卡的mac地址【24:FD:52:3C:ED:8F】。macs包含所有网卡信息 m=macAddress() print(cpu)
print(zuban)
print(yinpan)
print(neicun)
print(m)
获取mac地址
import uuid
x = uuid.getnode() #获取十进制的mac地址
#<class 'int'> 128437435448900

python---硬件序列号的更多相关文章
- 2018-8-3-WPF-读取硬件序列号
title author date CreateTime categories WPF 读取硬件序列号 lindexi 2018-8-3 11:8:2 +0800 2018-8-2 19:28:6 + ...
- 获取PC硬件硬件序列号,唯一标识一台PC
用一个库:jydisk.dll 百度说是windows提供的C++标准动态库,很方便使用. 点击连接下载文件,里面有各种语言的调用例子,可直接使用.测试多台机器,结果靠谱.没有遇到获取出来是全零的情 ...
- Python json 序列号字典 文本的存储和读取
rootDir='./resources/v1/'# 根目录 # 按钮测试图片 btnTestPicUrl = { 'armyAttack' : rootDir+'testPic/gj2.jpg', ...
- CE6.0 下获得 SD 卡序列号的方法
经常在坛子里看到讨论软件加密的帖子,纯软件加密与读取硬件序列号加密是经常讨论到的. 两种方法各有优缺点. 在通过读取硬件序列号的方法来加密的方法,受硬件的限制. 一般来说,CPU和T-Flash可能存 ...
- 记MAC地址、磁盘序列号的获取
import java.io.*; import java.net.Inet4Address; import java.net.InetAddress; import java.net.Network ...
- python与pycharm的安装与“试用”
python与pycharm的安装与"试用" 一.python解释器安装与启动 python解释器的安装 1.打开文件安装包运行页面 #python3.8 2.选择Customiz ...
- 加密狗的管理层API(C#代码)
using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServi ...
- poi excel文件上传并解析xls文件
1.jsp页面 <form action="hw/pe_xls_upload" method="post" enctype="multipart ...
- 磐石加密狗NT88管理层API
磐石加密狗NT88管理层API 直接贴代码了 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 ...
- compile libvirt
POSIX-linux 编译安装libvirt依赖包; 1.yum install device-mapper-devel
随机推荐
- ubuntu 设置静态ip,但显示scope global secondary ens33
设置静态ip 修改 /etc/network/interfaces 文件 # The loopback network interface auto lo iface lo inet loopback ...
- 初学SpringBoot遇到的坑和笔记
目录 1.日期返回给前端显示不理想问题 1.1重现 1.2原因 1.3解决 1.4结果 2.MyBatis-Plus数据库字段未找到问题 2.1重现 2.2原因 2.3解决 3.Long型雪花主键返回 ...
- Android开发自定义View
Android中View组件的作用类似于Swing变成中的JPanel,它只是一个空白的矩形区域,View组件中没有任何内容.对于Android应用的其他UI组件来说,它们都继承了View组件,然后在 ...
- centos7 源码安装 MongoDb
1.下载源码包 curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.12.tgz 2.解压 放到 /usr/local/ ...
- mybatis中collection子查询注入参数为null
具体实现参照网上,但是可能遇到注入参数为null的情况,经过查阅及自己测试记录一下: 子查询的参数中,有<if test="">之类,需要指定别名,通过 http:// ...
- java 异常捕捉 ( try catch finally ) 你真的掌握了吗?
掌握下面几条原则就可以完全解决“当try.catch.finally遭遇return”的问题. 原则:1.finally语句块中的代码是一定会执行的,而catch块中的代码只有发生异常时才会执行. 2 ...
- GTA4 EFLC cheat code
GTA4 EFLC cheat code 提示警告:您的图像设置接近或超出您的系统推荐资源限制,为了使游戏运行更加流畅推荐你降低你的图像设置. 在游戏目录新建名为 commandline的txt文本文 ...
- HDU3085NightmareII题解--双向BFS
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=3085 分析 大意就是一个男孩和一个女孩在网格里,同时还有两个鬼,男孩每轮走三步,女孩每轮走一步,与鬼曼 ...
- WebStorm 使用技巧
常用快捷键 代码编辑 ctrl + d:复制行 ctrl + y:删除行 ctrl + x:剪切行 ctrl + shift + ↑: 行移动 ctrl + shift + enter: 换行 ctr ...
- vue实现吸顶
data(){ return{ list:[], swiperOption:"", xiding : "", // 轮播高度 SwiperHeight:'' } ...