简体   繁体   English

如何在Linux框中使用javascript,php,bash发送nic mac地址信息?

[英]How to send nic mac address information using javascript, php, bash in linux box?

i'm trying to identify client Linux PC (our branch) to allow acces to our PHP application at main office. 我正在尝试确定客户端Linux PC(我们的分支机构)以允许在总公司访问我们的PHP应用程序。 i want to get the nic mac address (using php/bash) then hashing/crypt it, then send to php server at main office. 我想获取nic mac地址(使用php / bash),然后对其进行哈希处理/加密,然后发送至总部的php服务器。 How to call the php/bash script at client and send the information using javascript/ajax/jquery ? 如何在客户端调用php / bash脚本并使用javascript / ajax / jquery发送信息?

Note: I still have no success using evercookies to implement this . 注意:使用evercookies来实现this仍然没有成功。

Well the linux command is 那么linux命令是

    ifconfig|grep -i ether|awk '{ print $2 }'|sha256sum

in php it would be 在PHP中

    <?php
    $hashedResult = system("ifconfig|grep -i ether|awk '{ print $2 }'|sha256sum");
    ?>

this will return a hashed string 这将返回一个哈希字符串

remove the ' |sha256sum ' to see the MAC address 删除“ | sha256sum”以查看MAC地址

NOTE: this assumes the PC hardware will be consistant (not adding USB ethernet cards) 注意:这假定PC硬件是一致的(不添加USB以太网卡)

to add CPU info into the hash you could use this command 要将CPU信息添加到哈希中,可以使用此命令

    (ifconfig|grep -i ether|awk '{ print $2 }' && cat /proc/cpuinfo) |sha256sum

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM