mirror of
https://github.com/woodchen-ink/openai-billing-query.git
synced 2025-07-19 06:21:59 +08:00
update
This commit is contained in:
parent
99472ac3fd
commit
d8a50578bc
53
get_sess.html
Normal file
53
get_sess.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>获取SESS</title>
|
||||||
|
<meta name="description" content="批量获取OPENAI账号的sess id">
|
||||||
|
<link rel="stylesheet" href="./static/css.css" type="text/css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1 class="text-3xl font-semibold text-center mb-8 text-gradient">获取SESS</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="query">
|
||||||
|
<div>
|
||||||
|
<h2 style="display: inline-block;">输入 API KEY</h2>
|
||||||
|
<p style="display: inline-block; font-size: smaller;">通过fakeopen.com获取,自行考虑风险。</p>
|
||||||
|
</div>
|
||||||
|
<textarea id="api-key-input" placeholder="请输入 账号和密码,用 --- 分开,前后有两个空格"></textarea></p>
|
||||||
|
</div>
|
||||||
|
<button :class="{ loading }" :disabled="loading" onclick="sendRequest()">查询</button> </p>
|
||||||
|
</div>
|
||||||
|
<h2 id="result-head" style="visibility:hidden">查询结果</h2>
|
||||||
|
<table id="result" style="visibility:hidden">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:35px">序号</th>
|
||||||
|
<th>邮箱</th>
|
||||||
|
<th style="width: 50px;">user-id</th>
|
||||||
|
<th >sess</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>广告链接:
|
||||||
|
<a href="https://chat.czl.net" target="_blank">CZLChat</a>
|
||||||
|
<a href="https://oapi.czl.net" target="_blank">CZLOapi</a>
|
||||||
|
<br>
|
||||||
|
本网页由<a href="https://woodchen.ink" target="_blank">woodchen</a>开源于<a
|
||||||
|
href="https://github.com/woodchen-ink/openai-billing-query" target="_blank">Github</a>,欢迎给个star
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</footer>
|
||||||
|
<script src="./static/sess.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
70
static/sess.js
Normal file
70
static/sess.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// 定义一个异步函数来发送请求
|
||||||
|
async function sendRequest() {
|
||||||
|
//获取用户输入的账号和密码
|
||||||
|
let input = document.getElementById('api-key-input').value.split('\n');
|
||||||
|
let users = input.map(user => {
|
||||||
|
const [username, password] = user.split(' --- ');
|
||||||
|
return { username, password };
|
||||||
|
});
|
||||||
|
|
||||||
|
//获取前一天的日期
|
||||||
|
let day = new Date();
|
||||||
|
day.setDate(day.getDate() - 1);
|
||||||
|
let yesterday = day.toISOString().slice(0, 10).replace(/-/g, '');
|
||||||
|
|
||||||
|
for (let i = 0; i < users.length; i++) {
|
||||||
|
let user = users[i];
|
||||||
|
|
||||||
|
//发送第一个请求
|
||||||
|
const response1 = await fetch('https://ai-' + yesterday + '.fakeopen.com/auth/login', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Origin': `https://ai-${yesterday}.fakeopen.com`,
|
||||||
|
'Referer': `https://ai-${yesterday}.fakeopen.com/auth1`
|
||||||
|
},
|
||||||
|
body: new URLSearchParams({
|
||||||
|
username: user.username,
|
||||||
|
password: user.password,
|
||||||
|
mfa_code: ''
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const data1 = await response1.json();
|
||||||
|
const accessToken = data1.access_token;
|
||||||
|
|
||||||
|
//发送第二个请求
|
||||||
|
const response2 = await fetch('https://ai.fakeopen.com/dashboard/onboarding/login', {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Bearer ' + accessToken,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data2 = await response2.json();
|
||||||
|
|
||||||
|
//打印结果到 #result 表格
|
||||||
|
let result = document.getElementById('result');
|
||||||
|
result.style.visibility = 'visible';
|
||||||
|
result.innerHTML += `<tr><td>${i + 1}</td><td>${data2.user.email}</td><td>${data2.user.id}</td><td>${data2.user.session.sensitive_id}</td></tr>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示结果标题
|
||||||
|
document.getElementById('result-head').style.visibility = 'visible';
|
||||||
|
|
||||||
|
//为每个用户添加一个按钮,点击复制 sensitive_id
|
||||||
|
let button = document.createElement('button');
|
||||||
|
button.innerText = '复制 sensitive_id';
|
||||||
|
document.body.appendChild(button);
|
||||||
|
let sensitive_ids = Array.from(document.getElementById('result').querySelectorAll('tr td:nth-child(4)')).map(td => td.innerText);
|
||||||
|
button.addEventListener('click', function () {
|
||||||
|
let copyText = sensitive_ids.join('\n');
|
||||||
|
navigator.clipboard.writeText(copyText)
|
||||||
|
.then(() => {
|
||||||
|
alert('Copied!');
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
alert('Error in copying text: ', err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user