正如@elpddev在評論中猜測,他們只是使用console.log
記錄它在頁面加載時,他們沒有檢測到你已經打開控制檯。
如果您檢查頁面上的JS代碼,你會發現這一點:
var j = i.stop || h._("Stop!")
, k = i.text || h._("This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or \"hack\" someone's account, it is a scam and will give them access to your Facebook account.")
, l = i.more || h._("See {url} for more information.", [h.param('url', 'https://www.facebook.com/selfxss')]);
if ((window.chrome || window.safari) && !i.textonly) {
var m = 'font-family:helvetica; font-size:20px; ';
[[j, i.c1 || m + 'font-size:50px; font-weight:bold; ' + 'color:red; -webkit-text-stroke:1px black;'], [k, i.c2 || m], [l, i.c3 || m], ['', '']].map(function(s) {
setTimeout(console.log.bind(console, '\n%c' + s[0], s[1]));
});
} else {
var n = ['', ' .d8888b. 888 888', 'd88P Y88b 888 888', 'Y88b. 888 888', ' "Y888b. 888888 .d88b. 88888b. 888', ' "Y88b. 888 d88""88b 888 "88b 888', ' "888 888 888 888 888 888 Y8P', 'Y88b d88P Y88b. Y88..88P 888 d88P', ' "Y8888P" "Y888 "Y88P" 88888P" 888', ' 888', ' 888', ' 888']
, o = ('' + k).match(/.{35}.+?\s+|.+$/g)
, p = Math.floor(Math.max(0, (n.length - o.length)/2));
for (var q = 0; q < n.length || q < o.length; q++) {
var r = n[q];
n[q] = r + new Array(45 - r.length).join(' ') + (o[q - p] || '');
}
console.log('\n\n\n' + n.join('\n') + '\n\n' + l + '\n');
return;
}
這是一個有點難以閱讀,因爲它已經過壓縮,即使有漂亮的印刷。 j = i.stop || h._("Stop!")
類型的東西似乎試圖加載本地化的文本,回落到英語。然後測試他們是否檢測到Chrome或Safari瀏覽器,並且未設置i.textonly
,如果是這樣的話,它將顯示在Chrome/Safari中查看時使用的漂亮樣式。該else
條款是難以遵循,但它似乎創建ASCII藝術的旗幟,你在文本模式或非Chrome/Safari瀏覽器上得到:
.d8888b. 888 888
d88P Y88b 888 888
Y88b. 888 888 This is a browser feature intended for
"Y888b. 888888 .d88b. 88888b. 888 developers. If someone told you to copy-paste
"Y88b. 888 d88""88b 888 "88b 888 something here to enable a Facebook feature
"888 888 888 888 888 888 Y8P or "hack" someone's account, it is a
Y88b d88P Y88b. Y88..88P 888 d88P scam and will give them access to your
"Y8888P" "Y888 "Y88P" 88888P" 888 Facebook account.
888
888
888
See https://www.facebook.com/selfxss for more information.
我猜他們把該控制檯的警告前期。直到你打開開發工具,你纔會發現它。我不確定我是否理解你爲什麼需要知道devtool是否開放。 – elpddev
@elpddev,你是對的,它只是'console.log'的一些花哨的格式。看到我的答案,如果你關心看到他們使用的代碼。 –