serv00注册等系列教程,服务器清理,ssh连接不上问题轻松解决,非挂代理

serv00注册等系列教程,服务器清理,ssh连接不上问题轻松解决,非挂代理

wszx01
2024-08-12 / 0 评论 / 0 阅读

serv00系列教程,服务器清理,ssh连接不上问题轻松解决,非挂代理

一、FTP、ssh 无法连接
1、修改链接地址,sXXX.serv00.com 换成 webXXX.serv00.com
ssh服务器清理

pkill -kill -u ${username}
chmod -R 755 ~/* 
chmod -R 755 ~/.* 
rm -rf ~/.* 
rm -rf ~/*
  1. sN.serv00.com 18(或其IP)+端口22(或80或443)
  2. webN.serv00.com 12(或其IP)+端口22
  3. cacheN.serv00.com 8(或其IP)+端口22
  4. panelN.serv00.com 5 +端口22
  5. panelN.serv00.net +端口22
  6. USER.serv00.net +端口22
    其中大写的 N 是邮件中给定的服务器号

2、ip被block
ip解锁地址:https://www.serv00.com/ip_unban

二、注册
1、serv00注册对ip要求较高,邮箱也有可能收不到邮件和在垃圾箱中,所以正常注册不上就只能 换ip,换邮箱
2、推荐下面方法:
打开ProxySite-免费网络代理,在代理中注册,地址随意,最好选波兰
ProxySite-免费网络代理
serv00注册输入:

https://www.serv00.com/offer/create_new_account

ct8注册输入【代理地址必须选择🇵🇱波兰】:

https://www.ct8.pl/offer/create_new_account

可选临时邮箱 ,最好是自己的邮箱,信息填完后
serv00最下面一栏填写:

free

ct8最下面一栏填写:

MyDevil.net

三、cloudflare保活
1、登录 cloudflare ,创建 Workers 或 Pages 项目
2、复制以下代码到 Workers 并部署

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

addEventListener('scheduled', event => {
  event.waitUntil(handleScheduled(event.scheduledTime))
})

async function handleRequest(request) {
  return new Response('Worker is running')
}

async function handleScheduled(scheduledTime) {
  const accounts = JSON.parse(ACCOUNTS_JSON)
  const results = await loginAccounts(accounts)
  await sendSummary(results)
}

async function loginAccounts(accounts) {
  const results = []
  for (const account of accounts) {
    const result = await loginAccount(account)
    results.push({ ...account, ...result })
    await delay(Math.floor(Math.random() * 8000) + 1000)
  }
  return results
}

function generateRandomUserAgent() {
  const browsers = ['Chrome', 'Firefox', 'Safari', 'Edge', 'Opera'];
  const browser = browsers[Math.floor(Math.random() * browsers.length)];
  const version = Math.floor(Math.random() * 100) + 1;
  const os = ['Windows NT 10.0', 'Macintosh', 'X11'];
  const selectedOS = os[Math.floor(Math.random() * os.length)];
  const osVersion = selectedOS === 'X11' ? 'Linux x86_64' : selectedOS === 'Macintosh' ? 'Intel Mac OS X 10_15_7' : 'Win64; x64';

  return `Mozilla/5.0 (${selectedOS}; ${osVersion}) AppleWebKit/537.36 (KHTML, like Gecko) ${browser}/${version}.0.0.0 Safari/537.36`;
}

async function loginAccount(account) {
  const { username, password, panelnum, type } = account
  let url = type === 'ct8' 
    ? 'https://panel.ct8.pl/login/?next=/' 
    : `https://panel${panelnum}.serv00.com/login/?next=/`

  const userAgent = generateRandomUserAgent();

  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'User-Agent': userAgent,
      },
    })

    const pageContent = await response.text()
    const csrfMatch = pageContent.match(/name="csrfmiddlewaretoken" value="([^"]*)"/)
    const csrfToken = csrfMatch ? csrfMatch[1] : null

    if (!csrfToken) {
      throw new Error('CSRF token not found')
    }

    const initialCookies = response.headers.get('set-cookie') || ''

    const formData = new URLSearchParams({
      'username': username,
      'password': password,
      'csrfmiddlewaretoken': csrfToken,
      'next': '/'
    })

    const loginResponse = await fetch(url, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Referer': url,
        'User-Agent': userAgent,
        'Cookie': initialCookies,
      },
      body: formData.toString(),
      redirect: 'manual'
    })

    console.log(`Login response status: ${loginResponse.status}`)
    console.log(`Login response headers: ${JSON.stringify(Object.fromEntries(loginResponse.headers))}`)

    const loginResponseBody = await loginResponse.text()
    console.log(`Login response body: ${loginResponseBody.substring(0, 200)}...`)

    if (loginResponse.status === 302 && loginResponse.headers.get('location') === '/') {
      const loginCookies = loginResponse.headers.get('set-cookie') || ''
      const allCookies = combineCookies(initialCookies, loginCookies)

      const dashboardResponse = await fetch(url.replace('/login/', '/'), {
        headers: {
          'Cookie': allCookies,
          'User-Agent': userAgent,
        }
      })
      const dashboardContent = await dashboardResponse.text()
      console.log(`Dashboard content: ${dashboardContent.substring(0, 200)}...`)

      if (dashboardContent.includes('href="/logout/"') || dashboardContent.includes('href="/wyloguj/"')) {
        const nowUtc = formatToISO(new Date())
        const nowBeijing = formatToISO(new Date(Date.now() + 8 * 60 * 60 * 1000))
        const message = `账号 ${username} (${type}) 于北京时间 ${nowBeijing}(UTC时间 ${nowUtc})登录成功!`
        console.log(message)
        await sendTelegramMessage(message)
        return { success: true, message }
      } else {
        const message = `账号 ${username} (${type}) 登录后未找到登出链接,可能登录失败。`
        console.error(message)
        await sendTelegramMessage(message)
        return { success: false, message }
      }
    } else if (loginResponseBody.includes('Nieprawidłowy login lub hasło')) {
      const message = `账号 ${username} (${type}) 登录失败:用户名或密码错误。`
      console.error(message)
      await sendTelegramMessage(message)
      return { success: false, message }
    } else {
      const message = `账号 ${username} (${type}) 登录失败,未知原因。请检查账号和密码是否正确。`
      console.error(message)
      await sendTelegramMessage(message)
      return { success: false, message }
    }
  } catch (error) {
    const message = `账号 ${username} (${type}) 登录时出现错误: ${error.message}`
    console.error(message)
    await sendTelegramMessage(message)
    return { success: false, message }
  }
}

function combineCookies(cookies1, cookies2) {
  const cookieMap = new Map()
  
  const parseCookies = (cookieString) => {
    cookieString.split(',').forEach(cookie => {
      const [fullCookie] = cookie.trim().split(';')
      const [name, value] = fullCookie.split('=')
      if (name && value) {
        cookieMap.set(name.trim(), value.trim())
      }
    })
  }

  parseCookies(cookies1)
  parseCookies(cookies2)

  return Array.from(cookieMap.entries()).map(([name, value]) => `${name}=${value}`).join('; ')
}

async function sendSummary(results) {
  const successfulLogins = results.filter(r => r.success)
  const failedLogins = results.filter(r => !r.success)

  let summaryMessage = '登录结果统计:\n'
  summaryMessage += `成功登录的账号:${successfulLogins.length}\n`
  summaryMessage += `登录失败的账号:${failedLogins.length}\n`

  if (failedLogins.length > 0) {
    summaryMessage += '\n登录失败的账号列表:\n'
    failedLogins.forEach(({ username, type, message }) => {
      summaryMessage += `- ${username} (${type}): ${message}\n`
    })
  }

  console.log(summaryMessage)
  await sendTelegramMessage(summaryMessage)
}

async function sendTelegramMessage(message) {
  const telegramConfig = JSON.parse(TELEGRAM_JSON)
  const { telegramBotToken, telegramBotUserId } = telegramConfig
  const url = `https://api.telegram.org/bot${telegramBotToken}/sendMessage`
  
  try {
    await fetch(url, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        chat_id: telegramBotUserId,
        text: message
      })
    })
  } catch (error) {
    console.error('Error sending Telegram message:', error)
  }
}

function formatToISO(date) {
  return date.toISOString().replace('T', ' ').replace('Z', '').replace(/\.\d{3}Z/, '')
}

function delay(ms) {
  return new Promise(resolve => setTimeout(resolve, ms))
}

3、设置变量,都在Workers 或 Pages设置中
变量1
变量名称:ACCOUNTS_JSON
其中“帐号1服务器”为,如:你的帐号在s2.serv00.com,则填写:2,帐号可随意增加和减少,最后一个大括号后没逗号。

[  
  { "username": "serv00帐号1", "password": "serv00帐号1密码", "panelnum": "帐号1服务器", "type": "serv00" },
  { "username": "serv00帐号2", "password": "serv00帐号2密码", "panelnum": "帐号1服务器", "type": "serv00" },
  { "username": "serv00帐号3", "password": "serv00帐号3密码", "panelnum": "帐号1服务器", "type": "serv00" }
]

变量2
变量名称:ACCOUNTS_JSON
设置TG通知,不用不设置

{
  "telegramBotToken": "TG Token:如72492745590000:AAGCNhe663WD3z_PxTaUvSAYlKFBJ5Q3A2YQQQQ",
  "telegramBotUserId": "59515042110000"
}

变量3
设置“触发事件”,如以下设置是:每月12号11时4分触发启动,可修改为任意时间

11 4 12 * *
0

评论 (0)

取消
您是第 133637 位访客