|
|
 - // ==UserScript==
- // @name Auto Cita Barcelona NIE (With Audio Alert)
- // @namespace http://tampermonkey.net/
- // @version 1.4
- // @description 自动预约NIE指纹 CITA (Barcelona),修复误报并加入蜂鸣声音提醒
- // @match https://icp.administracionelectronica.gob.es/icpplustieb/*
- // @match https://icp.administracionelectronica.gob.es/icpplus/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // 个人信息配置
- const NIE = "X0000000X";
- const FULLNAME = "MINGZI XING";
- const NATIONALITY = "CHINA";
- // 简单日志
- function log(msg) {
- console.log("[CITA] " + msg);
- }
- // ???? 核心功能:播放警报蜂鸣声
- function playAlertSound() {
- try {
- const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
- const oscillator = audioCtx.createOscillator();
- const gainNode = audioCtx.createGain();
- oscillator.type = 'sine'; // 声音类型:正弦波(哔哔声)
- oscillator.frequency.setValueAtTime(880, audioCtx.currentTime); // 音高:880Hz(比较清脆刺耳的高音)
- gainNode.gain.setValueAtTime(0.5, audioCtx.currentTime); // 音量:0.5
- oscillator.connect(gainNode);
- gainNode.connect(audioCtx.destination);
- oscillator.start();
- // 响铃 0.8 秒后自动停止,配合外层的 setInterval 形成“哔-- 哔--”的间歇警报效果
- setTimeout(() => {
- oscillator.stop();
- audioCtx.close();
- }, 800);
- } catch (e) {
- log("播放声音失败(可能是浏览器权限限制): " + e);
- }
- }
- // 首页:选择省份 Barcelona
- if (location.pathname.endsWith("/index.html") || location.pathname.endsWith("/index")) {
- log("首页:选择省份 Barcelona");
- const sel = document.querySelector("select[name='form']");
- if (sel) {
- for (let opt of sel.options) {
- if (opt.text.toUpperCase().includes("BARCELONA")) {
- sel.value = opt.value;
- break;
- }
- }
- const btn = document.querySelector("input[type='submit'], button[type='submit']");
- if (btn) setTimeout(() => btn.click(), 800);
- }
- }
- // 业务选择页:选择 TOMA DE HUELLA
- else if (location.pathname.includes("/citar")) {
- log("业务选择页:选择 TOMA DE HUELLA");
- const sel = document.querySelector("select[name='tramiteGrupo[0]']");
- if (sel) {
- sel.value = "4010"; // TOMA DE HUELLA
- const btn = document.querySelector("input[type='submit'], button[type='submit']");
- if (btn) setTimeout(() => btn.click(), 500);
- }
- }
- // 填写个人资料页
- else if (location.pathname.includes("/acEntrada")) {
- log("填写个人资料(手动点击 Aceptar)");
- const inputNie = document.querySelector("input[name='txtIdCitado']");
- const inputName = document.querySelector("input[name='txtDesCitado']");
- if (inputNie) inputNie.value = NIE;
- if (inputName) inputName.value = FULLNAME;
- // 自动选择国籍 CHINA
- const sel = document.querySelector("select[name='txtPaisNac']");
- if (sel) {
- for (let opt of sel.options) {
- if (opt.text.trim().toUpperCase() === NATIONALITY.toUpperCase()) {
- sel.value = opt.value;
- break;
- }
- }
- }
- log("【提示】个人信息已自动填好,请手动点击 Aceptar");
- }
- // 进入验证页:点击 SOLICITAR CITA
- else if (location.pathname.includes("/acValidarEntrada")) {
- log("点击 SOLICITAR CITA");
- const btn = [...document.querySelectorAll("input[type='submit']")]
- .find(b => b.value.toUpperCase().includes("SOLICITAR"));
- if (btn) setTimeout(() => btn.click(), 500);
- }
- // Cita 结果页:精确检测是否有号
- else if (location.pathname.includes("/acCitar")) {
- const bodyText = document.body.innerText.toUpperCase();
- // 1. 优先排除被防火墙拒绝或者系统崩溃的情况(防止误报有号)
- if (bodyText.includes("REQUESTED URL WAS REJECTED") || bodyText.includes("FORBIDDEN") || bodyText.includes("ERROR")) {
- log("❌ 糟糕,IP可能被封锁!停止自动刷新。");
- alert("⚠️ 访问被防火墙拒绝(Rejected)!请切换网络(手机热点)再试。");
- return;
- }
- // 2. 定义官方经典的几种“无号”核心提示语
- const noCitaKeywords = [
- "EN ESTE MOMENTO NO HAY CITAS DISPONIBLES",
- "NO HAY CITAS DISPONIBLES",
- "NO ENCONTRADO CITAS",
- "En este momento no hay citas disponibles."
- ];
- // 检查页面是否包含任意一个无号关键词
- const hasNoCita = noCitaKeywords.some(keyword => bodyText.includes(keyword));
- if (hasNoCita) {
- log("当前无号,45秒后自动刷新重试...");
- setTimeout(() => location.reload(), 45000);
- } else {
- // 排除无号,排除报错 —— 确定有位置了!
- log("???? 发现可用 CITA !!!");
- // 每隔 1.5 秒鸣叫一次警报声,直到你处理页面
- playAlertSound(); // 先响第一声
- const soundInterval = setInterval(playAlertSound, 1500);
- // 弹出提示框(点击确定后会关闭声音)
- alert("???? 发现可用 CITA !!!请立刻手动选择办公室并确认!");
- clearInterval(soundInterval); // 你点了弹窗的确定后,关闭警报声音
- }
- }
- })();
复制代码 以上是电脑版本。以下是手机版本。
- // ==UserScript==
- // @name Auto Cita Barcelona NIE (Mobile Ultimate Edition)
- // @namespace http://tampermonkey.net/
- // @version 2.0
- // @description 自动预约NIE指纹(手机深度优化 + 人类行为仿真 + 彻底解决Not Found)
- // @match https://icp.administracionelectronica.gob.es/icpplustieb/*
- // @match https://icp.administracionelectronica.gob.es/icpplus/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // =================================================================
- // 个人信息配置(已为你保持原样)
- // =================================================================
- const NIE = "居留号";
- const FULLNAME = "名-姓";
- const NATIONALITY = "CHINA";
- // 简单日志输出
- function log(msg) {
- console.log("[CITA] " + msg);
- }
- // ???? 核心功能:播放警报蜂鸣声(高频清脆哔哔声)
- function playAlertSound() {
- try {
- const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
- const oscillator = audioCtx.createOscillator();
- const gainNode = audioCtx.createGain();
- oscillator.type = 'sine';
- oscillator.frequency.setValueAtTime(880, audioCtx.currentTime); // 880Hz 刺耳高音
- gainNode.gain.setValueAtTime(0.5, audioCtx.currentTime); // 音量
- oscillator.connect(gainNode);
- gainNode.connect(audioCtx.destination);
- oscillator.start();
- // 响铃 0.8 秒后自动停止,配合外层的 setInterval 形成间歇警报
- setTimeout(() => {
- oscillator.stop();
- audioCtx.close();
- }, 800);
- } catch (e) {
- log("播放声音失败(可能是浏览器权限限制): " + e);
- }
- }
- // ????️ 移动端核心防卡:仿真人输入,并强制触发下拉菜单的系统更换事件
- function simulateHumanInput(element, value) {
- element.value = value;
- element.dispatchEvent(new Event('input', { bubbles: true }));
- element.dispatchEvent(new Event('change', { bubbles: true }));
- element.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' }));
- element.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true, key: 'Enter' }));
- }
- // 生成随机延迟时间(让每次操作间隔都不同,完美迷惑防火墙行为审计)
- function getRandomDelay(min, max) {
- return Math.floor(Math.random() * (max - min + 1) + min);
- }
- // 1. 首页:自动选择省份 Barcelona
- if (location.pathname.endsWith("/index.html") || location.pathname.endsWith("/index") || location.pathname === "/icpplustieb/" || location.pathname === "/icpplus/") {
- log("首页:正在自动探测省份下拉框...");
- const checkSelect = setInterval(() => {
- const sel = document.querySelector("select[name='form']") || document.getElementById('provincia');
- if (sel && sel.options.length > 1) {
- clearInterval(checkSelect); // 抓取成功,清除定时器
-
- // 模拟人类:进页面发呆 1.2 - 2 秒再选择
- setTimeout(() => {
- for (let opt of sel.options) {
- if (opt.text.toUpperCase().includes("BARCELONA")) {
- simulateHumanInput(sel, opt.value);
- log("成功选择省份: BARCELONA");
- break;
- }
- }
- // 选完再等 1 秒多才点提交
- setTimeout(() => {
- const btn = document.querySelector("input[type='submit'], button[type='submit']");
- if (btn) { btn.click(); log("首页已成功提交"); }
- }, getRandomDelay(1000, 1500));
- }, getRandomDelay(1200, 2000));
- }
- }, 200);
- }
- // 2. 业务选择页:自动选择 TOMA DE HUELLA
- else if (location.pathname.includes("/citar")) {
- log("业务选择页:正在自动选择项目...");
- const checkTramite = setInterval(() => {
- const sel = document.querySelector("select[name='tramiteGrupo[0]']") || document.querySelector("select[id*='tramite']");
- if (sel && sel.options.length > 1) {
- clearInterval(checkTramite);
-
- // 模拟人类:等 1.5 到 2.5 秒再选项目
- setTimeout(() => {
- let found = false;
- for (let opt of sel.options) {
- if (opt.value === "4010" || opt.text.toUpperCase().includes("TOMA DE HUELLAS")) {
- simulateHumanInput(sel, opt.value);
- log("成功选择业务: TOMA DE HUELLAS (4010)");
- found = true;
- break;
- }
- }
- if(found) {
- // 选完再等 1.2 秒提交
- setTimeout(() => {
- const btn = document.querySelector("input[type='submit'], button[type='submit']");
- if (btn) { btn.click(); log("业务页已成功提交"); }
- }, getRandomDelay(1200, 1800));
- }
- }, getRandomDelay(1500, 2500));
- }
- }, 200);
- }
- // 3. 填写个人资料页:自动秒填数据
- else if (location.pathname.includes("/acEntrada")) {
- log("资料页:正在快速填写个人隐私数据...");
- setTimeout(() => {
- const inputNie = document.querySelector("input[name='txtIdCitado']");
- const inputName = document.querySelector("input[name='txtDesCitado']");
- const sel = document.querySelector("select[name='txtPaisNac']");
- if (inputNie) simulateHumanInput(inputNie, NIE);
-
- // 故意延迟 500 毫秒填名字和国籍,模仿手速
- setTimeout(() => {
- if (inputName) simulateHumanInput(inputName, FULLNAME);
- if (sel) {
- for (let opt of sel.options) {
- if (opt.text.trim().toUpperCase() === NATIONALITY.toUpperCase()) {
- simulateHumanInput(sel, opt.value);
- break;
- }
- }
- }
- log("【安全提示】所有资料已瞬间填好,请您【手动】点击大红按钮 Aceptar 提交!");
- }, 500);
- }, 1000);
- }
- // 4. 验证确认页:自动点击 SOLICITAR
- else if (location.pathname.includes("/acValidarEntrada")) {
- log("确认页:模拟人类阅读 1.2 秒后自动进入最后一步...");
- setTimeout(() => {
- const btn = [...document.querySelectorAll("input[type='submit']")]
- .find(b => b.value.toUpperCase().includes("SOLICITAR"));
- if (btn) { btn.click(); log("已成功点击 SOLICITAR CITA"); }
- }, getRandomDelay(1200, 1800));
- }
- // 5. Cita 结果页:智能判定有无号,利用后退流完美替代刷新
- else if (location.pathname.includes("/acCitar")) {
- const bodyText = document.body.innerText.toUpperCase();
- // 优先拦截系统异常、封IP、或彻底断线的极端情况
- if (bodyText.includes("NOT FOUND") || bodyText.includes("REQUESTED URL WAS REJECTED") || bodyText.includes("FORBIDDEN") || bodyText.includes("CADUCADA") || bodyText.includes("EXPIRADO")) {
- log("❌ 页面异常或登录会话失效!5秒后自动强制跳回最开始的首页彻底重来...");
- setTimeout(() => {
- location.href = "https://icp.administracionelectronica.gob.es/icpplustieb/index.html";
- }, 5000);
- return;
- }
- // 定义官方标准的无号关键词
- const noCitaKeywords = ["EN ESTE MOMENTO NO HAY CITAS DISPONIBLES", "NO HAY CITAS DISPONIBLES", "NO ENCONTRADO CITAS", "En este momento no hay citas disponibles"];
- const hasNoCita = noCitaKeywords.some(keyword => bodyText.includes(keyword));
- if (hasNoCita) {
- // 设置一个安全的查号等待期(35-45秒随机),防止高频刷新被系统拉黑
- const reloadDelay = getRandomDelay(35000, 45000);
- log(`当前暂无可用卡位。为了防止 Not Found 错误,系统将在 ${(reloadDelay/1000).toFixed(1)} 秒后自动后退并重新点进查询...`);
-
- setTimeout(() => {
- const btnVolver = document.querySelector("input[value='Volver'], input[value='Aceptar']");
- if (btnVolver) {
- btnVolver.click(); // 优先点击网页自带的红按钮退回第4步
- log("已模拟点击 Volver 按钮退回。");
- } else {
- history.back(); // 备用方案:通过浏览器历史记录强行后退
- log("未找到按钮,执行浏览器底层后退。");
- }
- }, reloadDelay);
- } else {
- // 恭喜!排除所有异常和无号词,代表放号了!
- log("???? 火力全开!发现可用指纹卡位 CITA !!!");
- // 启动疯狂鸣叫警报机制
- playAlertSound();
- const soundInterval = setInterval(playAlertSound, 1500);
- // 弹出强力锁屏弹窗,等你来处理
- alert("???? 恭喜!系统发现可用 CITA !!!请立刻点击确定,然后以最快速度手动选择办公室并锁定你的号!");
- clearInterval(soundInterval); // 一旦你手点了弹窗的确定,警报声才会关闭
- }
- }
- })();
复制代码
|
评分
-
查看全部评分
|