This commit is contained in:
Faker 2022-04-21 10:42:10 +08:00
parent 8efb2dc5df
commit dd48ac0529
17 changed files with 4810 additions and 4057 deletions

View File

@ -3,6 +3,7 @@ import {Md5} from "ts-md5"
import * as dotenv from "dotenv"
import {existsSync, readFileSync} from "fs"
import {sendNotify} from './sendNotify'
import {rejects} from "assert";
dotenv.config()
@ -56,6 +57,7 @@ function TotalBean(cookie: string) {
}
function getRandomNumberByRange(start: number, end: number) {
end <= start && (end = start + 100)
return Math.floor(Math.random() * (end - start) + start)
}
@ -340,31 +342,39 @@ async function jdpingou() {
return `jdpingou;iPhone;5.19.0;${version};${randomString(40)};network/wifi;model/${device};appBuild/100833;ADID/;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/${getRandomNumberByRange(10, 90)};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
}
function get(url: string, prarms?: string, headers?: any) {
return axios.get(url, {
params: prarms,
headers: headers
})
.then(res => {
if (typeof res.data === 'string' && res.data.match(/^jsonpCBK/)) {
return JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);/)[1])
function get(url: string, prarms?: string, headers?: any): Promise<any> {
return new Promise((resolve, reject) => {
axios.get(url, {
params: prarms,
headers: headers
}).then(res => {
if (typeof res.data === 'string' && res.data.includes('jsonpCBK')) {
resolve(JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);?/)[1]))
} else {
return res.data
resolve(res.data)
}
}).catch(err => {
reject({
code: err?.response?.status || -1,
msg: err?.response?.statusText || err.message || 'error'
})
})
.catch(err => {
console.log(err?.response?.status, err?.response?.statusText)
});
})
}
function post(url: string, prarms?: string | object, headers?: any): Promise<any> {
return axios.post(url, prarms, {
headers: headers
return new Promise((resolve, reject) => {
axios.post(url, prarms, {
headers: headers
}).then(res => {
resolve(res.data)
}).catch(err => {
reject({
code: err?.response?.status || -1,
msg: err?.response?.statusText || err.message || 'error'
})
})
})
.then(res => res.data)
.catch(err => {
console.log(err?.response?.status, err?.response?.statusText)
});
}
export default USER_AGENT

4019
jdMsLogs.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

62
jd_cash.ts Normal file
View File

@ -0,0 +1,62 @@
import USER_AGENT, {post, requireConfig, wait} from './TS_USER_AGENTS'
import {getSign} from "./test/sign";
let cookie: string = '', res: any = '', data: any, UserName: string
!(async () => {
let cookiesArr: string[] = await requireConfig()
for (let [index, value] of Object.entries(cookiesArr)) {
cookie = value
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
console.log(`\n开始【京东账号${index + 1}${UserName}\n`)
res = await api('cash_homePage', {})
if (res.data.result.signedStatus !== 1) {
console.log('今日未签到')
data = await api('cash_sign', {"remind": 0, "inviteCode": "", "type": 0, "breakReward": 0})
await wait(1000)
console.log('签到成功')
}
res = await api('cash_homePage', {})
await wait(1000)
let type: number[] = [2, 4, 31, 16, 3, 5, 17, 21]
let otherTaskNum = res.data.result.taskInfos.filter(item => !type.includes(item.type)).length
let taskNum = res.data.result.taskInfos.filter(item => type.includes(item.type)).length
console.log(taskNum, otherTaskNum)
for (let i = 0; i < 10; i++) {
res = await api('cash_homePage', {})
if (res.data.result.taskInfos.filter(item => type.includes(item.type) && item.doTimes === item.times).length === taskNum) {
console.log('任务全部完成')
break
}
for (let t of res?.data?.result?.taskInfos || []) {
if (t.doTimes < t.times && t.type !== 7) {
console.log(t.name)
data = await api('cash_doTask', {"type": t.type, "taskInfo": t.desc})
await wait(t.duration * 1000 || 1000)
if (data.data.bizCode === 0) {
console.log('任务完成', data.data.result.totalMoney ?? '')
break
} else {
console.log('任务失败', JSON.stringify(data))
break
}
}
}
await wait(2000)
}
}
})()
async function api(fn: string, body: object) {
let sign = getSign(fn, body)
return await post(`https://api.m.jd.com/client.action?functionId=${fn}`, sign, {
'Host': 'api.m.jd.com',
'Cookie': cookie,
'content-type': 'application/x-www-form-urlencoded',
'user-agent': USER_AGENT,
'referer': ''
})
}

View File

@ -39,7 +39,6 @@ const token = [
"31D76EB23737B3BF03EBDCC06EA2B9EC",
"3705013F73CEEA8CB2311DB6607046FE",
"FD78AA7B8266ACD77D2D998CDEA11D5C",
"903DFFB65088484F7743B5F437BB1649",
"8A23628E464CDA812A74D67C17EC601C",
"41AFADC9C4AF8807DEC071FE688596FB",
"5756464E7C6CF04B89E34C3CCA85CA7F",
@ -48,7 +47,9 @@ const token = [
"FE30AB00038CFFEF00DA9E9B8E932721",
"F0C24D7588D90922393B423C6623F31A",
"DFD953F3D54DAE2721568457FE12068C",
"3DEACB6A49D5954B134A6C4DE73FEF42"
"F77DBB9FAAB5821D748B7A70D6582289",
"6A7CD06046134C5EEDEBCB11EE4DA525",
"6DAD8A8B77EC507D6513DE633CCB6406"
]
if ($.isNode()) {

View File

@ -15,18 +15,18 @@ let shareCodesSelf: string[] = [], shareCodes: string[] = [], shareCodesHW: stri
let min: number[] = [0.02, 0.12, 0.3, 0.4, 0.6, 0.7, 0.8, 1, 1.2, 2, 3.6], log: string
!(async () => {
cookiesArr = await requireConfig()
cookiesArr = await requireConfig(false)
cookiesArr = cookiesArr.slice(0, 1)
await join()
await help()
cookiesArr = await requireConfig()
cookiesArr = await requireConfig(false)
cookiesArr = cookiesArr.slice(0, 9)
if (new Date().getHours() === 0)
if (new Date().getHours() !== 6)
await join()
await getShareCodeSelf()
await help()
await open(0)
await open(1)
})()
async function join() {
@ -35,7 +35,7 @@ async function join() {
cookie = value
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
console.log(`\n开始【京东账号${index + 1}${UserName}\n`)
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 3; i++) {
try {
log = await getLog()
res = await api('h5launch', {followShop: 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
@ -133,27 +133,29 @@ async function help() {
shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
}
let me: string = await getShareCodeSelf(true)
let success: boolean = false
let me: string = await getShareCodeSelf(true), remain: boolean = true
for (let code of shareCodes) {
if (success) break
if (!remain) break
let success: boolean = false
if (!fullCode.includes(code) && code !== me) {
console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`)
for (let i = 0; i < 5; i++) {
if (success) break
log = await getLog()
res = await api('jinli_h5assist', {"redPacketId": code, "followShop": 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'})
if (res.rtn_code === 403) {
console.log('log error')
await wait(5000)
} else {
success = true
if (res.data.result.status === 0) {
console.log('助力成功:', parseFloat(res.data.result.assistReward.discount))
success = true
await wait(45000)
remain = false
break
} else if (res.data.result.status === 3) {
console.log('今日助力次数已满')
success = true
remain = false
await wait(45000)
break
} else {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

486
jd_ms.js Normal file

File diff suppressed because one or more lines are too long

226
jd_xmf.js

File diff suppressed because one or more lines are too long