mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
chore: ipcheck
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE cd_site_info ADD COLUMN ip_scan boolean DEFAULT (0);
|
||||
|
||||
ALTER TABLE pi_pipeline ADD COLUMN webhook_key varchar(100);
|
||||
|
||||
@@ -46,6 +46,9 @@ export class SiteInfoEntity {
|
||||
@Column({ name: 'ip_check', comment: '是否检查IP' })
|
||||
ipCheck: boolean;
|
||||
|
||||
@Column({ name: 'ip_scan', comment: '是否自动获取IP' })
|
||||
ipScan: boolean;
|
||||
|
||||
@Column({ name: 'ip_count', comment: 'ip数量' })
|
||||
ipCount: number
|
||||
|
||||
|
||||
@@ -18,6 +18,5 @@ export * from "./lucky/index.js";
|
||||
export * from "./kuocai/index.js";
|
||||
export * from "./unicloud/index.js";
|
||||
export * from "./maoyun/index.js";
|
||||
export * from "./xinnet/index.js";
|
||||
export * from "./exsi/index.js";
|
||||
export * from "./openwrt/index.js";
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
import crypto from "crypto-js";
|
||||
import { HttpClient, HttpRequestConfig, ILogger, utils } from "@certd/basic";
|
||||
import { Pager, PageSearch } from "@certd/pipeline";
|
||||
|
||||
export class XinnetClient {
|
||||
access = null;
|
||||
http = null;
|
||||
logger = null;
|
||||
|
||||
xTickets = null;
|
||||
loginCookies = null;
|
||||
domainTokenCookie = null;
|
||||
|
||||
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0";
|
||||
|
||||
constructor(opts: { access: { username: string; password: string }; logger: ILogger; http: HttpClient }) {
|
||||
this.access = opts.access;
|
||||
this.http = opts.http;
|
||||
this.logger = opts.logger;
|
||||
}
|
||||
|
||||
async doRedirectRequest(conf: HttpRequestConfig) {
|
||||
let resRedirect = null;
|
||||
try {
|
||||
resRedirect = await this.http.request(conf);
|
||||
} catch (e) {
|
||||
resRedirect = e.response;
|
||||
this.logger.info(resRedirect.headers);
|
||||
if (!resRedirect) {
|
||||
throw new Error("请求失败:", e);
|
||||
}
|
||||
}
|
||||
return resRedirect;
|
||||
}
|
||||
|
||||
getCookie(response: any) {
|
||||
const setCookie = response.headers["set-cookie"];
|
||||
if (!setCookie || setCookie.length === 0) {
|
||||
throw new Error("未获取到cookie", response);
|
||||
}
|
||||
return setCookie
|
||||
.map(item => {
|
||||
return item.split(";")[0];
|
||||
})
|
||||
.join(";");
|
||||
}
|
||||
|
||||
async getToken() {
|
||||
const res = await this.http.request({
|
||||
url: "https://login.xinnet.com/queryUOne",
|
||||
method: "get",
|
||||
});
|
||||
this.logger.info("queryUOne", res.data);
|
||||
const { uOne, uTwo } = res.data;
|
||||
|
||||
const res1 = await this.doRedirectRequest({
|
||||
url: "https://login.xinnet.com/newlogin",
|
||||
method: "get",
|
||||
headers: {
|
||||
Host: "login.xinnet.com",
|
||||
Origin: "https://login.xinnet.com",
|
||||
Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
returnOriginRes: true,
|
||||
});
|
||||
|
||||
const cookie = this.getCookie(res1);
|
||||
this.logger.info("firstCookie", cookie);
|
||||
|
||||
function encrypt(password, utwo) {
|
||||
// return "" + crypto.encrypt(password, utwo);
|
||||
return crypto.AES.encrypt(password, utwo).toString();
|
||||
}
|
||||
|
||||
const data = {
|
||||
username: this.access.username,
|
||||
password: encrypt(this.access.password, uTwo),
|
||||
uOne: uOne,
|
||||
randStr: "",
|
||||
ticket: "",
|
||||
service: "",
|
||||
isRemoteLogin: false,
|
||||
};
|
||||
const formData = new FormData();
|
||||
for (const key in data) {
|
||||
formData.append(key, data[key]);
|
||||
}
|
||||
const res2 = await this.http.request({
|
||||
url: "https://login.xinnet.com/newlogin",
|
||||
method: "post",
|
||||
headers: {
|
||||
Origin: "https://login.xinnet.com",
|
||||
Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
"Content-Type": "multipart/form-data",
|
||||
Cookie: cookie,
|
||||
},
|
||||
data: formData,
|
||||
withCredentials: true,
|
||||
returnOriginRes: true,
|
||||
});
|
||||
// console.log(res2.data);
|
||||
const loginedCookie = this.getCookie(res2);
|
||||
this.logger.info("登录成功,loginCookie:", loginedCookie);
|
||||
const tickets = res2.data.data.xTickets;
|
||||
this.logger.info("tickets:", tickets);
|
||||
|
||||
this.xTickets = tickets;
|
||||
this.loginCookies = loginedCookie;
|
||||
|
||||
const xticketArr = this.xTickets.split("###");
|
||||
// const ssoTiccket = xticketArr[0];
|
||||
const domainTicket = xticketArr[3];
|
||||
|
||||
// "jsonp_" + (Math.floor(1e5 * Math.random()) * Date.now()).toString(16)
|
||||
const jsonp = "jsonp_" + (Math.floor(1e5 * Math.random()) * Date.now()).toString(16);
|
||||
|
||||
const xtokenUrl = `https://domain.xinnet.com/domainsso/getXtoken?xticket=${domainTicket}&callback=${jsonp}`;
|
||||
console.log("getxtoken-------", xtokenUrl);
|
||||
const res4 = await this.doRedirectRequest({
|
||||
// https://domain.xinnet.com/domainsso/getXtoken?xticket=gZNBBDObcyxKaQqRVDj&callback=jsonp_6227d9fe0004c4
|
||||
url: xtokenUrl,
|
||||
method: "get",
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
|
||||
cookie: loginedCookie,
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
returnOriginRes: true,
|
||||
});
|
||||
|
||||
const cookie4 = this.getCookie(res4);
|
||||
this.logger.info("获取domainXtoken成功:", cookie4);
|
||||
this.domainTokenCookie = cookie4;
|
||||
}
|
||||
|
||||
async getDomainList(data: PageSearch): Promise<{ totalRows: number; list: { domainName: string; serviceCode: string }[] }> {
|
||||
if (!this.domainTokenCookie) {
|
||||
await this.getToken();
|
||||
}
|
||||
|
||||
const pager = new Pager(data);
|
||||
const domainListUrl = "https://domain.xinnet.com/domainManage/domainList";
|
||||
|
||||
const res = await this.doDomainRequest({
|
||||
url: domainListUrl,
|
||||
method: "post",
|
||||
data: {
|
||||
pageNo: pager.pageNo,
|
||||
pageSize: pager.pageSize,
|
||||
domainName: data.searchKey ?? "",
|
||||
},
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
async doDomainRequest(conf: HttpRequestConfig) {
|
||||
if (!this.domainTokenCookie) {
|
||||
await this.getToken();
|
||||
}
|
||||
const res = await this.http.request({
|
||||
url: conf.url,
|
||||
method: conf.method ?? "post",
|
||||
headers: {
|
||||
Host: "domain.xinnet.com",
|
||||
Origin: "https://domain.xinnet.com",
|
||||
Referer: "https://domain.xinnet.com/",
|
||||
"User-Agent": this.userAgent,
|
||||
cookie: this.domainTokenCookie,
|
||||
},
|
||||
data: conf.data,
|
||||
withCredentials: true,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
async getDcpCookie(opts: { serviceCode: string }) {
|
||||
if (!this.domainTokenCookie) {
|
||||
await this.getToken();
|
||||
}
|
||||
const domainTokenCookie = this.domainTokenCookie;
|
||||
const serviceCode = opts.serviceCode;
|
||||
const redirectDcpUrl = "https://domain.xinnet.com/dcp?serviceCode=" + serviceCode + "&type=analytic";
|
||||
const res10 = await this.doRedirectRequest({
|
||||
url: redirectDcpUrl,
|
||||
method: "get",
|
||||
headers: {
|
||||
cookie: domainTokenCookie,
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
returnOriginRes: true,
|
||||
});
|
||||
|
||||
const location = res10.headers["location"];
|
||||
console.log("跳转到dcp:", location);
|
||||
|
||||
const resRedirect = await this.doRedirectRequest({
|
||||
url: location,
|
||||
method: "get",
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
returnOriginRes: true,
|
||||
});
|
||||
|
||||
const newCookie = this.getCookie(resRedirect);
|
||||
this.logger.info("dcpCookie", newCookie);
|
||||
return newCookie;
|
||||
}
|
||||
|
||||
async getDomainDnsList(opts: { serviceCode: string; recordValue?: string; dcpCookie }) {
|
||||
const dnsListURL = "https://dcp.xinnet.com/dcp/domaincloudanalytic/list";
|
||||
const res = await this.http.request({
|
||||
url: dnsListURL,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
cookie: opts.dcpCookie,
|
||||
},
|
||||
data: {
|
||||
type: "ALL",
|
||||
content: opts.recordValue || "",
|
||||
skip: 1,
|
||||
limit: 10,
|
||||
},
|
||||
withCredentials: true,
|
||||
});
|
||||
if (res.code != 0) {
|
||||
this.logger.error("获取DNS列表失败", JSON.stringify(res));
|
||||
throw new Error("获取DNS列表失败");
|
||||
}
|
||||
return res.data?.list;
|
||||
}
|
||||
|
||||
async addDomainDnsRecord(req: { recordName: string; type: string; recordValue: string }, opts: { serviceCode: string; dcpCookie: string }) {
|
||||
const addDnsUrl = "https://dcp.xinnet.com/dcp/domaincloudanalytic/add";
|
||||
const addRes = await this.doDcpRequest(
|
||||
{
|
||||
url: addDnsUrl,
|
||||
method: "post",
|
||||
data: {
|
||||
recordName: req.recordName,
|
||||
type: req.type,
|
||||
content: req.recordValue,
|
||||
ttl: 600,
|
||||
phoneCode: 1,
|
||||
},
|
||||
},
|
||||
opts
|
||||
);
|
||||
this.logger.info(addRes);
|
||||
|
||||
await utils.sleep(3000);
|
||||
|
||||
const res = await this.getDomainDnsList({
|
||||
serviceCode: opts.serviceCode,
|
||||
recordValue: req.recordValue,
|
||||
dcpCookie: opts.dcpCookie,
|
||||
});
|
||||
// console.log(res.data);
|
||||
if (!res || res.length === 0) {
|
||||
throw new Error("未找到添加的DNS记录");
|
||||
}
|
||||
const item = res[0];
|
||||
return {
|
||||
recordId: item.id,
|
||||
recordFullName: item.name,
|
||||
recordValue: item.content,
|
||||
type: item.type,
|
||||
};
|
||||
}
|
||||
|
||||
async deleteDomainDnsRecord(req: { recordId: number; recordFullName: string; type: string; recordValue: string }, opts: { serviceCode: string; dcpCookie }) {
|
||||
const delDnsUrl = "https://dcp.xinnet.com/dcp/domaincloudanalytic/delete";
|
||||
const res13 = await this.doDcpRequest(
|
||||
{
|
||||
url: delDnsUrl,
|
||||
method: "post",
|
||||
data: {
|
||||
recordId: req.recordId,
|
||||
recordName: req.recordFullName,
|
||||
content: req.recordValue,
|
||||
type: req.type,
|
||||
isBatch: 0,
|
||||
phoneCode: 1,
|
||||
},
|
||||
},
|
||||
opts
|
||||
);
|
||||
console.log(res13.data);
|
||||
return res13;
|
||||
}
|
||||
|
||||
async doDcpRequest(req: HttpRequestConfig, opts: { serviceCode: string; dcpCookie: string }) {
|
||||
return await this.http.request({
|
||||
url: req.url,
|
||||
method: req.method ?? "post",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
cookie: opts.dcpCookie,
|
||||
},
|
||||
withCredentials: true,
|
||||
data: req.data,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export * from "./client.js";
|
||||
@@ -1,161 +0,0 @@
|
||||
import axios from "axios";
|
||||
import crypto from "crypto-js";
|
||||
import https from "https";
|
||||
import qs from "qs";
|
||||
|
||||
function getCookie(res1) {
|
||||
let setCookie = res1.headers["set-cookie"];
|
||||
console.log(setCookie);
|
||||
let cookie = setCookie
|
||||
.map(item => {
|
||||
return item.split(";")[0];
|
||||
})
|
||||
.join(";");
|
||||
return cookie;
|
||||
}
|
||||
|
||||
async function login() {
|
||||
const httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false, // 这里可以设置为 false 来忽略 SSL 证书验证
|
||||
});
|
||||
const instance = axios.create({
|
||||
timeout: 3000, // 请求超时时间
|
||||
withCredentials: true,
|
||||
httpsAgent,
|
||||
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0" }, // 设置请求头
|
||||
});
|
||||
|
||||
//
|
||||
// const res = await instance.get("https://login.xinnet.com/queryUOne");
|
||||
//
|
||||
// console.log(res.data?.data);
|
||||
// const { uOne, uTwo } = res.data.data;
|
||||
|
||||
let res1 = null;
|
||||
try {
|
||||
res1 = await instance.request({
|
||||
url: "https://dcp.xinnet.com/",
|
||||
method: "get",
|
||||
headers: {},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.response.headers);
|
||||
res1 = e.response;
|
||||
}
|
||||
|
||||
let cookie = getCookie(res1);
|
||||
|
||||
console.log(cookie);
|
||||
|
||||
function encrypt(password, secret) {
|
||||
// return "" + crypto.encrypt(password, utwo);
|
||||
return crypto.AES.encrypt(password, secret).toString();
|
||||
}
|
||||
|
||||
const codeGetUrl = "https://dcp.xinnet.com/domain/getValidatePic";
|
||||
|
||||
const res2 = await instance.request({
|
||||
url: codeGetUrl,
|
||||
method: "get",
|
||||
responseType: "arraybuffer",
|
||||
headers: {
|
||||
"Content-Type": "application/json;charset=utf-8",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
|
||||
Host: "dcp.xinnet.com",
|
||||
cookie: cookie,
|
||||
},
|
||||
// maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
console.log("status:", res2.status);
|
||||
const imageData = res2.data;
|
||||
let imageBuffer = Buffer.from(imageData, "binary");
|
||||
|
||||
const res3 = await axios.request({
|
||||
url: "https://ocr.com/ocr",
|
||||
method: "post",
|
||||
headers: {
|
||||
Authorization: "Basic " + Buffer.from("username:password").toString("base64"),
|
||||
},
|
||||
httpsAgent,
|
||||
data: {
|
||||
image: imageBuffer.toString("base64"),
|
||||
},
|
||||
});
|
||||
|
||||
console.log(res3.data.result.ocr_response);
|
||||
let text = res3.data.result.ocr_response.map(item => item.text.trim()).join("");
|
||||
text = text.replaceAll(" ", "");
|
||||
console.log(text);
|
||||
|
||||
const url = "https://dcp.xinnet.com/domain/validEnter";
|
||||
const password = encrypt("jidian1zu", "this is temp before https");
|
||||
// const body = {
|
||||
// domainName: "ulogin.top",
|
||||
// password: encodeURIComponent(password),
|
||||
// checkCode: encodeURIComponent( text),
|
||||
// }
|
||||
const body = {
|
||||
domainName: "ulogin.top",
|
||||
password: password,
|
||||
checkCode: text,
|
||||
};
|
||||
const query = qs.stringify(body);
|
||||
console.log(query);
|
||||
const res4 = await instance.request({
|
||||
url: url,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
// cookie: cookie,
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/",
|
||||
cookie: cookie,
|
||||
},
|
||||
data: body,
|
||||
withCredentials: true,
|
||||
});
|
||||
console.log(res4.data);
|
||||
|
||||
const domainEnterUrl = "https://dcp.xinnet.com/domain/domainEnter";
|
||||
const res6 = await instance.request({
|
||||
url: domainEnterUrl,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/",
|
||||
cookie: cookie,
|
||||
},
|
||||
data: body,
|
||||
withCredentials: true,
|
||||
});
|
||||
|
||||
console.log(res6.data);
|
||||
|
||||
const listUrl = "https://dcp.xinnet.com/dcp/domaincloudanalytic/list";
|
||||
const res5 = await instance.request({
|
||||
url: listUrl,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
cookie: cookie,
|
||||
},
|
||||
withCredentials: true,
|
||||
data: {
|
||||
type: "ALL",
|
||||
content: "",
|
||||
limit: 10,
|
||||
},
|
||||
});
|
||||
console.log(res5.data);
|
||||
}
|
||||
|
||||
login();
|
||||
@@ -1,341 +0,0 @@
|
||||
import axios from "axios";
|
||||
import crypto from "crypto-js";
|
||||
|
||||
function getCookie(res1) {
|
||||
let setCookie = res1.headers["set-cookie"];
|
||||
console.log(setCookie);
|
||||
let cookie = setCookie
|
||||
.map(item => {
|
||||
return item.split(";")[0];
|
||||
})
|
||||
.join(";");
|
||||
return cookie;
|
||||
}
|
||||
|
||||
async function login() {
|
||||
const instance = axios.create({
|
||||
timeout: 3000, // 请求超时时间
|
||||
withCredentials: true,
|
||||
headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0" }, // 设置请求头
|
||||
});
|
||||
|
||||
const res = await instance.get("https://login.xinnet.com/queryUOne");
|
||||
|
||||
console.log(res.data?.data);
|
||||
const { uOne, uTwo } = res.data.data;
|
||||
|
||||
let res1 = null;
|
||||
try {
|
||||
res1 = await instance.request({
|
||||
url: "https://login.xinnet.com/newlogin",
|
||||
method: "get",
|
||||
headers: {
|
||||
Host: "login.xinnet.com",
|
||||
Origin: "https://login.xinnet.com",
|
||||
Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.response.headers);
|
||||
res1 = e.response;
|
||||
}
|
||||
|
||||
let cookie = getCookie(res1);
|
||||
|
||||
function encrypt(password, utwo) {
|
||||
// return "" + crypto.encrypt(password, utwo);
|
||||
return crypto.AES.encrypt(password, utwo).toString();
|
||||
}
|
||||
|
||||
const data = {
|
||||
username: 18603046467,
|
||||
password: encrypt("xxxxxxxxxxxxxpassword", uTwo),
|
||||
uOne: uOne,
|
||||
randStr: "",
|
||||
ticket: "",
|
||||
service: "",
|
||||
isRemoteLogin: false,
|
||||
};
|
||||
const formData = new FormData();
|
||||
for (const key in data) {
|
||||
formData.append(key, data[key]);
|
||||
}
|
||||
const res2 = await instance.request({
|
||||
url: "https://login.xinnet.com/newlogin",
|
||||
method: "post",
|
||||
headers: {
|
||||
Origin: "https://login.xinnet.com",
|
||||
Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
"Content-Type": "multipart/form-data",
|
||||
Cookie: cookie,
|
||||
},
|
||||
data: formData,
|
||||
withCredentials: true,
|
||||
});
|
||||
console.log(res2.data);
|
||||
let loginedCookie = getCookie(res2);
|
||||
console.log("loginCookie", loginedCookie);
|
||||
|
||||
const tickets = res2.data.data.xTickets;
|
||||
|
||||
const xticketArr = tickets.split("###");
|
||||
const ssoTiccket = xticketArr[0];
|
||||
const domainTicket = xticketArr[3];
|
||||
|
||||
// "jsonp_" + (Math.floor(1e5 * Math.random()) * Date.now()).toString(16)
|
||||
const jsonp = "jsonp_" + (Math.floor(1e5 * Math.random()) * Date.now()).toString(16);
|
||||
|
||||
// const ssoUrl = `https://www.xinnet.com/sso/getXtoken?xticket=${ssoTiccket}&callback=${jsonp}`;
|
||||
// const res3 = await axios.request({
|
||||
// url: ssoUrl,
|
||||
// method: "get",
|
||||
// headers: {
|
||||
// Host: "www.xinnet.com",
|
||||
// Origin: "https://login.xinnet.com",
|
||||
// Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
// "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/}"
|
||||
// },
|
||||
// cookie:loginedCookie,
|
||||
// maxRedirects: 0,
|
||||
// withCredentials: true
|
||||
// });
|
||||
//
|
||||
// console.log(res3.data);
|
||||
// let cookie2 = getCookie(res3);
|
||||
// console.log(cookie2);
|
||||
|
||||
let res4 = null;
|
||||
try {
|
||||
const xtokenUrl = `https://domain.xinnet.com/domainsso/getXtoken?xticket=${domainTicket}&callback=${jsonp}`;
|
||||
console.log("getxtoken-------", xtokenUrl);
|
||||
res4 = await instance.request({
|
||||
// https://domain.xinnet.com/domainsso/getXtoken?xticket=gZNBBDObcyxKaQqRVDj&callback=jsonp_6227d9fe0004c4
|
||||
url: xtokenUrl,
|
||||
method: "get",
|
||||
headers: {
|
||||
/**
|
||||
* Host:
|
||||
* ssl.xinnet.com
|
||||
* Referer:
|
||||
* https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/
|
||||
*/
|
||||
// Host: "ssl.xinnet.com",
|
||||
// Referer: "https://login.xinnet.com/separatePage/?service=https://www.xinnet.com/",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
|
||||
cookie: loginedCookie,
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
} catch (e) {
|
||||
res4 = e.response;
|
||||
console.log(res4.headers);
|
||||
}
|
||||
console.log(res4.data);
|
||||
let domainTokenCookie = getCookie(res4);
|
||||
console.log("domainTokenCookie", domainTokenCookie);
|
||||
|
||||
//
|
||||
// let res8 = null;
|
||||
// const consoleXtokenUrl = `https://console.xinnet.com/sso/getXtoken?xticket=${domainTicket}&callback=${jsonp}`;
|
||||
// console.log("getConsolextoken-------", consoleXtokenUrl);
|
||||
// res8 = await instance.request({
|
||||
// // https://domain.xinnet.com/domainsso/getXtoken?xticket=gZNBBDObcyxKaQqRVDj&callback=jsonp_6227d9fe0004c4
|
||||
// url: consoleXtokenUrl,
|
||||
// method: "get",
|
||||
// headers: {
|
||||
// "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
|
||||
// cookie: loginedCookie
|
||||
// },
|
||||
// maxRedirects: 0,
|
||||
// withCredentials: true
|
||||
// });
|
||||
//
|
||||
// console.log(res8.data);
|
||||
// let consoleTokenCookie = getCookie(res8);
|
||||
// console.log("consoleTokenCookie", consoleTokenCookie);
|
||||
|
||||
// const consoleIdUrl = "https://console.xinnet.com/usercommon/getShopcartNum";
|
||||
//
|
||||
// const res7 = await instance.request({
|
||||
// url: consoleIdUrl,
|
||||
// method: "get",
|
||||
// headers: {
|
||||
// Host: "console.xinnet.com",
|
||||
// Referer: "https://domain.xinnet.com/",
|
||||
// cookie: consoleTokenCookie +";"+ loginedCookie
|
||||
// }
|
||||
// });
|
||||
// console.log(res7.data);
|
||||
// let consoleIdCookie = getCookie(res7);
|
||||
// console.log("consoleIdCookie",consoleIdCookie);
|
||||
|
||||
const domainListUrl = "https://domain.xinnet.com/domainManage/domainList";
|
||||
|
||||
const res5 = await instance.request({
|
||||
url: domainListUrl,
|
||||
method: "post",
|
||||
headers: {
|
||||
/**
|
||||
* Host:
|
||||
* domain.xinnet.com
|
||||
* Origin:
|
||||
* https://domain.xinnet.com
|
||||
* Referer:
|
||||
* https://domain.xinnet.com/
|
||||
*/
|
||||
Host: "domain.xinnet.com",
|
||||
Origin: "https://domain.xinnet.com",
|
||||
Referer: "https://domain.xinnet.com/",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
|
||||
cookie: domainTokenCookie,
|
||||
},
|
||||
data: {
|
||||
/**
|
||||
* pageNo: 1
|
||||
* pageSize: 10
|
||||
* orderByProperty: expire_date
|
||||
* orderByType: asc
|
||||
*/
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
withCredentials: true,
|
||||
});
|
||||
console.log(res5.data);
|
||||
|
||||
// const bindUrls = [
|
||||
// "https://domain.xinnet.com/domainManage/inspectDomainRealname",
|
||||
// "https://domain.xinnet.com/domainManage/inspectDomainBindPhone",
|
||||
// "https://domain.xinnet.com/domainManage/inspectDomainXinnetDns",
|
||||
// "https://domain.xinnet.com/domainManage/inspectDomainEvents"
|
||||
// ];
|
||||
// const consoleIdCookie = consoleTokenCookie.split(";")[0];
|
||||
// for (const url of bindUrls) {
|
||||
// console.log("do bind:", url);
|
||||
// const cookie1 = consoleIdCookie + ";" + domainTokenCookie;
|
||||
// console.log("cookie1", cookie1);
|
||||
// const res9 = await instance.request({
|
||||
// url: url,
|
||||
// method: "post",
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
// Host: "domain.xinnet.com",
|
||||
// Origin: "https://domain.xinnet.com",
|
||||
// Referer: "https://domain.xinnet.com",
|
||||
// cookie: cookie1
|
||||
// },
|
||||
// data: {
|
||||
// domainName: "ulogin.top"
|
||||
// },
|
||||
// withCredentials: true
|
||||
// });
|
||||
// console.log(res9.data);
|
||||
// }
|
||||
|
||||
const serviceCode = "D76534287817377";
|
||||
const redirectDcpUrl = "https://domain.xinnet.com/dcp?serviceCode=" + serviceCode + "&type=analytic";
|
||||
let res10 = null;
|
||||
try {
|
||||
res10 = await instance.request({
|
||||
url: redirectDcpUrl,
|
||||
method: "get",
|
||||
headers: {
|
||||
cookie: domainTokenCookie,
|
||||
},
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
} catch (e) {
|
||||
res10 = e.response;
|
||||
console.log(res10.headers);
|
||||
}
|
||||
const location = res10.headers["location"];
|
||||
console.log("跳转到dcp:", location);
|
||||
|
||||
let resRedirect = null;
|
||||
try {
|
||||
resRedirect = await instance.request({
|
||||
url: location,
|
||||
method: "get",
|
||||
maxRedirects: 0,
|
||||
withCredentials: true,
|
||||
});
|
||||
} catch (e) {
|
||||
resRedirect = e.response;
|
||||
console.log(resRedirect.headers);
|
||||
}
|
||||
|
||||
const newCookie = getCookie(resRedirect);
|
||||
console.log("newCookie", newCookie);
|
||||
|
||||
const dnsListURL = "https://dcp.xinnet.com/dcp/domaincloudanalytic/list";
|
||||
const res11 = await instance.request({
|
||||
url: dnsListURL,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
Host: "dcp.xinnet.com",
|
||||
Origin: "https://dcp.xinnet.com",
|
||||
Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
cookie: newCookie,
|
||||
},
|
||||
data: {
|
||||
type: "ALL",
|
||||
content: "",
|
||||
skip: 1,
|
||||
limit: 10,
|
||||
},
|
||||
withCredentials: true,
|
||||
});
|
||||
console.log(res11.data);
|
||||
|
||||
//add dns
|
||||
// const addDnsUrl = "https://dcp.xinnet.com/dcp/domaincloudanalytic/add"
|
||||
// const res12 = await instance.request({
|
||||
// url: addDnsUrl,
|
||||
// method: "post",
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
// Host: "dcp.xinnet.com",
|
||||
// Origin: "https://dcp.xinnet.com",
|
||||
// Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
// cookie: newCookie
|
||||
// },
|
||||
// data: {
|
||||
// recordName: "343533",
|
||||
// type: "TXT",
|
||||
// content: "456456",
|
||||
// ttl: 600,
|
||||
// phoneCode: 1,
|
||||
// }
|
||||
// })
|
||||
// console.log(res12.data);
|
||||
//
|
||||
// const delDnsUrl = "https://dcp.xinnet.com/dcp/domaincloudanalytic/delete"
|
||||
//
|
||||
// const res13 = await instance.request({
|
||||
// url: delDnsUrl,
|
||||
// method: "post",
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
// Host: "dcp.xinnet.com",
|
||||
// Origin: "https://dcp.xinnet.com",
|
||||
// Referer: "https://dcp.xinnet.com/dcpProduct.html",
|
||||
// cookie: newCookie
|
||||
// },
|
||||
// data:{
|
||||
// recordId: 167529045,
|
||||
// recordName: "aaaa.ulogin.top",
|
||||
// content: "aaaa",
|
||||
// type: "TXT",
|
||||
// isBatch: 0,
|
||||
// phoneCode: 1,
|
||||
// }
|
||||
// })
|
||||
// console.log(res13.data);
|
||||
}
|
||||
|
||||
login();
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IsAccess, AccessInput, BaseAccess } from "@certd/pipeline";
|
||||
import { XinnetClient } from "../plugin-plus/xinnet/client.js";
|
||||
import { XinnetClient } from "@certd/plugin-plus";
|
||||
|
||||
/**
|
||||
* 这个注解将注册一个授权配置
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AbstractDnsProvider, CreateRecordOptions, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
|
||||
import { XinnetAccess } from "./access.js";
|
||||
import { XinnetClient } from "../plugin-plus/xinnet/client.js";
|
||||
import { XinnetClient } from "@certd/plugin-plus";
|
||||
|
||||
export type XinnetRecord = {
|
||||
recordId: number;
|
||||
|
||||
Reference in New Issue
Block a user