Skip to content

Commit a062b67

Browse files
committed
add aws waf
1 parent ac4716e commit a062b67

12 files changed

Lines changed: 431 additions & 69 deletions

‎awscaptcha.js‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
(async () => {
2+
function is_widget_frame() {
3+
return document.querySelector('#captcha-container > #root #amzn-captcha-verify-button') !== null;
4+
}
5+
6+
function is_image_frame() {
7+
return document.querySelector('#captcha-container > #root #amzn-btn-audio-internal > img[title="Audio problem"]') !== null;
8+
}
9+
10+
function is_audio_frame() {
11+
return document.querySelector('#captcha-container > #root #amzn-btn-audio-internal > img[title="Visual problem"]') !== null;
12+
}
13+
14+
async function on_widget_frame() {
15+
try {
16+
const $verify = document.querySelector('#captcha-container > #root #amzn-captcha-verify-button');
17+
if ($verify) {
18+
$verify.click();
19+
}
20+
} catch (e) {
21+
console.log('error on_widget_frame', e);
22+
}
23+
}
24+
25+
async function on_image_frame() {
26+
try {
27+
const $e = document.querySelector('#captcha-container > #root #amzn-btn-audio-internal');
28+
if ($e) {
29+
$e.click();
30+
}
31+
} catch (e) {
32+
console.log('error on_image_frame', e);
33+
}
34+
}
35+
36+
function get_audio_data() {
37+
try {
38+
const $audio = document.querySelector('audio');
39+
const data = $audio.src.replace('data:audio/aac;base64,', '');
40+
return data;
41+
} catch (e) {
42+
console.log('error get_audio_data', e);
43+
}
44+
return null;
45+
}
46+
47+
let last_audio_data = null;
48+
function on_task_ready(i=200) {
49+
return new Promise(resolve => {
50+
let checking = false;
51+
const check_interval = setInterval(async () => {
52+
if (checking) {
53+
return;
54+
}
55+
checking = true;
56+
57+
const settings = await BG.exec('get_settings');
58+
if (!settings.enabled || !settings.awscaptcha_auto_solve) {
59+
return;
60+
}
61+
62+
const input = document.querySelector('input[placeholder="Answer"]');
63+
if (!input || input.value !== '') {
64+
checking = false;
65+
return;
66+
}
67+
68+
const audio_data = get_audio_data();
69+
if (!audio_data) {
70+
checking = false;
71+
return;
72+
}
73+
74+
if (last_audio_data === audio_data) {
75+
checking = false;
76+
return;
77+
}
78+
last_audio_data = audio_data;
79+
80+
clearInterval(check_interval);
81+
checking = false;
82+
return resolve({input, audio_data});
83+
}, i);
84+
});
85+
}
86+
87+
async function on_audio_frame() {
88+
const {input, audio_data} = await on_task_ready();
89+
90+
if (input === null || audio_data === null) {
91+
return;
92+
}
93+
94+
const settings = await BG.exec('get_settings');
95+
if (!settings.enabled || !settings.awscaptcha_auto_solve) {
96+
return;
97+
}
98+
99+
const solve_start = Time.time();
100+
101+
// Detect images
102+
const {job_id, data} = await NopeCHA.post({
103+
captcha_type: IS_DEVELOPMENT ? 'awscaptcha_dev' : 'awscaptcha',
104+
audio_data: [audio_data],
105+
key: settings.key,
106+
});
107+
if (!data || data.length === 0) {
108+
document.querySelector('#amzn-btn-refresh-internal')?.click();
109+
await Time.sleep(200);
110+
last_audio_data = null;
111+
return;
112+
}
113+
114+
const delta = settings.awscaptcha_solve_delay ? (1000 - (Time.time() - solve_start)) : 0;
115+
if (delta > 0) {
116+
await Time.sleep(delta);
117+
}
118+
119+
// Solve
120+
if (data[0].length === 0) {
121+
document.querySelector('#amzn-btn-refresh-internal')?.click();
122+
await Time.sleep(200);
123+
last_audio_data = null;
124+
}
125+
else {
126+
input.value = data[0];
127+
await Time.sleep(200);
128+
document.querySelector('#amzn-btn-verify-internal')?.click();
129+
}
130+
131+
// last_audio_data = null;
132+
}
133+
134+
while (true) {
135+
await Time.sleep(1000);
136+
137+
const settings = await BG.exec('get_settings');
138+
if (!settings || !settings.enabled) {
139+
continue;
140+
}
141+
142+
if (settings.awscaptcha_auto_open && is_widget_frame()) {
143+
await on_widget_frame();
144+
}
145+
else if (settings.hcaptcha_auto_solve && is_image_frame()) {
146+
await on_image_frame();
147+
}
148+
else if (settings.hcaptcha_auto_solve && is_audio_frame()) {
149+
await on_audio_frame();
150+
}
151+
}
152+
})();

‎build.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,8 @@ def build():
231231
extension_manifest.update(specific_manifest)
232232

233233
# Remove Firefox gecko ID for production
234-
if program_args.production:
235-
if ('browser_specific_settings' in extension_manifest and
236-
'gecko' in extension_manifest['browser_specific_settings'] and
237-
'id' in extension_manifest['browser_specific_settings']['gecko']):
238-
del extension_manifest['browser_specific_settings']['gecko']['id']
234+
with contextlib.suppress(KeyError):
235+
del extension_manifest['browser_specific_settings']['gecko']['id']
239236

240237
manifest_content = json.dumps(extension_manifest, indent=4)
241238
(export_directory / "manifest.json").write_text(manifest_content)

‎content.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class NopeCHA {
7373
UPDATE_REQUIRED: 17,
7474
};
7575

76-
static async post({captcha_type, task, image_urls, image_data, grid, key}) {
76+
static async post({captcha_type, task, image_urls, image_data, grid, audio_data, key}) {
7777
const start_time = Date.now();
7878

7979
const info = await BG.exec('info_tab');
@@ -100,6 +100,9 @@ class NopeCHA {
100100
if (grid) {
101101
data.grid = grid;
102102
}
103+
if (audio_data) {
104+
data.audio_data = audio_data;
105+
}
103106

104107
const text = await Net.fetch(NopeCHA.INFERENCE_URL, {method: 'POST', body: JSON.stringify(data), headers: {'Content-Type': 'application/json'}});
105108

‎funcaptcha.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@
136136
if (data[i] === false) {
137137
continue;
138138
}
139-
140139
cells[i].click();
141140
}
141+
142142
last_image_data = null;
143143
}
144144

@@ -153,7 +153,7 @@
153153
}
154154

155155
if (settings.funcaptcha_auto_open && is_widget_frame()) {
156-
await on_widget_frame(settings);
156+
await on_widget_frame();
157157
}
158158
else if (settings.funcaptcha_auto_solve && is_image_frame()) {
159159
await on_image_frame();

‎funcaptcha_demo.js‎

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
(async () => {
22
const KEYS = {
3-
'linkedin': '3117BF26-4762-4F5A-8ED9-A85E69209A46', // Pick the image that is the correct way up
4-
'rockstar': 'A5A70501-FCDE-4065-AF18-D9FAF06EF479', // Pick the image that is the correct way up / Pick the dice pair whose top sides add up to 9
5-
'github': '20782B4C-05D0-45D7-97A0-41641055B6F6', // Pick the spiral galaxy
6-
'paypal': '9409E63B-D2A5-9CBD-DBC0-5095707D0090', // Pick one square that shows two identical objects.
7-
'blizzard': 'E8A75615-1CBA-5DFF-8032-D16BCF234E10', // Pick the mouse that can't reach the cheese
8-
'twitch': 'E5554D43-23CC-1982-971D-6A2262A2CA24', // Pick the dice pair whose top sides add up to 5/6/7/8
9-
'demo1': '804380F4-6844-FFA1-ED4E-5877CA1F1EA4', // Pick the image that is the correct way up
10-
'demo2': 'D39B0EE3-2973-4147-98EF-C92F93451E2D', // Pick the clipart object
11-
// 'octocaptcha': '69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC', // Pick the clipart object
12-
// 'outlook': 'B7D8911C-5CC8-A9A3-35B0-554ACEE604DA',
13-
// 'roblox': 'A2A14B1D-1AF3-C791-9BBC-EE33CC7A0A6F',
14-
// 'roblox': '9F35E182-C93C-EBCC-A31D-CF8ED317B996',
15-
// 'roblox': '476068BF-9607-4799-B53D-966BE98E2B81',
16-
'ea signup': '73BEC076-3E53-30F5-B1EB-84F494D43DBA', // Pick one square that shows two identical objects. / Pick the mouse that can reach all the cheese in the maze / Pick the matching cards
17-
'ea signin': '0F5FE186-B3CA-4EDB-A39B-9B9A3397D01D',
18-
'myprepaidcenter': '0F941BF0-7303-D94B-B76A-EAA2E2048124', // Pick the image where all animals are walking in the same direction as the arrow
19-
'twitter': '2CB16598-CB82-4CF7-B332-5990DB66F3AB', // Pick the shadow with a different object silhouette
3+
'linkedin': ['3117BF26-4762-4F5A-8ED9-A85E69209A46', false], // Pick the image that is the correct way up
4+
'rockstar': ['A5A70501-FCDE-4065-AF18-D9FAF06EF479', false], // Pick the image that is the correct way up / Pick the dice pair whose top sides add up to 9
5+
'github': ['20782B4C-05D0-45D7-97A0-41641055B6F6', false], // Pick the spiral galaxy
6+
'paypal': ['9409E63B-D2A5-9CBD-DBC0-5095707D0090', false], // Pick one square that shows two identical objects.
7+
'blizzard': ['E8A75615-1CBA-5DFF-8032-D16BCF234E10', false], // Pick the mouse that can't reach the cheese
8+
'twitch': ['E5554D43-23CC-1982-971D-6A2262A2CA24', false], // Pick the dice pair whose top sides add up to 5/6/7/8
9+
'demo1': ['804380F4-6844-FFA1-ED4E-5877CA1F1EA4', false], // Pick the image that is the correct way up
10+
'demo2': ['D39B0EE3-2973-4147-98EF-C92F93451E2D', false], // Pick the clipart object
11+
// 'octocaptcha': ['69A21A01-CC7B-B9C6-0F9A-E7FA06677FFC', false], // Pick the clipart object
12+
// 'outlook': ['B7D8911C-5CC8-A9A3-35B0-554ACEE604DA', false],
13+
// 'roblox': ['A2A14B1D-1AF3-C791-9BBC-EE33CC7A0A6F', false],
14+
// 'roblox': ['9F35E182-C93C-EBCC-A31D-CF8ED317B996', false],
15+
// 'roblox': ['476068BF-9607-4799-B53D-966BE98E2B81', false],
16+
'ea signup': ['73BEC076-3E53-30F5-B1EB-84F494D43DBA', false], // Pick one square that shows two identical objects. / Pick the mouse that can reach all the cheese in the maze / Pick the matching cards
17+
'ea signin': ['0F5FE186-B3CA-4EDB-A39B-9B9A3397D01D', false],
18+
'myprepaidcenter': ['0F941BF0-7303-D94B-B76A-EAA2E2048124', false], // Pick the image where all animals are walking in the same direction as the arrow
19+
'twitter': ['2CB16598-CB82-4CF7-B332-5990DB66F3AB', true], // Pick the shadow with a different object silhouette
2020
};
2121
const SRCS = {
22-
'outlook': 'https://iframe.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', // Pick the penguin
23-
'outlook auth': 'https://iframe-auth.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', // Pick one square that shows two identical objects.
22+
'outlook': ['https://iframe.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', false], // Pick the penguin
23+
'outlook auth': ['https://iframe-auth.arkoselabs.com/B7D8911C-5CC8-A9A3-35B0-554ACEE604DA/index.html?mkt=en', false], // Pick one square that shows two identical objects.
2424
};
2525
const MAX_BTNS_PER_ROW = 7;
2626

27-
let nframes = 10;
27+
let nframes = 18;
2828

2929

3030
reset();
@@ -94,15 +94,26 @@
9494
// }`,
9595
`.iframe_wrap {
9696
background-color: #eee;
97-
width: 175px;
98-
height: 150px;
97+
width: 275px;
98+
height: 275px;
9999
padding: 0;
100100
overflow: hidden;
101101
}`,
102102
`iframe {
103-
width: 350px !important;
104-
height: 300px !important;
105103
border: none !important;
104+
width: 400px !important;
105+
height: 400px !important;
106+
-ms-zoom: 0.75 !important;
107+
-moz-transform: scale(0.75) !important;
108+
-moz-transform-origin: 0 0 !important;
109+
-o-transform: scale(0.75) !important;
110+
-o-transform-origin: 0 0 !important;
111+
-webkit-transform: scale(0.75) !important;
112+
-webkit-transform-origin: 0 0 !important;
113+
}`,
114+
`iframe.small {
115+
width: 550px !important;
116+
height: 550px !important;
106117
-ms-zoom: 0.5 !important;
107118
-moz-transform: scale(0.5) !important;
108119
-moz-transform-origin: 0 0 !important;
@@ -210,15 +221,18 @@
210221
}
211222
// console.log('open_frame_src', k, n);
212223
for (let i = 0; i < n; i++) {
213-
create_frame(k, row, SRCS[k]);
224+
create_frame(k, row, SRCS[k][0], SRCS[k][1]);
214225
}
215226
}
216227

217-
function create_frame(name, row, src) {
228+
function create_frame(name, row, src, is_small=false) {
218229
const $wrap = document.createElement('div');
219230
$wrap.classList.add('iframe_wrap');
220231

221232
const $iframe = document.createElement('iframe');
233+
if (is_small) {
234+
$iframe.classList.add('small');
235+
}
222236
$wrap.append($iframe);
223237
$iframe.frameborder = 0;
224238
$iframe.scrolling = 'no';
@@ -241,7 +255,7 @@
241255
}
242256

243257
async function load_captcha(name, row) {
244-
const pk = KEYS[name];
258+
const pk = KEYS[name][0];
245259

246260
const host = '';
247261
const url = `https://api.funcaptcha.com/fc/gt2/public_key/${pk}`;
@@ -286,14 +300,14 @@
286300
}
287301
const url_params = (new URLSearchParams(params)).toString();
288302
const src = `https://api.funcaptcha.com/fc/gc/?${url_params}`;
289-
create_frame(name, row, src);
303+
create_frame(name, row, src, KEYS[name][1]);
290304
}
291305

292306

293307
/**
294308
Manually get the iframe src from roblox.com
295309
*/
296-
// const TOKEN = '945635c4051b7b638.9142447501';
310+
// const TOKEN = '400635fb675f05f61.0554348501';
297311
// const roblox_src = `https://roblox-api.arkoselabs.com/fc/gc/?token=${TOKEN}&r=us-east-1&metabgclr=transparent&guitextcolor=%23474747&maintxtclr=%23b8b8b8&metaiconclr=%23757575&meta=3&lang=en&pk=A2A14B1D-1AF3-C791-9BBC-EE33CC7A0A6F&at=40&ht=1&ag=101&cdn_url=https%3A%2F%2Froblox-api.arkoselabs.com%2Fcdn%2Ffc&lurl=https%3A%2F%2Faudio-us-east-1.arkoselabs.com&surl=https%3A%2F%2Froblox-api.arkoselabs.com&smurl=https%3A%2F%2Froblox-api.arkoselabs.com%2Fcdn%2Ffc%2Fassets%2Fstyle-manager`;
298312
// for (let i = 0; i < nframes; i++) create_frame('roblox', 0, roblox_src);
299313

‎funcaptcha_fast.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
window.addEventListener('load', () => {
77
const sheet = document.body.appendChild(document.createElement('style')).sheet;
88
sheet.insertRule('* {transition-duration: 0s !important}', 0);
9-
sheet.insertRule('li > a::after {border: 12px solid rgba(0, 255, 0, 0.9) !important}', 1);
9+
sheet.insertRule('li > a::after {border: 8px solid rgba(0, 255, 0, 0.6) !important}', 1);
1010
sheet.insertRule('#interstitial {backdrop-filter: none !important}', 2);
1111
sheet.insertRule('#interstitial {background-color: transparent !important}', 3);
12-
// sheet.insertRule('#interstitial {opacity: 0.7 !important}', 4);
12+
sheet.insertRule('#interstitial_wrapper {background-color: transparent !important}', 4);
1313
});
1414
})();

‎hcaptcha.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
async function get_task() {
3636
let task = document.querySelector('h2.prompt-text')?.innerText?.replace(/\s+/g, ' ')?.trim();
3737
if (!task) {
38-
console.log('error getting task', task);
3938
return null;
4039
}
4140

@@ -154,7 +153,7 @@
154153
try {
155154
document.querySelector('.button-submit').click();
156155
} catch (e) {
157-
console.log('error submitting', e);
156+
console.error('error submitting', e);
158157
}
159158
}
160159

0 commit comments

Comments
 (0)