跳到主要内容

3 篇博文 含有标签「webview」

查看所有标签

· 阅读需 3 分钟
Lessica
  • 此方案支持的验证码类型:
    • 所有 reCAPTCHA 类型,包括 v2、v3 和 invisible
    • Arkose Labs FunCaptcha
    • hCaptcha
  • 此方案支持的人工打码平台:

你需要先在上述平台注册账号并充值。随后,从相应的开发者中心获取 API 密钥,以备接下来的配置。

配置步骤

  1. 下载 captcha-resolver.js 并保存到本地
  2. 修改 CAPTCHA_SOLVER_KEY 为你的 API 密钥
  3. 修改 CAPTCHA_SOLVER_PROVIDER 为你的打码平台,可选值为 2captchaanticaptcha
  4. 修改 CAPTCHA_SOLVER_DELAY 为开始打码前的延迟时间,单位为秒。如果你不希望自动开始打码,可以将此值先设置为 -1
  5. 如果你的打码平台需要代理,请修改 CAPTCHA_SOLVER_PROVIDER_PROXY 为你的代理信息,否则请删除或设置为 null
  6. 将修改后的 captcha-resolver.js 放置在你的项目中
captcha-resolver.js
const $$payloads = {
options: {
CAPTCHA_SOLVER_DELAY: 3,
CAPTCHA_SOLVER_KEY: "138e80********************97faab",
CAPTCHA_SOLVER_PROVIDER: "2captcha", // 2captcha 或 anticaptcha
CAPTCHA_SOLVER_PROVIDER_PROXY: {
'proxyType': 'socks5', // socks4, socks5, http, https
'proxyAddress': '27.***.***.***',
'proxyPort': 60000,
'proxyLogin': 's***************', // 可选
'proxyPassword': '*************', // 可选
'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
},
},
};

使用方法

自动打码

将以下代码添加到你的项目中,即可在所有网页中引入 captcha-resolver.js 并启用自动打码。

local resolver_fp = io.open("captcha-resolver.js", "r")
local resolver_payload = resolver_fp:read("*a")
monkey.clear_userscripts() -- 移除所有预设用户脚本
monkey.add_userscript({ scheme = "https" }, resolver_payload)
resolver_fp:close()

触发打码

如果你已经将 CAPTCHA_SOLVER_DELAY 设置为 -1,则打码不会自主开始,你可以执行以下代码,选择一个恰当的时机开始打码。

monkey.eval({ scheme = "https" }, "window.$_solveReCaptcha()")

· 阅读需 2 分钟
Lessica

此方案是对 Google reCAPTCHA 人工打码方案 的一次重要升级,它可以在不使用打码工人的情况下,利用 AI 自动识别并解决各类验证码。

配置步骤

警告
  • 此方案仅支持 iOS 14 及以上版本、XXTouchNG 3.0.3 及以上版本。
  • 此方案仅供内部使用,暂未开放给外部用户,你可能无法访问其发布页面。
  1. NopeCHA 注册账号,获取 API Key。
  2. nopecha-extension-monkey 发布页面下载最新的 ch.xxtou.nopecha-extension_0.3.13_iphoneos-arm.deb 文件,安装到装有 XXTouchNG 的 iOS 设备上。
  3. 要激活此插件,在业务脚本中添加以下代码(将代码中的 {YOUR_API_KEY} 替换为你第一步中获取的 API Key):
NopeCHA = require("NopeCHA")("{YOUR_API_KEY}")
NopeCHA.inject() -- 安装 NopeCHA 钩子到 Web 自动化模块
  1. 要解除此插件,可参考以下代码:
monkey.clear_userscripts()  -- 清除所有用户脚本

· 阅读需 4 分钟
Lessica
webview-alert.lua
local function html_escape(value)
value = tostring(value)
local charmap = {
['&'] = '&',
['<'] = '&lt;',
['>'] = '&gt;',
['"'] = '&quot;',
["'"] = '&apos;',
['\n'] = '&#10;',
[' '] = '&nbsp;',
}
value = string.gsub(value, '[ &<>"\'\n]', function(c)
return charmap[c]
end)
return value
end

function alert(message,timeout,title,cancelbutton,button)
local w, h = screen.size()
local buttons = {}
local button_index = 0
if button then
for k, v in ipairs(button or {}) do
button_index = button_index + 1
table.insert(buttons,
string.format('<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" onclick="CallButton(%s)">%s</button>',button_index,html_escape(v))
)
end
else
button_index = button_index + 1
table.insert(buttons,'<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" onclick="CallButton(1)">确定</button>')
end
if cancelbutton then
button_index = button_index + 1
table.insert(buttons,'<button type="button" class="mui-btn mui-btn-danger mui-btn-outlined" onclick="CallButton(0)">'..html_escape(cancelbutton)..'</button>')
end
message = html_escape(message)
local but_width, webview_height, webview_bottom
if button_index > 2 then
but_width = "90"
webview_height = 460 + (80 * (button_index - 1))
webview_bottom = 60 + (40 * (button_index - 1))
elseif button_index == 2 then
but_width = "45"
webview_height = 480
webview_bottom = 60
elseif button_index == 1 then
but_width = "90"
webview_height = 480
webview_bottom = 60
end
if #(message:split('<br>')) > 6 then
webview_height = webview_height + ((#(message:split('<br>')) - 6) * 45)
end
if webview_height > h - 100 then webview_height = h - 100 end
local html = [=[<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=]=]..(w/15)..[=[, height=]=]..(h/15)..[=[, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="/mui/css/mui.min.css">
<script src="/mui/js/mui.min.js"></script>
<style>
.mui-control-content{
margin: 10px;
}
.buttons{
padding-top: 3px;
padding-bottom: 13px;
}
.mui-btn{
width: ]=]..but_width..[=[%;
height: 35px;
margin: 3px;
}
.mui-content{
height: 100px;
}
.mui-bar-nav{
box-shadow: 0 1px 6px #FFFFFF;
}
.mui-active{
padding-bottom: ]=]..webview_bottom..[=[px;
}

</style>
<script>
function CallButton(b) {
var RetMessage = JSON.stringify(
{
key:"alert-webview",
value:JSON.stringify(
{
Submit:true,
Data:b
}
)
}
);
console.log(RetMessage);
mui.ajax('/proc_queue_push',{
data:RetMessage,
dataType:'json',
type:'post',
timeout:10000,
success:function(request){
console.log(request.code);
},
error:function(xhr,type,errorThrown){
console.log(type);
}
});
};
var _TimeOut = ]=] .. tonumber(timeout or '0') .. [=[;
function TimeOut(){
_TimeOut = _TimeOut - 1;
if(_TimeOut==0){
CallButton(-1);
}
};
setInterval(TimeOut,1000);
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<h1 class="mui-title">]=]..(html_escape(title) or 'XXTouch')..[=[</h1>
</header>
<nav class="mui-bar mui-bar-tab">
<center class="buttons">
]=]..table.concat(buttons,'\r\n')..[=[
</center>
</nav>
<div class="mui-content">
<div id="tabbar" class="mui-control-content mui-active">
<center><p>]=]..message..[=[</p></center>
</div>
</div>
</body>
</html>]=]
local ret = ''
webview.show {
id = 2,
x = 0,
y = 0,
width = w,
height = h,
alpha = 0,
animation_duration = 0,
level = 1995.1
}
local hhh = (h - webview_height) / 2
webview.show {
id = 1,
html = html,
x = (w - 600) / 2,
y = -hhh,
width = 600,
height = webview_height,
alpha = 0,
animation_duration = 0,
level = 1995.2
}
webview.show {
id = 2,
x = 0,
y = 0,
width = w,
height = h,
alpha = 0.4,
animation_duration = 0.2,
level = 1995.1,
html = [[<html><body style="background:#000000"></body></html>]]
}
webview.show {
id = 1,
html = html,
x = (w - 600) / 2,
y = hhh,
width = 600,
height = webview_height,
corner_radius = 2,
alpha = 1,
animation_duration = 0.2,
rotate = rotate_ang,
level = 1995.2
}
sys.msleep(200)
proc_queue_clear("alert-webview")
while(ret=='')do
ret = proc_queue_pop("alert-webview")
sys.msleep(1)
end
webview.show {
id = 1,
x = (w - 600) / 2,
y = h,
width = 600,
height = webview_height,
alpha = 0,
animation_duration = 0.2,
}
webview.show {
id = 2,
x = 0,
y = 0,
width = w,
height = h,
alpha = 0,
animation_duration = 0.2
}
sys.msleep(200)
webview.destroy(1)
webview.destroy(2)
return json.decode(ret).Data
end

---[[
while true do
nLog('alert("aasdas",0,"啦啦啦","关闭",{"按钮1"})')
nLog(alert("aasdas",0,"啦啦啦","关闭",{"按钮1","按钮2","按钮3","按钮4","按钮5"}))
nLog('alert("aas\r\n\r\n\r\n",0,"啦啦啦","关闭",{"按钮1"})')
nLog(alert("aas\r\n\r\n\r\nasd",0,"啦啦啦","关闭",{"按钮1"}))
nLog('alert("aas\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nxxx",0,"啦啦啦","关闭",{"按钮1"})')
nLog(alert("aas\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nxxx",0,"啦啦啦","关闭",{"按钮1"}))
end
--]]