var exec = require('child_process').exec;

if(process.platform != "win32"){
//window
throw new Error("only support windows");
return ;
} //获取网卡号
function netNumber(){
return new Promise(function(resolve,reject){
exec('ipconfig/all', function (error, stdout, stderr) {
if(error){
reject(error);
return;
}
var mex = "Realtek PCIe GBE Family Controller";
var index= stdout.indexOf(mex);
var str = stdout.substring(index);
var res = str.split("\r\n")[1].split(":")[1].trim();
resolve(res);
});
})
} //wmic diskdrive get serialnumber 获取硬盘序列号
function diskNumber(){
return new Promise(function(resolve,reject){
exec('wmic diskdrive get serialnumber', function (error, stdout, stderr) {
if(error){
reject(error);
return;
}
resolve(stdout.split("\r\n")[1].trim())
});
});
} module.exports = function(){
return Promise.all([netNumber(),diskNumber()]).then(function(res){
var str = res[0];
for(var i = 0; i < res[1].length; i++){
if(i % 2 == 0 ){
str = str + "-"
}
str = str + res[1][i];
}
return Promise.resolve(str);
})
}

  

var guid = require("./guid");

guid().then(function(res){
console.log(res);
}).catch(function(res){
console.log(res);
})

 

 

node获取windows pc 机器的标示的更多相关文章

  1. python wmi模块 获取windows内部信息

    WMI (Windows Management Instrumentation) 模块可用于获取 Windows 内部信息,在使用Python获取Windows系统上的相关的信息可以使用WMI接口来获 ...

  2. 通过PowerShell获取Windows系统密码Hash

    当你拿到了系统控制权之后如何才能更长的时间内控制已经拿到这台机器呢?作为白帽子,已经在对手防线上撕开一个口子,如果你需要进一步扩大战果,你首先需要做的就是潜伏下来,收集更多的信息便于你判断,便于有更大 ...

  3. Python使用wmi获取Windows相关信息

    在使用Python获取Windows系统上的相关的信息可以使用WMI接口来获取, 什么是wmi? WMI是一项核心的Windows管理技术,WMI作为一种规范和基础结构,通过它可以访问.配置.管理和监 ...

  4. Python使用WMI模块获取Windows系统的硬件信息,并使用pyinstaller库编译打包成exe的可执行文件

    由于公司现阶段大多数应用软件都是基于Windows系统开发和部署,很多软件安装部署都是在windows server 2012.windows server 2008之类的服务器上,部门同事每次测试一 ...

  5. 使用C#获取Windows Phone手机的各种数据(转)

    转自:http://www.sum16.com/desinger/use-c-sharp-get-windows-phone-information.html 使用C#获取Windows Phone手 ...

  6. Python的功能模块[0] -> wmi -> 获取 Windows 内部信息

    wmi模块 / wmi Module WMI (Windows Management Instrumentation) 模块可用于获取 Windows 内部信息.该模块需要 win32com 的支持, ...

  7. 盼望着,盼望着。它终于来了!!!剪辑Windows PC测试版!

    盼望着,盼望着.它终于来了!!!剪辑Windows PC测试版! 喜欢短视频抖音的小伙伴们,是不是都对手机抖音剪映操作不是很满意.期待WINDOWS电脑版剪映的来临.在此之前只有MAC版本,不能满足广 ...

  8. [C语言](二)01 获取Windows图形构件大小信息

    SYSMETS.c #include <windows.h> #include "SYSMETS.H"//自定义的单元,所以用"",不是用<& ...

  9. Connect to a Windows PC from Ubuntu via Remote Desktop Connection

    http://www.7tutorials.com/connecting-windows-remote-desktop-ubuntu A useful feature of Windows is be ...

随机推荐

  1. npm install 项目安装遇到问题

    npm cache clean/clear --force

  2. C语言 · 还款计算

    标题: 还款计算 银行贷款的等额本息还款方法是: 每月还固定的金额,在约定的期数内正好还完(最后一个月可能会有微小的零头出入). 比如说小明在银行贷款1万元.贷款年化利率为5%,贷款期限为24个月. ...

  3. 非root用户在80端口运行nginx

    一般情况下没有这种需求,但对于强迫症患者来说,还是完整的走了一把. 普通用户是不允许使用1024以下端口的,所以此次操作仍然需要root权限来进行配置.而且由于使用了root安装,因此nginx用户仍 ...

  4. rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

    使用grpc-go调用grpc服务端时,出现rpc error: code = Internal desc = stream terminated by RST_STREAM with error c ...

  5. Flask-SQLAlchemy 中多表链接查询(不使用外键)

    SQLAlchemy 是一个功能强大的 ORM . Flask-SQLAlchemy 是一个 Flask 插件,它让我们在 Flask 框架中使用 SQLAlchemy 变得更容易. 本篇介绍我在使用 ...

  6. QT系统托盘应用程序

    在QT中QSystemTrayIcon类提供了创建系统托盘程序的功能. QSystemTrayIcon类为系统托盘中的应用程序提供图标.现代操作系统通常会在桌面上提供一个称为系统托盘(system t ...

  7. Tensorflow r1.8安装C++接口(兼容OpenCV3)

    与之前一样,直接走medium的传送门:https://medium.com/@fanzongshaoxing/use-tensorflow-c-api-with-opencv3-bacb83ca56 ...

  8. java.lang.ClassCastException:weblogic.xml.jaxp.RegistryDocumentBuilderFactory cannot be cast to javax.xml.parsers.DocumentBuilderFactory

    java.lang.ClassCastException:weblogic.xml.jaxp.RegistryDocumentBuilderFactory cannot be cast to java ...

  9. 在IE中启动火狐——自定义浏览器链接协议

    有时候需求就是这么奇葩,特别是在这个浏览器混战收尾的节骨眼上,有的客户正在将全单位的浏览器统一到Chrome.有的正在统一到Firefox.还有的正在统一到360上.于是就有了如题的需求,客户正在将浏 ...

  10. 从0移植uboot (四) _点亮调试LED

    这一节主要讨论1个问题:点灯.点灯是实际开发中,特别是裸板开发中常见的调试手段,相当于主机开发中漫天飞舞的printf/printk.为了追踪程序的现场执行情况,很多时候我们都使用点一个灯的方法来进行 ...