@xkwdstore/agent 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +251 -244
- package/package.json +54 -54
- package/src/actions/comment.js +137 -137
- package/src/actions/dbc.js +149 -149
- package/src/actions/follow.js +82 -82
- package/src/actions/helpers.js +753 -753
- package/src/actions/index.js +94 -94
- package/src/actions/like.js +244 -244
- package/src/actions/session.js +1610 -1610
- package/src/actions/tweet.js +90 -90
- package/src/challengeCodec.js +31 -31
- package/src/chromeDetector.js +154 -154
- package/src/cli.js +664 -528
- package/src/configStore.js +97 -97
- package/src/deviceKeyStore.js +947 -700
- package/src/enrollmentClient.js +588 -445
- package/src/fingerprint.js +261 -261
- package/src/fingerprintStore.js +125 -125
- package/src/leaseClient.js +84 -84
- package/src/processLock.js +148 -148
- package/src/profilePath.js +1116 -1116
- package/src/proxyEgress.js +338 -338
- package/src/proxyPolicy.js +76 -76
- package/src/secretStore.js +132 -132
- package/src/sessionHandler.js +618 -452
- package/src/stealth.js +1250 -1250
- package/src/wsClient.js +233 -233
package/src/actions/index.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Action dispatcher — routes runAction commands to the correct action module.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { tweet } = require('./tweet');
|
|
8
|
-
const { like, bookmark, retweet } = require('./like');
|
|
9
|
-
const { follow } = require('./follow');
|
|
10
|
-
const { comment } = require('./comment');
|
|
11
|
-
const { autoLogin, checkLoginState, checkStatus, getProfileInfo, updateProfile, changePassword } = require('./session');
|
|
12
|
-
const dbc = require('./dbc');
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Execute an automation action on the given page.
|
|
16
|
-
* @param {import('playwright').Page} page
|
|
17
|
-
* @param {string} action - Action name
|
|
18
|
-
* @param {object} payload - Action payload
|
|
19
|
-
* @returns {Promise<object>} - Result with success/error
|
|
20
|
-
*/
|
|
21
|
-
async function runAction(page, action, payload = {}) {
|
|
22
|
-
switch (action) {
|
|
23
|
-
case 'tweet':
|
|
24
|
-
return await tweet(page, payload);
|
|
25
|
-
|
|
26
|
-
case 'like':
|
|
27
|
-
return await like(page, payload);
|
|
28
|
-
|
|
29
|
-
case 'bookmark':
|
|
30
|
-
return await bookmark(page, payload);
|
|
31
|
-
|
|
32
|
-
case 'retweet':
|
|
33
|
-
return await retweet(page, payload);
|
|
34
|
-
|
|
35
|
-
case 'follow':
|
|
36
|
-
return await follow(page, payload);
|
|
37
|
-
|
|
38
|
-
case 'comment':
|
|
39
|
-
return await comment(page, payload);
|
|
40
|
-
|
|
41
|
-
case 'autoLogin':
|
|
42
|
-
return await autoLogin(page, payload);
|
|
43
|
-
|
|
44
|
-
case 'checkLoginState':
|
|
45
|
-
return await checkLoginState(page, payload);
|
|
46
|
-
|
|
47
|
-
case 'checkStatus':
|
|
48
|
-
return await checkStatus(page, payload);
|
|
49
|
-
|
|
50
|
-
case 'getProfileInfo':
|
|
51
|
-
return await getProfileInfo(page, payload);
|
|
52
|
-
|
|
53
|
-
case 'updateProfile':
|
|
54
|
-
return await updateProfile(page, payload);
|
|
55
|
-
|
|
56
|
-
case 'changePassword':
|
|
57
|
-
return await changePassword(page, payload);
|
|
58
|
-
|
|
59
|
-
case 'connectAutomation':
|
|
60
|
-
// Return current page URL — the session is already connected
|
|
61
|
-
return { success: true, url: page.url() };
|
|
62
|
-
|
|
63
|
-
case 'humanResume': {
|
|
64
|
-
// Check if there's a challenge/captcha on the page
|
|
65
|
-
const content = await page.content().catch(() => '');
|
|
66
|
-
const hasChallenge = /captcha|verify you are human|unusual activity|login challenge/i.test(content);
|
|
67
|
-
|
|
68
|
-
if (!hasChallenge) {
|
|
69
|
-
return { success: true, challengeRemaining: false, url: page.url() };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Try to solve the captcha with DBC
|
|
73
|
-
const { detectCaptcha, solveCaptchaWithDBC } = require('./session');
|
|
74
|
-
const captchaInfo = await detectCaptcha(page);
|
|
75
|
-
if (captchaInfo) {
|
|
76
|
-
const solved = await solveCaptchaWithDBC(page, captchaInfo);
|
|
77
|
-
if (solved) {
|
|
78
|
-
// Check if challenge is gone
|
|
79
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
80
|
-
const content2 = await page.content().catch(() => '');
|
|
81
|
-
const stillHasChallenge = /captcha|verify you are human|unusual activity|login challenge/i.test(content2);
|
|
82
|
-
return { success: true, challengeRemaining: stillHasChallenge, captchaSolved: true, url: page.url() };
|
|
83
|
-
}
|
|
84
|
-
return { success: false, challengeRemaining: true, captchaSolved: false, message: 'DBC could not solve this captcha type', url: page.url() };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return { success: true, challengeRemaining: true, url: page.url() };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
default:
|
|
91
|
-
throw new Error(`Unsupported action: ${action}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Action dispatcher — routes runAction commands to the correct action module.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { tweet } = require('./tweet');
|
|
8
|
+
const { like, bookmark, retweet } = require('./like');
|
|
9
|
+
const { follow } = require('./follow');
|
|
10
|
+
const { comment } = require('./comment');
|
|
11
|
+
const { autoLogin, checkLoginState, checkStatus, getProfileInfo, updateProfile, changePassword } = require('./session');
|
|
12
|
+
const dbc = require('./dbc');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Execute an automation action on the given page.
|
|
16
|
+
* @param {import('playwright').Page} page
|
|
17
|
+
* @param {string} action - Action name
|
|
18
|
+
* @param {object} payload - Action payload
|
|
19
|
+
* @returns {Promise<object>} - Result with success/error
|
|
20
|
+
*/
|
|
21
|
+
async function runAction(page, action, payload = {}) {
|
|
22
|
+
switch (action) {
|
|
23
|
+
case 'tweet':
|
|
24
|
+
return await tweet(page, payload);
|
|
25
|
+
|
|
26
|
+
case 'like':
|
|
27
|
+
return await like(page, payload);
|
|
28
|
+
|
|
29
|
+
case 'bookmark':
|
|
30
|
+
return await bookmark(page, payload);
|
|
31
|
+
|
|
32
|
+
case 'retweet':
|
|
33
|
+
return await retweet(page, payload);
|
|
34
|
+
|
|
35
|
+
case 'follow':
|
|
36
|
+
return await follow(page, payload);
|
|
37
|
+
|
|
38
|
+
case 'comment':
|
|
39
|
+
return await comment(page, payload);
|
|
40
|
+
|
|
41
|
+
case 'autoLogin':
|
|
42
|
+
return await autoLogin(page, payload);
|
|
43
|
+
|
|
44
|
+
case 'checkLoginState':
|
|
45
|
+
return await checkLoginState(page, payload);
|
|
46
|
+
|
|
47
|
+
case 'checkStatus':
|
|
48
|
+
return await checkStatus(page, payload);
|
|
49
|
+
|
|
50
|
+
case 'getProfileInfo':
|
|
51
|
+
return await getProfileInfo(page, payload);
|
|
52
|
+
|
|
53
|
+
case 'updateProfile':
|
|
54
|
+
return await updateProfile(page, payload);
|
|
55
|
+
|
|
56
|
+
case 'changePassword':
|
|
57
|
+
return await changePassword(page, payload);
|
|
58
|
+
|
|
59
|
+
case 'connectAutomation':
|
|
60
|
+
// Return current page URL — the session is already connected
|
|
61
|
+
return { success: true, url: page.url() };
|
|
62
|
+
|
|
63
|
+
case 'humanResume': {
|
|
64
|
+
// Check if there's a challenge/captcha on the page
|
|
65
|
+
const content = await page.content().catch(() => '');
|
|
66
|
+
const hasChallenge = /captcha|verify you are human|unusual activity|login challenge/i.test(content);
|
|
67
|
+
|
|
68
|
+
if (!hasChallenge) {
|
|
69
|
+
return { success: true, challengeRemaining: false, url: page.url() };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Try to solve the captcha with DBC
|
|
73
|
+
const { detectCaptcha, solveCaptchaWithDBC } = require('./session');
|
|
74
|
+
const captchaInfo = await detectCaptcha(page);
|
|
75
|
+
if (captchaInfo) {
|
|
76
|
+
const solved = await solveCaptchaWithDBC(page, captchaInfo);
|
|
77
|
+
if (solved) {
|
|
78
|
+
// Check if challenge is gone
|
|
79
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
80
|
+
const content2 = await page.content().catch(() => '');
|
|
81
|
+
const stillHasChallenge = /captcha|verify you are human|unusual activity|login challenge/i.test(content2);
|
|
82
|
+
return { success: true, challengeRemaining: stillHasChallenge, captchaSolved: true, url: page.url() };
|
|
83
|
+
}
|
|
84
|
+
return { success: false, challengeRemaining: true, captchaSolved: false, message: 'DBC could not solve this captcha type', url: page.url() };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return { success: true, challengeRemaining: true, url: page.url() };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
default:
|
|
91
|
+
throw new Error(`Unsupported action: ${action}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
95
|
module.exports = { runAction };
|