TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to randomize your MAC address on OS X

81 点作者 FredericJ将近 11 年前

18 条评论

FootballMuse将近 11 年前
How I&#x27;ve been doing it for years:<p><a href="https://github.com/feross/SpoofMAC" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;feross&#x2F;SpoofMAC</a><p>&gt; spoof-mac randomize en0
评论 #7875937 未加载
评论 #7874346 未加载
评论 #7875538 未加载
column将近 11 年前
Hi, isn&#x27;t Python now shipping with OSX? I haven&#x27;t tested it, but wouldn&#x27;t this also work while being more readable? (DISCLAIMER: I haven&#x27;t tested it. Also, I haven&#x27;t tested it.)<p><pre><code> from random import randint from os import getenv from subprocess import call from sys import argv if len(argv) &gt; 1: # get network interface from cmdline parameter intf = argv[1] else: # get network interface from ENVIRONMENT variables intf = getenv(&#x27;INTERFACE&#x27;, &#x27;&#x27;) if intf: # generate random mac address r = lambda: randint(0,255) randmac = &#x27;%02X:%02X:%02X:%02X:%02X:%02X&#x27; % (r(),r(),r(),r(),r(),r()) # change mac address call([&quot;ifconfig&quot;, &quot;%s hw ether %s&quot; % (intf, randmac)]) else: print &quot;Couldn&#x27;t determine network interface&quot;</code></pre>
评论 #7873624 未加载
评论 #7873550 未加载
评论 #7878237 未加载
评论 #7876972 未加载
zufallsheld将近 11 年前
On Linux, you can use macchanger[0], a tool which does this automatically for you. I wrote about it here[1].<p>[0]<a href="https://github.com/alobbs/macchanger" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alobbs&#x2F;macchanger</a> [1]<a href="https://www.zufallsheld.de/2013/08/07/mac-spoofing-under-linux/" rel="nofollow">https:&#x2F;&#x2F;www.zufallsheld.de&#x2F;2013&#x2F;08&#x2F;07&#x2F;mac-spoofing-under-lin...</a>
评论 #7874075 未加载
jackgavigan将近 11 年前
Alternatively...<p><pre><code> sudo ifconfig en1 ether `openssl rand -hex 6 | sed &#x27;s&#x2F;\(..\)&#x2F;\1:&#x2F;g; s&#x2F;.$&#x2F;&#x2F;&#x27;` </code></pre> Credit where it&#x27;s due: <a href="http://osxdaily.com/2012/03/01/change-mac-address-os-x/" rel="nofollow">http:&#x2F;&#x2F;osxdaily.com&#x2F;2012&#x2F;03&#x2F;01&#x2F;change-mac-address-os-x&#x2F;</a>
eliot_sykes将近 11 年前
Elsewhere on HN in case you missed it - random MAC addresses are coming to iOS8: <a href="https://news.ycombinator.com/item?id=7864813" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7864813</a>
评论 #7874785 未加载
jarin将近 11 年前
If I&#x27;m not mistaken, the author recommends saving the file to<p><pre><code> &#x2F;opt&#x2F;local&#x2F;etc&#x2F;oui.txt </code></pre> but the plist runs<p><pre><code> bash &#x2F;opt&#x2F;local&#x2F;bin&#x2F;macrandomize.sh </code></pre> I think one or the other probably needs to be changed, unless I&#x27;m missing something here.
评论 #7873084 未加载
评论 #7873177 未加载
zurn将近 11 年前
You want unpredictable random numbers, so using bash $RANDOM is no good. hexdump + &#x2F;dev&#x2F;urandom + sed would work, incantation left as an exercise to reader as I don&#x27;t have a Mac around to check limitations of their hexdump(1)...<p>(Same goes for the Python solution posted in another comment here).
评论 #7874976 未加载
fascinated将近 11 年前
Does this even work on the wireless interface on a mbp? The driver used to prevent you from setting the MAC addr to anything you wanted, vs the ethernet driver for the wired interface that lets you play with it freely.
评论 #7873465 未加载
评论 #7873247 未加载
vrikis将近 11 年前
I wrote my own little terminal commands back when I had a 5 hour lay-over in Charles de Gaulle Airport (Paris). At the time, they offered 15 minute free wifi, so I just ran my little tool and it worked a treat.
ohwp将近 11 年前
I was wondering: why did they decide to randomize the address? Why not use the same address for every device?
评论 #7873589 未加载
评论 #7873007 未加载
评论 #7873053 未加载
评论 #7873024 未加载
desertjedi将近 11 年前
Hey, is there a way this could be done under Windows? Run from a batch file for example?
Throw67F4D509将近 11 年前
Be careful. Randomizing your MAC address may make your computer stick out more than if you pick a single legitimate looking MAC address and stick with it for a while. Not all 16 million MAC prefixes have been sold to manufacturers yet.
erkose将近 11 年前
I prefer adapting the method described in Unique Local IPv6 Unicast Addresses <a href="https://tools.ietf.org/html/rfc4193" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4193</a>
kccqzy将近 11 年前
One of my friends also told me Dropbox uses MAC address to identify computers. He wrote a similar script to get lots of referrals and free space on Dropbox. Probably against their Terms though.
评论 #7876336 未加载
TheLoneWolfling将近 11 年前
I have my computer set up to randomize MAC address on boot, on both partitions.<p>There are some downsides (having to relogin to certain wireless networks every boot) but by-and-large it&#x27;s worth it.
mwfunk将近 11 年前
Tangential, but it&#x27;s actually heartwarming to me that so far every commenter seems to understand that the &quot;MAC&quot; in the title refers to Media Access Control, rather than a comically incorrect way of spelling the name of the computers that OS X runs on.
评论 #7875552 未加载
评论 #7876216 未加载
dmmalam将近 11 年前
Does OSX Yosemite have the mac randomization like ios8?
zomg将近 11 年前
i use linkliar <a href="https://github.com/halo/LinkLiar" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;halo&#x2F;LinkLiar</a>