BlackList_Sniffer
// ==UserScript==
// @name BlackList_Sniffer
// @namespace https://space.bilibili.com/
// @version 1.0.0
// @description 自动拉黑B站机器人卡房号
// @grant GM_cookie
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @run-at document-end
// @connect bilibili.com
// @author 熊璜Ailurus
// @match https://space.bilibili.com/*
// ==/UserScript==
function get_csrf(){
GM_cookie('list', {
domain: ".bilibili.com",
name:"bili_jct"
}, (item) => {
if(item)
{
console.log(item[0].value);
document.getElementById('inp_csrf').value =item[0].value;
}
});
}
function start_blocking(uid,index,total) {
let fd = new FormData();
fd.append('fid',uid);
fd.append('act',5);
fd.append('re_src',11);
fd.append('gaia_source','web_main');
fd.append('spmid','333.999.0.0');
fd.append('extend_content',`{"entity":"user","entity_id":3546776046930594,"fp":"0\u00012560,,1440\u0001Win32\u000124\u00018\u000124\u00011\u0001zh-CN\u00010\u00010,,0,,0\u0001Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"}`);
fd.append('csrf',document.getElementById('inp_csrf').value);
let _url = `https://api.bilibili.com/x/relation/modify`;
GM_xmlhttpRequest({
method: "POST",
url: _url,
headers: {
"content-type:": "application/x-www-form-urlencoded",
"Accept": "*/*"
},
data: fd,
onload: function (response) {
let code=JSON.parse(response.responseText)?.code;
let message=JSON.parse(response.responseText)?.message;
let element=document.getElementById('log');
if(code==0)
{
console.log(`拉黑成功!uid:${uid}`);
element.innerHTML+=`[${index+1}/${total}]拉黑成功!uid:${uid}<br>`;
element.scrollTop = element.scrollHeight;
}
else
{
console.log(`拉黑失败!uid:${uid}.原因:${message}`);
element.innerHTML+=`[${index+1}/${total}]拉黑失败!uid:${uid}.原因:${message}<br>`;
element.scrollTop = element.scrollHeight;
}
},
onerror: function (response) {
console.log(`拉黑失败!uid:${uid}.原因:${response.responseText}`);
element.innerHTML+=`[${index+1}/${total}]拉黑失败!uid:${uid}.原因:${response.responseText}<br>`;
element.scrollTop = element.scrollHeight;
}
});
}
let div = document.createElement("div");
div.innerHTML =
`<div id="log" style="
bottom: 120px;
right: 10px;
height:200px;
width:360px;
overflow-y:scroll;
overflow-x:hidden;
border:solid 1px;
position: fixed;
">
</div>
<div style="bottom: 80px;right: 10px;position: fixed;">
<span>csrf</span>
<input id="inp_csrf" style="width:200px;"/>
<span>批量拉黑</span>
<button id="confirm" style="width:80px;">开始</button>
</div>`;
div.onclick = function (event) {
if (event.target.id == "confirm") {
console.log(`正在进行批量拉黑`);
document.getElementById('log').innerHTML+=`正在进行批量拉黑,共计uid:${uid_list.length}条<br>`;
document.getElementById('log').scrollTop = element.scrollHeight;
for (let i = 0; i < uid_list.length; i++) {
setTimeout(() => {
console.log(`uid:${uid_list[i]}`);
start_blocking(uid_list[i],i,uid_list.length);
}, 1000*i)
}
}};
document.body.append(div);
get_csrf();
let uid_list=[3546776046930594,
3546739774589238,
3546776317463299,
3546741041269015,
3546740993034384,
3546751638178164,
3493260519540812,
3546794472508038,
3546652910553267,
3546677594032573,
3546794403301573,
3546656152750753,
3546766708312646,
3494361998297713,
3546654636509299,
3546654644898246,
3546608931178814,
3546656127584796,
3546607012284656,
3546656630901576,
3546655817206124,
3546778760644964,
3546656469420368,
3546760412661892,
3546764527274008,
3546586867043021,
1938464087,
3546760582531597,
3546755194947608,
3546789057661401,
3546779928759179,
3546787132475837,
472738658,
3546643123145231,
1047441781,
3546760899201197,
3546776214702772,
3546784137743274,
247830407,
3546760892909983,
3546740747668080,
3546726229085029,
3546653829106509,
3546719539169670,
3546801051273762,
3546727638371079,
3546800180955840,
3546761314437560,
392427789,
35467994385640,
3546799820245917,
3546652392557205,
3546717068724629,
3546753796147450,
3546787363162777,
3546801032399259,
1920869180,
3546643234294080,
3546611160451732,
3546775468116645,
3546783410030893,
3546786138426143,
3546752472844964,
3546791603604305,
3546799553906720,
354678115559314,
3546761213774310,
3546670105102441,
3546766007863749,
1738856490,
1332005285,
3546641321691585,
1355276337,
1830422345,
3546654596663481,
3546655892704220,
279502432,
279513013,
3546655332764461,
3546654600858402,
309933628,
3546655320180802,
3546604273404664,
160175853,
3546644503070732,
3546654569400348,
3546641378314251,
309831342,
3546656096127238,
279513321,
3546656458934573,
3546656320522794,
279480466,
3546591902305090,
3546655309695289,
3546655309695289,
1394122135,
3546655911578057,
1513289763,
3546615371532754,
3546646216444670,
303357826,
279479713,
279513114,
3546617988778048,
3546655794137734,
279515243,
3546794279570035,
3494357984348463,
3546656089836096,
3546654628121144,
3546655603296263,
3546654412114113,
3546659585788033,
279483805,
3546720430459349,
3546572845484288,
322261454,
3546652788918432,
310642212,
358678229,
3546654896556552,
302957418,
3546654651189340,
3546654728783954,
3546655120951761,
279514807,
3546653455812609,
3546655257266311,
247830048,
3546654433085698,
3546654814767278,
3546654649092931,
306251576,
3546609885383132,
3546655873829041,
3546655167089082,
3546656630901576,
3546656630901576,
3546656142264973,
3546654852516240,
3546656148555885,
3546564140206536,
3546564140206536,
303349303];