我們有時候,需要將軟體加密。一種常用的方式是,獲取電腦的mac位址,在程式**中check mac資訊,作為是否能使用軟體。
實現功能主要如下:
獲取電腦的mac位址
檢查特定的mac位址
import os
import sys
import time
import uuid
defget_mac_address()
: node = uuid.getnode(
) mac = uuid.uuid(
int=node)
.hex[-
12:]return
":".join(
[mac[e:e +2]
for e in
range(0
,11,2
)])def
check_license
(licensed_mac_address)
: cur_mac_address = get_mac_address(
)if licensed_mac_address == cur_mac_address:
return
true
else
:print
('cur_mac_address:{} is not the same of licensed_mac_address{}'
.format
( cur_mac_address, licensed_mac_address)
)def
check_license_00e04c680325()
: licensed_mac_address =
'00:e0:4c:68:03:25'
if check_license(licensed_mac_address)
:print
('check license success!'
)return
true
else
:print
('check license failed!'
)return
false
if __name__ ==
'__main__'
:
check_license_00e04c680325(
)
使用 SendARP 查詢 MAC 位址
通過 ip helper api 中的 sendarp 傳送 arp 請求來獲取 mac 位址,簡單方便,缺點是不能跨越閘道器。include include include pragma ment lib iphlpapi.lib pragma ment lib ws2 32.lib int ma...
MAC位址IP位址閘道器位址
對於網路上的某一裝置,如一台計算機或一台路由器,其ip位址是基於網路拓撲設計出的,同一臺裝置或計算機上,改動ip位址是很容易的 但必須唯一 而mac則是生產廠商燒錄好的,一般不能改動。我們可以根據需要給一台主機指定任意的ip位址,如我們可以給區域網上的某台計算機分配ip位址為192.168.0.11...
MAC位址表 埠安全 MAC位址偏移
4.mac位址表 2.埠安全 mac位址偏移 1.組成 mac位址為48位 6位元組 前24bit是通過向ietf等機構申請用來表示廠商的 後24bit是廠商分配給產品的唯一數值。2.分類 3.交換機對資料幀的三種處理行為 3.常見mac位址 位址用處 01 00 5e 0x xx xx ipv4組...