This commit is contained in:
Faker
2022-04-21 10:43:01 +08:00
parent 8ebffa8ff7
commit 510d197137
21 changed files with 4810 additions and 6089 deletions

View File

@@ -3,6 +3,7 @@ import {Md5} from "ts-md5"
import * as dotenv from "dotenv" import * as dotenv from "dotenv"
import {existsSync, readFileSync} from "fs" import {existsSync, readFileSync} from "fs"
import {sendNotify} from './sendNotify' import {sendNotify} from './sendNotify'
import {rejects} from "assert";
dotenv.config() dotenv.config()
@@ -56,6 +57,7 @@ function TotalBean(cookie: string) {
} }
function getRandomNumberByRange(start: number, end: number) { function getRandomNumberByRange(start: number, end: number) {
end <= start && (end = start + 100)
return Math.floor(Math.random() * (end - start) + start) 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` 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) { function get(url: string, prarms?: string, headers?: any): Promise<any> {
return axios.get(url, { return new Promise((resolve, reject) => {
params: prarms, axios.get(url, {
headers: headers params: prarms,
}) headers: headers
.then(res => { }).then(res => {
if (typeof res.data === 'string' && res.data.match(/^jsonpCBK/)) { if (typeof res.data === 'string' && res.data.includes('jsonpCBK')) {
return JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);/)[1]) resolve(JSON.parse(res.data.match(/jsonpCBK.?\(([\w\W]*)\);?/)[1]))
} else { } 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> { function post(url: string, prarms?: string | object, headers?: any): Promise<any> {
return axios.post(url, prarms, { return new Promise((resolve, reject) => {
headers: headers 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 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': ''
})
}

File diff suppressed because one or more lines are too long

View File

@@ -39,7 +39,6 @@ const token = [
"31D76EB23737B3BF03EBDCC06EA2B9EC", "31D76EB23737B3BF03EBDCC06EA2B9EC",
"3705013F73CEEA8CB2311DB6607046FE", "3705013F73CEEA8CB2311DB6607046FE",
"FD78AA7B8266ACD77D2D998CDEA11D5C", "FD78AA7B8266ACD77D2D998CDEA11D5C",
"903DFFB65088484F7743B5F437BB1649",
"8A23628E464CDA812A74D67C17EC601C", "8A23628E464CDA812A74D67C17EC601C",
"41AFADC9C4AF8807DEC071FE688596FB", "41AFADC9C4AF8807DEC071FE688596FB",
"5756464E7C6CF04B89E34C3CCA85CA7F", "5756464E7C6CF04B89E34C3CCA85CA7F",
@@ -48,7 +47,9 @@ const token = [
"FE30AB00038CFFEF00DA9E9B8E932721", "FE30AB00038CFFEF00DA9E9B8E932721",
"F0C24D7588D90922393B423C6623F31A", "F0C24D7588D90922393B423C6623F31A",
"DFD953F3D54DAE2721568457FE12068C", "DFD953F3D54DAE2721568457FE12068C",
"3DEACB6A49D5954B134A6C4DE73FEF42" "F77DBB9FAAB5821D748B7A70D6582289",
"6A7CD06046134C5EEDEBCB11EE4DA525",
"6DAD8A8B77EC507D6513DE633CCB6406"
] ]
if ($.isNode()) { 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 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 () => { !(async () => {
cookiesArr = await requireConfig() cookiesArr = await requireConfig(false)
cookiesArr = cookiesArr.slice(0, 1) cookiesArr = cookiesArr.slice(0, 1)
await join() await join()
await help() await help()
cookiesArr = await requireConfig() cookiesArr = await requireConfig(false)
cookiesArr = cookiesArr.slice(0, 9) cookiesArr = cookiesArr.slice(0, 9)
if (new Date().getHours() === 0) if (new Date().getHours() !== 6)
await join() await join()
await getShareCodeSelf() await getShareCodeSelf()
await help() await help()
await open(0) await open(1)
})() })()
async function join() { async function join() {
@@ -35,7 +35,7 @@ async function join() {
cookie = value cookie = value
UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1]) UserName = decodeURIComponent(cookie.match(/pt_pin=([^;]*)/)![1])
console.log(`\n开始【京东账号${index + 1}${UserName}\n`) console.log(`\n开始【京东账号${index + 1}${UserName}\n`)
for (let i = 0; i < 5; i++) { for (let i = 0; i < 3; i++) {
try { try {
log = await getLog() log = await getLog()
res = await api('h5launch', {followShop: 0, random: log.match(/"random":"(\d+)"/)[1], log: log.match(/"log":"(.*)"/)[1], sceneid: 'JLHBhPageh5'}) 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])) shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW]))
} }
let me: string = await getShareCodeSelf(true) let me: string = await getShareCodeSelf(true), remain: boolean = true
let success: boolean = false
for (let code of shareCodes) { for (let code of shareCodes) {
if (success) break if (!remain) break
let success: boolean = false
if (!fullCode.includes(code) && code !== me) { if (!fullCode.includes(code) && code !== me) {
console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`) console.log(`账号${index + 1} ${UserName} 去助力 ${code} ${shareCodesSelf.includes(code) ? '*内部*' : ''}`)
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
if (success) break
log = await getLog() 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'}) 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) { if (res.rtn_code === 403) {
console.log('log error') console.log('log error')
await wait(5000) await wait(5000)
} else { } else {
success = true
if (res.data.result.status === 0) { if (res.data.result.status === 0) {
console.log('助力成功:', parseFloat(res.data.result.assistReward.discount)) console.log('助力成功:', parseFloat(res.data.result.assistReward.discount))
success = true
await wait(45000) await wait(45000)
remain = false
break break
} else if (res.data.result.status === 3) { } else if (res.data.result.status === 3) {
console.log('今日助力次数已满') console.log('今日助力次数已满')
success = true remain = false
await wait(45000) await wait(45000)
break break
} else { } 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

1243
jd_try.js

File diff suppressed because it is too large Load Diff

View File

@@ -1,147 +0,0 @@
#Source::https://github.com/Hyper-Beast/JD_Scripts
"""
cron: 20 20 * * *
new Env('京东试用成功通知');
"""
import requests
import json
import time
import os
import re
import sys
import random
import string
import urllib
#以下部分参考Curtin的脚本https://github.com/curtinlv/JD-Script
UserAgent = ''
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
addressid = ''.join(random.sample('1234567898647', 10))
iosVer = ''.join(random.sample(["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1))
iosV = iosVer.replace('.', '_')
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4", "10.2.2", "10.2.0", "10.1.6"], 1))
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
def userAgent():
"""
随机生成一个UA
jdapp;iPhone;10.0.4;14.2;9fb54498b32e17dfc5717744b5eaecda8366223c;network/wifi;ADID/2CF597D0-10D8-4DF8-C5A2-61FD79AC8035;model/iPhone11,1;addressid/7785283669;appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1
:return: ua
"""
if not UserAgent:
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
else:
return UserAgent
#以上部分参考Curtin的脚本https://github.com/curtinlv/JD-Script
def load_send():
global send
cur_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(cur_path)
if os.path.exists(cur_path + "/sendNotify.py"):
try:
from sendNotify import send
except:
send=False
print("加载通知服务失败~")
else:
send=False
print("加载通知服务失败~")
load_send()
def printf(text):
print(text)
sys.stdout.flush()
def get_remarkinfo():
url='http://127.0.0.1:5600/api/envs'
try:
with open('/ql/config/auth.json', 'r') as f:
token=json.loads(f.read())['token']
headers={
'Accept':'application/json',
'authorization':'Bearer '+token,
}
response=requests.get(url=url,headers=headers)
for i in range(len(json.loads(response.text)['data'])):
if json.loads(response.text)['data'][i]['name']=='JD_COOKIE':
try:
if json.loads(response.text)['data'][i]['remarks'].find('@@')==-1:
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].replace('remark=','')
else:
remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].split("@@")[0].replace('remark=','').replace(';','')
except:
pass
except:
print('读取auth.json文件出错跳过获取备注')
def get_succeedinfo(ck):
url='https://api.m.jd.com/client.action'
headers={
'accept':'application/json, text/plain, */*',
'content-type':'application/x-www-form-urlencoded',
'origin':'https://prodev.m.jd.com',
'content-length':'249',
'accept-language':'zh-CN,zh-Hans;q=0.9',
'User-Agent':userAgent(),
'referer':'https://prodev.m.jd.com/',
'accept-encoding':'gzip, deflate, br',
'cookie':ck
}
data=f'appid=newtry&functionId=try_MyTrials&uuid={uuid}&clientVersion={clientVersion}&client=wh5&osVersion={iosVer}&area={area}&networkType=wifi&body=%7B%22page%22%3A1%2C%22selected%22%3A2%2C%22previewTime%22%3A%22%22%7D'
response=requests.post(url=url,headers=headers,data=data)
isnull=True
try:
for i in range(len(json.loads(response.text)['data']['list'])):
if(json.loads(response.text)['data']['list'][i]['text']['text']).find('试用资格将保留')!=-1:
print(json.loads(response.text)['data']['list'][i]['trialName'])
try:
if remarkinfos[ptpin]!='':
send("京东试用待领取物品通知",'账号名称:'+remarkinfos[ptpin]+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
isnull=False
else:
send("京东试用待领取物品通知",'账号名称:'+urllib.parse.unquote(ptpin)+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
isnull=False
except Exception as e:
printf(str(e))
if isnull==True:
print("没有在有效期内待领取的试用品\n\n")
except:
print('获取信息出错,可能是账号已过期')
pass
if __name__ == '__main__':
remarkinfos={}
try:
get_remarkinfo()
except:
pass
try:
cks = os.environ["JD_COOKIE"].split("&")
except:
f = open("/jd/config/config.sh", "r", encoding='utf-8')
cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
f.close()
for ck in cks:
ck = ck.strip()
if ck[-1] != ';':
ck += ';'
ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
try:
if remarkinfos[ptpin]!='':
printf("--账号:" + remarkinfos[ptpin] + "--")
else:
printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
except Exception as e:
printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
get_succeedinfo(ck)

380
jd_tyt.js

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