pbby 发表于 2025-4-21 23:47:30

榨干在 Serv00 最后价值之反代 Huggingface 私有空间

本帖最后由 pbby 于 2025-4-21 23:48 编辑

Serv00 疯狂杀号后,很多服务都已经不能部署了,这里分享一个通过 Serv00 反代 Huggingface 私有空间的脚本。
首先登录面板添加一个 Node.js 类型的域名,如果没有域名就先删除默认域名,如果有域名填写自定义域名即可。

然后添加后登录 SSH ,切换到新建域名的目录中 cd domains/域名/public_nodejs
运行 npm install http https jsonwebtoken axios http-proxy 先安装脚本需要的依赖
新建一个 app.js 把下面的脚本贴进去,注意修改config部分的user、space、token
**** Hidden Message *****
完成后删除public_nodejs下public里面的index.html 然后在面板重启网站即可。

如果有需要修改响应包头的可以修改我注释的这部分。
proxy.on("proxyRes", (proxyRes, req, res) => {});

kst 发表于 2025-4-24 00:24:06

有什么用了

kira 发表于 2025-4-24 09:51:35

学习,谢谢

enzur 发表于 2025-4-24 10:03:00

感谢分享

pbby 发表于 2025-4-26 20:21:54

kst 发表于 2025-4-24 00:24
有什么用了

悲报,serv00又死一批,操蛋serv00{tieba27}

复制空间部署验证码识别api: https://huggingface.co/spaces/adhuai/Captcha-api
调用:curl -X POST https://adhuai-captcha-api.hf.space/api/v1/captcha \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/captcha.png"}'
返回示例:{
"text": "abcd1234"
}
验证码示例:

自动注册serv00油猴脚本(本来想接入ai没有测试就关闭注册了):
// ==UserScript==
// @name         Auto Fill Account Creation Form with Dynamic Question Answer
// @namespace    http://tampermonkey.net/
// @version      1.34
// @description执行serv00注册脚本。
// @author       You
// @match      https://www.serv00.com/offer/create_new_account
// @match      https://www.serv00.com/*
// @grant      GM_xmlhttpRequest
// @grant      GM_addStyle
// @grant      unsafeWindow
// ==/UserScript==

(function () {
    'use strict';

    const maxIterations = 5000; // 最大迭代次数
    const executeKey = 'execute_in_progress';
    const usernameKey = 'saved_username';
    const emailKey = 'saved_email';
    const iterationKey = 'current_iteration';
    const timeoutDuration = 15000; // 15秒超时
    const ocrRequestTimeout = 10000; // OCR请求超时

    let iterationCount = parseInt(localStorage.getItem(iterationKey) || '0', 10);

    // 问题与答案的映射函数
    function getAnswerForQuestion(questionText) {
      const mapping = {
"What is the only mammal capable of true flight?": "bats",
"What is the chemical symbol for gold?": "Au",
"What is the capital of France?": "Paris",
"What is the term for a word that is spelled the same forwards and backwards?": "palindrome",
"What is the only planet that rotates on its side?": "Uranus",
"What is the capital of Italy?": "Rome",
"What is the capital of Japan?": "Tokyo",
"What is the primary ingredient in traditional hummus?": "cooked chickpeas",
"What is the capital of Australia?": "Canberra",
"What is the main ingredient in guacamole?": "avocado",
"What is the term for a collection of data stored in a computer system?": "database",
"What is the smallest unit of data in computing?": "bit",
"What is the primary programming language used for iOS app development?": "Swift",
"What is the term for a function that calls itself?": "recursive function",
"What is the main programming language used for web development?": "JavaScript",
"What is the primary programming language used for Android development?": "Kotlin",
"What is the most widely used programming language?": "JavaScript",
"What is the term for a sequence of instructions that a computer can execute?": "program",
"What is the most popular programming language in 2023?": "Python",
"What is the term for the process of finding and fixing bugs in software?": "debugging",
"What is the term for a set of rules that define how data is transmitted over a network?": "protocol",
"What is the main protocol used for transferring files over the Internet?": "FTP",
"What is the primary protocol used for web traffic?": "HTTP/HTTPS",
"What is the primary protocol used for sending email?": "SMTP (Simple Mail Transfer Protocol)",
"What is the term for a data structure that operates on a Last In First Outbasis?": "stack",
"What is the term for the main circuit board in a computer?": "motherboard",
"What is the primary protocol used for secure communication over a computer network?": "TLS ,SSL",
"What is the protocol used for secure data transmission over the internet?": "HTTPS",
"What is the largest planet in our solar system?": "Jupiter",
"What hosting company provides Serv00.com?": "hostUNO.com",
"What is the primary ingredient in bread?": "flour",
"What is the opposite of hot?": "cold",
"What is the only mammal that can fly?": "bat",
"What is the primary gas in Earth's atmosphere?": "nitrogen",
"What is the only planet known to support life?": "Earth",
"What is the opposite of night?": "day",
"What is the hardest natural substance on Earth?": "diamond",
"What is the only element that is a gas at room temperature and is also essential for respiration?": "oxygen",
"What is the term for the fear of long words?": "hippopotomonstrosesquipedaliophobia"
      };
      return mapping || "";
    }

      // 更新 localStorage 状态并触发 storage 事件
    function updateStateInLocalStorage(key, value) {
      localStorage.setItem(key, value);
      window.dispatchEvent(new Event('storage'));
    }

    // 创建输入框和按钮
    function createFormControls() {
      const container = document.createElement('div');
      container.style.position = 'fixed';
      container.style.top = '20px';
      container.style.right = '20px';
      container.style.zIndex = '9999';
      container.style.backgroundColor = '#fff';
      container.style.padding = '10px';
      container.style.borderRadius = '5px';
      container.style.boxShadow = '0 2px 10px rgba(0, 0, 0, 0.1)';

      const usernameInput = document.createElement('input');
      usernameInput.type = 'text';
      usernameInput.placeholder = '请输入用户名';
      usernameInput.value = localStorage.getItem(usernameKey) || '';
      usernameInput.style.marginBottom = '10px';
      usernameInput.style.padding = '5px';
      usernameInput.style.width = '100%';

      const emailInput = document.createElement('input');
      emailInput.type = 'email';
      emailInput.placeholder = '请输入电子邮件';
      emailInput.value = localStorage.getItem(emailKey) || '';
      emailInput.style.marginBottom = '10px';
      emailInput.style.padding = '5px';
      emailInput.style.width = '100%';

      const submitButton = document.createElement('button');
      submitButton.textContent = '执行注册';
      submitButton.style.padding = '5px 10px';
      submitButton.style.cursor = 'pointer';
      submitButton.style.width = '100%';

      const pauseButton = document.createElement('button');
      pauseButton.textContent = '暂停';
      pauseButton.style.padding = '5px 10px';
      pauseButton.style.cursor = 'pointer';
      pauseButton.style.marginTop = '10px';
      pauseButton.style.width = '100%';

      const stopButton = document.createElement('button');
      stopButton.textContent = '停止';
      stopButton.style.padding = '5px 10px';
      stopButton.style.cursor = 'pointer';
      stopButton.style.marginTop = '10px';
      stopButton.style.width = '100%';

      if (localStorage.getItem(executeKey) === 'true') {
            submitButton.style.display = 'none';
      }

      container.appendChild(usernameInput);
      container.appendChild(emailInput);
      container.appendChild(submitButton);
      container.appendChild(pauseButton);
      container.appendChild(stopButton);
      document.body.appendChild(container);

      submitButton.addEventListener('click', function () {
            const username = usernameInput.value.trim();
            const email = emailInput.value.trim();

            if (!username || !email) {
                console.log('请输入用户名和电子邮件!');
                return;
            }

            localStorage.setItem(usernameKey, username);
            localStorage.setItem(emailKey, email);
            localStorage.setItem(executeKey, 'true');
            iterationCount = 0;
            localStorage.setItem(iterationKey, '0');
            submitButton.style.display = 'none';
            pauseButton.style.display = 'inline-block';
            stopButton.style.display = 'inline-block';
            updateStateInLocalStorage('pauseState', '');
            startRegistrationLoop();
      });

      pauseButton.addEventListener('click', function () {
            updateStateInLocalStorage('pauseState', 'paused');
            pauseButton.style.display = 'none';
            submitButton.style.display = 'inline-block';
            console.log('操作已暂停');
      });

      stopButton.addEventListener('click', function () {
            updateStateInLocalStorage('pauseState', 'stopped');
            clearBrowserCacheAndCookies();
            location.reload(true);
      });
    }

    function recognizeCaptcha(captchaImageUrl, callback) {
      const fullCaptchaUrl = captchaImageUrl.includes('https://')
            ? captchaImageUrl
            : 'https://www.serv00.com' + captchaImageUrl.replace('/captcha', '/captcha/image');

      GM_xmlhttpRequest({
            method: 'POST',
            url: 'https://adhuai-captcha-api.hf.space/api/v1/captcha',
            headers: {
                'Content-Type': 'application/json',
            },
            data: JSON.stringify({ image_url: fullCaptchaUrl }),
            onload: function (response) {
                try {
                  const result = JSON.parse(response.responseText);
                  console.log('OCR 结果:', result);
                  callback(result && result.text ? result.text : '');
                } catch (error) {
                  console.error('OCR 识别失败:', error);
                  callback('');
                }
            },
            onerror: function (error) {
                console.error('验证码请求错误:', error);
                callback('');
            },
            timeout: ocrRequestTimeout,
      });
    }

    async function autoFillForm(username, email) {
      const firstNames = ["Tam", "Joseph", "Thomas", "Charles", "Christopher", "Daniel", "Matthew", "Anthony", "Mark", "Donald", "Steven", "Paul", "Andrew", "Joshua", "Kevin", "Brian", "George", "Edward", "Ronald", "Timothy", "Jason", "Jeffrey", "Ryan", "Jacob", "Gary", "Nicholas", "Eric", "Jonathan", "Stephen", "Larry", "Justin", "Scott", "Brandon", "Benjamin", "Samuel", "Gregory", "Frank", "Alexander", "Raymond", "Patrick", "Jack", "Dennis", "Jerry", "Tyler", "Aaron", "Jose", "Adam", "Nathan", "Henry", "Douglas", "Zachary", "Peter", "Kyle", "Ethan", "Walter", "Jeremy", "Harold", "Keith", "Christian", "Roger", "Noah", "Gerald", "Carl", "Terry", "Sean", "Austin", "Arthur", "Lawrence", "Jesse", "Dylan", "Bryan", "Joe", "Jordan", "Billy", "Bruce", "Albert", "Willie", "Gabriel", "Logan", "Alan", "Juan", "Wayne", "Roy", "Ralph", "Randy", "Eugene", "Vincent", "Russell", "Elijah", "Louis", "Bobby", "Philip", "Johnny", "Howard", "Marvin", "Liam", "Oliver", "Elijah", "Jameson", "Mason", "Lucas", "Henry", "Theodore", "Levi", "Sebastian", "Alexander", "Elias", "Julian", "Isaiah", "Hunter", "Ezra", "Carter", "Wyatt", "Grayson", "Asher", "Lincoln", "Hudson", "Parker", "Xavier", "Maxwell", "Emmett", "Weston", "Declan", "Rowan", "Nolan", "Colton", "Beckett", "Miles", "Harrison", "Finn", "Caleb", "Gavin", "Simon", "Brody", "Jasper", "Zane", "Silas", "Elliot", "Phoenix", "Everett", "Damian", "Micah", "Maddox", "Rhett", "Bennett", "Archer", "Ryder", "Roman", "Holden", "Sawyer", "Milo", "Tucker", "Knox", "Jonah", "Graham", "Kingston", "Jace", "Ellis", "Rory", "Atlas", "Zion", "Orion", "Evan", "Hayes", "Kian", "Spencer", "Jude", "Reed", "Tanner", "Cruz", "Barrett", "Luca", "Paxton", "Tristan", "Andre", "Callum", "Dawson", "Shane", "Griffin", "Landon", "Kai", "Clayton", "Dominic", "Kieran", "Rylan", "Reid", "Sullivan", "Otto", "Sterling", "Bowen", "Wesley", "Marshall", "Kobe", "Porter", "Wade"];
      const lastNames = ["Tam", "Joseph", "Thomas", "Charles", "Christopher", "Daniel", "Matthew", "Anthony", "Mark", "Donald", "Steven", "Paul", "Andrew", "Joshua", "Kevin", "Brian", "George", "Edward", "Ronald", "Timothy", "Jason", "Jeffrey", "Ryan", "Jacob", "Gary", "Nicholas", "Eric", "Jonathan", "Stephen", "Larry", "Justin", "Scott", "Brandon", "Benjamin", "Samuel", "Gregory", "Frank", "Alexander", "Raymond", "Patrick", "Jack", "Dennis", "Jerry", "Tyler", "Aaron", "Jose", "Adam", "Nathan", "Henry", "Douglas", "Zachary", "Peter", "Kyle", "Ethan", "Walter", "Jeremy", "Harold", "Keith", "Christian", "Roger", "Noah", "Gerald", "Carl", "Terry", "Sean", "Austin", "Arthur", "Lawrence", "Jesse", "Dylan", "Bryan", "Joe", "Jordan", "Billy", "Bruce", "Albert", "Willie", "Gabriel", "Logan", "Alan", "Juan", "Wayne", "Roy", "Ralph", "Randy", "Eugene", "Vincent", "Russell", "Elijah", "Louis", "Bobby", "Philip", "Johnny", "Howard", "Marvin", "Liam", "Oliver", "Elijah", "Jameson", "Mason", "Lucas", "Henry", "Theodore", "Levi", "Sebastian", "Alexander", "Elias", "Julian", "Isaiah", "Hunter", "Ezra", "Carter", "Wyatt", "Grayson", "Asher", "Lincoln", "Hudson", "Parker", "Xavier", "Maxwell", "Emmett", "Weston", "Declan", "Rowan", "Nolan", "Colton", "Beckett", "Miles", "Harrison", "Finn", "Caleb", "Gavin", "Simon", "Brody", "Jasper", "Zane", "Silas", "Elliot", "Phoenix", "Everett", "Damian", "Micah", "Maddox", "Rhett", "Bennett", "Archer", "Ryder", "Roman", "Holden", "Sawyer", "Milo", "Tucker", "Knox", "Jonah", "Graham", "Kingston", "Jace", "Ellis", "Rory", "Atlas", "Zion", "Orion", "Evan", "Hayes", "Kian", "Spencer", "Jude", "Reed", "Tanner", "Cruz", "Barrett", "Luca", "Paxton", "Tristan", "Andre", "Callum", "Dawson", "Shane", "Griffin", "Landon", "Kai", "Clayton", "Dominic", "Kieran", "Rylan", "Reid", "Sullivan", "Otto", "Sterling", "Bowen", "Wesley", "Marshall", "Kobe", "Porter", "Wade"];

      const firstName = firstNames;
      const lastName = lastNames;

      // 填写文本信息
      document.querySelector('#id_first_name').value = firstName;
      document.querySelector('#id_last_name').value = lastName;
      document.querySelector('#id_username').value = username;
      document.querySelector('#id_email').value = email;

      // 等待服务器响应(假设等待2秒)
      await new Promise(resolve => setTimeout(resolve, 2000));

      // 获取页面上问题文本(p元素的selector)
      const questionElement = document.querySelector('body > section > div > div.columns > div.column.is-half > form > p:nth-child(8)');
      if (!questionElement) {
            console.error('未找到问题元素');
            return false;
      }
      const questionText = questionElement.textContent.trim();
      const answer = getAnswerForQuestion(questionText);
      if (!answer) {
            console.error(`无法匹配问题:${questionText}`);
            return false;
      }
      // 设置 id_question 的值为答案
      document.querySelector('#id_question').value = answer;
      console.log(`问题:“${questionText}” 答案设置为:${answer}`);

      const captchaImage = document.querySelector('img');
      if (!captchaImage) {
            console.error('未找到验证码图片');
            return false;
      }

      // 对验证码识别进行最多 3 次尝试,确保等待识别结果
      const maxCaptchaAttempts = 3;
      let attempt = 0;
      let recognitionSuccess = false;
      while (attempt < maxCaptchaAttempts && !recognitionSuccess) {
            recognitionSuccess = await new Promise((resolve) => {
                recognizeCaptcha(captchaImage.src, (code) => {
                  if (code) {
                        document.querySelector('#id_captcha_1').value = code;
                        resolve(true);
                  } else {
                        resolve(false);
                  }
                });
            });
            if (!recognitionSuccess) {
                attempt++;
                console.log(`验证码识别失败,正在进行第 ${attempt} 次重试...`);
                await new Promise(resolve => setTimeout(resolve, 2000));
            }
      }
      if (!recognitionSuccess) {
            console.log('验证码连续识别失败,本次迭代放弃。');
            return false;
      }

      // 同意条款
      document.querySelector('#id_tos').checked = true;

      return true;
    }

    async function clickSubmitButton() {
      const submitButton = document.querySelector('.control.submit button.is-primary');
      if (submitButton) {
            submitButton.click();
            console.log('提交按钮已点击。');
      } else {
            console.error('未找到提交按钮。');
      }
    }

    // 清理缓存和 cookies(部分浏览器可能不支持全部操作)
    function clearBrowserCacheAndCookies() {
      document.cookie.split(";").forEach(function (c) {
            document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/");
      });
      localStorage.clear();
      sessionStorage.clear();
    }

    async function startRegistrationLoop() {
      const username = localStorage.getItem(usernameKey);
      const email = localStorage.getItem(emailKey);

      while (iterationCount < maxIterations &&
               localStorage.getItem('pauseState') !== 'paused' &&
               localStorage.getItem('pauseState') !== 'stopped') {

            iterationCount++;
            localStorage.setItem(iterationKey, iterationCount.toString());
            console.log(`开始第 ${iterationCount}/${maxIterations} 次迭代`);

            // 每执行 10 次后刷新页面,重新选择问题和填写表单
            if (iterationCount % 10 === 0) {
                console.log('达到 10 次迭代,刷新页面以重新选择问题和填写表单。');
                location.reload(true);
                return;
            }

            if (await autoFillForm(username, email)) {
                await clickSubmitButton();
            } else {
                console.log('本次迭代因填写失败放弃。');
            }
      }

      if (iterationCount >= maxIterations) {
            console.log('所有迭代完成未成功。');
            localStorage.setItem(executeKey, 'false');
      }
      if (localStorage.getItem('pauseState') === 'paused') {
            console.log('操作已暂停');
      }
      if (localStorage.getItem('pauseState') === 'stopped') {
            console.log('操作已停止');
      }
    }

    window.onload = function () {
      createFormControls();

      if (localStorage.getItem(executeKey) === 'true' &&
            localStorage.getItem('pauseState') !== 'paused') {
            startRegistrationLoop();
      }

      window.addEventListener('storage', function (event) {
            if (event.key === 'pauseState' && event.newValue === 'paused') {
                console.log('操作已暂停');
            }
            if (event.key === 'pauseState' && event.newValue === 'stopped') {
                clearBrowserCacheAndCookies();
                location.reload(true);
            }
      });
    };
})();
ct8还活着
页: [1]
查看完整版本: 榨干在 Serv00 最后价值之反代 Huggingface 私有空间