package com.kuaishou.http;
import
com.kuaishou.utils.Rsa;
import
com.kuaishou.utils.Sig;
import
com.kuaishou.utils.header;
import
com.kuaishou.utils.sign;
import
net.sf.json.JSONObject;
import
okhttp3.
*
;
import
okio.
*
;
import
java.io.
File
;
import
java.io.IOException;
import
java.net.URLDecoder;
public
class
Test {
public static String did
=
"ANDROID_fa3658f96e26926a"
;
public static String did_gt
=
"1603261399318"
;
public static String mobile1
=
"3sCt3iAAMjE4NjUzNDU2AAIQAO7Jtk8XxqfdJhAAAAAjtopJWBt+R45DsskMUHFk"
;
public static void main(String[] args) {
/
/
System.out.println(sign.getPhone(
"18898888988"
));
/
/
sendMsg(mobile1);
/
/
checker(mobile1);
msgLogin(mobile1,
"629322"
);
}
/
/
发送验证码
public static void sendMsg(String mobile){
String url1
=
"mod=Xiaomi(Mi Note 3)"
+
"&country_code=cn"
+
"&kpn=KUAISHOU"
+
"&deviceBit=0"
+
"&oc=GENERIC"
+
"&egid=DFP7F6B9E60B7ECE3FB20F430DAEC2DD52B31CE91514B56700D50E3F08E5C01F"
+
"&sbh=55"
+
"&hotfix_ver="
+
"&appver=8.0.30.16405"
+
"&sh=1920"
+
"&cold_launch_time_ms="
+
header.cold_launch_time_ms()
+
"&nbh=0"
+
"&socName=Qualcomm Snapdragon 660"
+
"&androidApiLevel=25"
+
"&newOc=GENERIC"
+
"&max_memory=256"
+
"&isp=CUCC"
+
"&kcv=195"
+
"&browseType=1"
+
"&kpf=ANDROID_PHONE"
+
"&ddpi=436"
+
"&did="
+
did
+
"&app=0"
+
"&net=WIFI"
+
"&ud=0"
+
"&c=GENERIC"
+
"&sys=ANDROID_7.1.1"
+
"&sw=1080"
+
"&ftt="
+
"&keyconfig_state=2"
+
"&language=zh-cn"
+
"&darkMode=false"
+
"&iuid="
+
"&did_gt="
+
did_gt
+
"&ver=UNKNOWN"
;
String url
=
"https://apissl.ksapisrv.com/rest/n/user/requestMobileCode?"
+
url1;
String mobileCountryCode
=
"+86"
;
String
type
=
"302"
;
String client_key
=
"3c2cd3f3"
;
String cs
=
"false"
;
String os
=
"android"
;
OkHttpClient client
=
new OkHttpClient();
String sig
=
Sig.getSig(url1
+
"&mobileCountryCode=%2B86&mobile="
+
mobile
+
"&type="
+
type
+
"&client_key="
+
client_key
+
"&cs="
+
cs
+
"&os="
+
os);
com.kuaishou.utils.Request request1
=
new com.kuaishou.utils.Request();
String sig3
=
sign.get_Sig3(
"/rest/n/user/requestMobileCode"
+
sig);
RequestBody formBody
=
new FormBody.Builder()
.add(
"mobileCountryCode"
, mobileCountryCode)
.add(
"mobile"
, mobile)
.add(
"type"
,
type
)
.add(
"client_key"
, client_key)
.add(
"__NS_sig3"
, sig3)
.add(
"cs"
, cs)
.add(
"os"
, os)
.add(
"sig"
, sig)
.build();
Request request
=
new Request.Builder()
.url(url)
.header(
"User-Agent"
,
"kwai-android aegon/1.27.0"
)
.addHeader(
"Connection"
,
"keep-alive"
)
.addHeader(
"Cookie"
,
"region_ticket=RT_0F2A46CDA1B571279CFDA426AF3ADEF5D26CAC51092F3E61C28DF16CB0927"
)
.addHeader(
"X-REQUESTID"
, header.X_REQUESTID())
.addHeader(
"Accept-Language"
,
"zh-cn"
)
.addHeader(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.addHeader(
"X-Client-Info"
,
"model=Mi Note 3;os=Android;nqe-score=1;network=WIFI;signal-strength=3;"
)
.post(formBody)
.build();
client.newCall(request).enqueue(new Callback() {
public void onResponse(Call call, Response response) throws IOException {
System.out.println(response.body().string());
}
public void onFailure(Call call, IOException e) {
System.out.println(e.getMessage());
}
});
}
/
/
检查是否可以登陆或者注册
public static void checker(String mobile){
String url1
=
"mod=Xiaomi%28Mi%20Note%203%29"
+
"&abi=arm64"
+
"&country_code=CN"
+
"&kpn=KUAISHOU"
+
"&deviceBit=0"
+
"&oc=XIAOMI"
+
"&egid=DFP7F6B9E60B7ECE3FB20F430DAEC2DD52B31CE91514B56700D50E3F08E5C01F"
+
"&sbh=55"
+
"&hotfix_ver="
+
"&appver=8.0.51.16524"
+
"&sh=1920"
+
"&cold_launch_time_ms="
+
header.cold_launch_time_ms()
+
"&nbh=0"
+
"&socName=Qualcomm%20Snapdragon%20660"
+
"&androidApiLevel=25"
+
"&newOc=XIAOMI"
+
"&max_memory=256"
+
"&isp="
+
"&kcv=195"
+
"&browseType=1"
+
"&kpf=ANDROID_PHONE"
+
"&ddpi=440"
+
"&did="
+
did
+
"&app=0"
+
"&net=WIFI"
+
"&ud=0&c=XIAOMI"
+
"&sys=ANDROID_7.1.1"
+
"&sw=1080&ftt="
+
"&keyconfig_state=2"
+
"&language=zh-cn"
+
"&darkMode=false"
+
"&iuid="
+
"&did_gt="
+
did_gt
+
"&ver=UNKNOWN"
;
String url
=
"https://apissl.gifshow.com/rest/n/user/mobile/checker?"
+
url1;
String mobileCountryCode
=
"+86"
;
String client_key
=
"3c2cd3f3"
;
String cs
=
"false"
;
String os
=
"android"
;
OkHttpClient client
=
new OkHttpClient();
String sig
=
Sig.getSig(url1
+
"&mobileCountryCode=%2B86&mobile="
+
mobile
+
"&client_key="
+
client_key
+
"&cs="
+
cs
+
"&os="
+
os);
String sig3
=
sign.get_Sig3(
"/rest/n/user/mobile/checker"
+
sig);
RequestBody formBody
=
new FormBody.Builder()
.add(
"mobileCountryCode"
, mobileCountryCode)
.add(
"mobile"
, mobile)
.add(
"client_key"
, client_key)
.add(
"__NS_sig3"
, sig3)
.add(
"cs"
, cs)
.add(
"os"
, os)
.add(
"sig"
, sig)
.build();
Request request
=
new Request.Builder()
.url(url)
.header(
"User-Agent"
,
"kwai-android aegon/1.27.0"
)
.addHeader(
"Connection"
,
"keep-alive"
)
.addHeader(
"Cookie"
,
"region_ticket=RT_0F2A46CDA1B571279CFDA426AF3ADEF5D26CAC51092F3E61C28DF16CB0927"
)
.addHeader(
"X-REQUESTID"
, header.X_REQUESTID())
.addHeader(
"Accept-Language"
,
"zh-cn"
)
.addHeader(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.addHeader(
"X-Client-Info"
,
"model=Mi Note 3;os=Android;nqe-score=6;network=OTHER;"
)
.post(formBody)
.build();
client.newCall(request).enqueue(new Callback() {
public void onResponse(Call call, Response response) throws IOException {
System.out.println(response.body().string());
}
public void onFailure(Call call, IOException e) {
System.out.println(e.getMessage());
}
});
}
/
/
验证码登陆
public static void msgLogin(String mobile,String code){
String url1
=
"mod=Xiaomi%28Mi%20Note%203%29"
+
"&abi=arm64"
+
"&country_code=CN"
+
"&kpn=KUAISHOU"
+
"&deviceBit=0"
+
"&oc=XIAOMI"
+
"&egid=DFP7F6B9E60B7ECE3FB20F430DAEC2DD52B31CE91514B56700D50E3F08E5C01F"
+
"&sbh=55"
+
"&hotfix_ver="
+
"&appver=8.0.51.16524"
+
"&sh=1920"
+
"&cold_launch_time_ms="
+
header.cold_launch_time_ms()
+
"&nbh=0"
+
"&socName=Qualcomm%20Snapdragon%20660"
+
"&androidApiLevel=25"
+
"&newOc=XIAOMI"
+
"&max_memory=256"
+
"&isp="
+
"&kcv=195"
+
"&browseType=1"
+
"&kpf=ANDROID_PHONE"
+
"&ddpi=440"
+
"&did="
+
did
+
"&app=0"
+
"&net=WIFI"
+
"&ud=0&c=XIAOMI"
+
"&sys=ANDROID_7.1.1"
+
"&sw=1080&ftt="
+
"&keyconfig_state=2"
+
"&language=zh-cn"
+
"&darkMode=false"
+
"&iuid="
+
"&did_gt="
+
did_gt
+
"&ver=UNKNOWN"
;
String url
=
"https://apissl.gifshow.com/rest/n/user/login/mobileVerifyCode?"
+
url1;
String isDegraded
=
"false"
;
/
/
String code
=
"144091"
;
String mobileCountryCode
=
"+86"
;
String deviceMode
=
"Google(Pixel)"
;
String raw
=
System.currentTimeMillis()
+
"";
String rsA
=
Rsa.get_Rsa(raw);
String[] strArr
=
rsA.split(
"\\|"
);
String publicKey
=
strArr[
0
];
String secret
=
strArr[
1
];
String
type
=
"27"
;
String deviceName
=
"Google(Pixel)"
;
String os
=
"android"
;
String cs
=
"false"
;
String client_key
=
"3c2cd3f3"
;
String sig
=
Sig.getSig(url1
+
"&isDegraded="
+
isDegraded
+
"&code="
+
code
+
"&mobileCountryCode=%2B86&deviceMode="
+
deviceMode
+
"&mobile="
+
mobile
+
"&raw="
+
raw
+
"&publicKey="
+
publicKey
+
"&secret="
+
secret
+
"&type=27&deviceName="
+
deviceName
+
"&os="
+
os
+
"&cs="
+
cs
+
"&client_key="
+
client_key);
System.out.println(sig);
String sig3
=
sign.get_Sig3(
"/rest/n/user/login/mobileVerifyCode"
+
sig);
System.out.println(sig3);
OkHttpClient client
=
new OkHttpClient();
RequestBody formBody
=
new FormBody.Builder()
.add(
"isDegraded"
, isDegraded)
.add(
"code"
, code)
.add(
"mobileCountryCode"
, mobileCountryCode)
.add(
"deviceMode"
, deviceMode)
.add(
"mobile"
, mobile)
.add(
"raw"
, raw)
.add(
"publicKey"
, URLDecoder.decode(publicKey))
.add(
"secret"
, URLDecoder.decode(secret))
.add(
"type"
,
type
)
.add(
"deviceName"
, deviceName)
.add(
"os"
, os)
.add(
"__NS_sig3"
, sig3)
.add(
"cs"
, cs)
.add(
"client_key"
, client_key)
.add(
"sig"
, sig)
.build();
Request request
=
new Request.Builder()
.url(url)
.header(
"User-Agent"
,
"kwai-android aegon/1.27.0"
)
.addHeader(
"Connection"
,
"keep-alive"
)
.addHeader(
"Cookie"
,
"region_ticket=RT_0F2A46CDA1B571279CFDA426AF3ADEF5D26CAC51092F3E61C28DF16CB0927"
)
.addHeader(
"Accept-Language"
,
"zh-cn"
)
.addHeader(
"X-REQUESTID"
, header.X_REQUESTID())
.addHeader(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.addHeader(
"X-Client-Info"
,
"model=Mi Note 3;os=Android;nqe-score=6;network=OTHER;"
)
.post(formBody)
.build();
client.newCall(request).enqueue(new Callback() {
public void onResponse(Call call, Response response) throws IOException {
System.out.println(response.body().string());
}
public void onFailure(Call call, IOException e) {
System.out.println(e.getMessage());
}
});
}
/
/
验证码注册
public static void register(){
String url1
=
"mod=Xiaomi%28Mi%20Note%203%29"
+
"&abi=arm64"
+
"&country_code=CN"
+
"&kpn=KUAISHOU&deviceBit=0"
+
"&oc=XIAOMI"
+
"&egid=DFP38B8CFAD8A814DD70761807391C8472DB4DA4903EF2D4B2EF6489B660ABCF"
+
"&sbh=55"
+
"&hotfix_ver="
+
"&appver=8.0.51.16524"
+
"&sh=1920"
+
"&cold_launch_time_ms=1602855054649"
+
"&nbh=0"
+
"&socName=Qualcomm%20Snapdragon%20660"
+
"&androidApiLevel=25"
+
"&newOc=XIAOMI"
+
"&max_memory=256"
+
"&isp="
+
"&kcv=195"
+
"&browseType=1"
+
"&kpf=ANDROID_PHONE"
+
"&ddpi=440"
+
"&did=ANDROID_fa3658f96e26926a"
+
"&app=0"
+
"&net=WIFI"
+
"&ud=0"
+
"&c=XIAOMI"
+
"&sys=ANDROID_7.1.1"
+
"&sw=1080&ftt="
+
"&keyconfig_state=2"
+
"&language=zh-cn"
+
"&darkMode=false"
+
"&iuid="
+
"&did_gt=1602735340703"
+
"&ver=UNKNOWN"
;
String url
=
"https://apissl.gifshow.com/rest/n/user/register/mobileV2?"
+
url1;
String isDegraded
=
"false"
;
String code
=
"144091"
;
String mobileCountryCode
=
"+86"
;
String deviceMode
=
"Google(Pixel)"
;
/
/
String mobile
=
sign.getPhone(
"18898888988"
);
String raw
=
System.currentTimeMillis()
+
"";
String rsA
=
Rsa.get_Rsa(raw);
String[] strArr
=
rsA.split(
"\\|"
);
String publicKey
=
strArr[
0
];
String secret
=
strArr[
1
];
String
type
=
"27"
;
String deviceName
=
"Google(Pixel)"
;
String os
=
"android"
;
String cs
=
"false"
;
String client_key
=
"3c2cd3f3"
;
String sig
=
Sig.getSig(url1
+
"&isDegraded="
+
isDegraded
+
"&code="
+
code
+
"&mobileCountryCode=%2B86&deviceMode="
+
deviceMode
+
"&mobile="
+
mobile
+
"&raw="
+
raw
+
"&publicKey="
+
publicKey
+
"&secret="
+
secret
+
"&type=27&deviceName="
+
deviceName
+
"&os="
+
os
+
"&cs="
+
cs
+
"&client_key="
+
client_key);
System.out.println(sig);
String sig3
=
sign.get_Sig3(
"/rest/n/user/login/mobileVerifyCode"
+
sig);
System.out.println(sig3);
OkHttpClient client
=
new OkHttpClient();
RequestBody formBody
=
new FormBody.Builder()
.add(
"isDegraded"
, isDegraded)
.add(
"code"
, code)
.add(
"mobileCountryCode"
, mobileCountryCode)
.add(
"deviceMode"
, deviceMode)
.add(
"mobile"
, mobile)
.add(
"raw"
, raw)
.add(
"publicKey"
, URLDecoder.decode(publicKey))
.add(
"secret"
, URLDecoder.decode(secret))
.add(
"type"
,
type
)
.add(
"deviceName"
, deviceName)
.add(
"os"
, os)
.add(
"__NS_sig3"
, sig3)
.add(
"cs"
, cs)
.add(
"client_key"
, client_key)
.add(
"sig"
, sig)
.build();
Request request
=
new Request.Builder()
.url(url)
.header(
"User-Agent"
,
"kwai-android aegon/1.27.0"
)
.addHeader(
"Connection"
,
"keep-alive"
)
.addHeader(
"Cookie"
,
"region_ticket=RT_0F2A46CDA1B571279CFDA426AF3ADEF5D26CAC51092F3E61C28DF16CB0927"
)
.addHeader(
"Accept-Language"
,
"zh-cn"
)
.addHeader(
"X-REQUESTID"
, header.X_REQUESTID())
.addHeader(
"Content-Type"
,
"application/x-www-form-urlencoded"
)
.addHeader(
"X-Client-Info"
,
"model=Pixel;os=Android;nqe-score=1;network=OTHER;"
)
.post(formBody)
.build();
client.newCall(request).enqueue(new Callback() {
public void onResponse(Call call, Response response) throws IOException {
System.out.println(response.body().string());
}
public void onFailure(Call call, IOException e) {
System.out.println(e.getMessage());
}
});
}
}