Я хочу поделиться сетевыми пакетами, которые используют соединение, чтобы объяснить сам;
После первого запроса на веб-страницу я принимаю этот ответ
Код: Выделить всё
HTTP/1.1 200 OK
Server: BlazingFastWeb
Set-Cookie: BlazingWebCookie=XVUXIwf2lb6sfq1sd9e;
Domain=.leakbase.io; Path=/
html page ....
(function(){
var onReady = function( callback ){
var addListener = document.addEventListener || document.attachEvent,
eventName = document.addEventListener ? 'DOMContentLoaded' : 'onreadystatechange';
addListener.call(document, eventName, function(){ callback(); }, false );
}
onReady(function(){
var content = document.getElementById('bf-content');
setTimeout(function(){
var t,r,a,f,r;
t = document.createElement('div');
t.innerHTML="[url=/]x[/url]";
t = t.firstChild.href;
r = t.match(/https?:\/\//)[0];
t = t.substr(r.length);
t = t.substr(0,t.length-1);
a = document.getElementById('bf-answer');
f = document.getElementById('bf-form');
r = document.getElementById('bfu');
r.value = "/";var _0xf8c2=['value'];(function(_0x4e0014,_0x2fd79f){var _0xc27aa=function(_0x466f85){while(--_0x466f85){_0x4e0014['push'](_0x4e0014['shift']());}};_0xc27aa(++_0x2fd79f);}(_0xf8c2,0x12b));var _0x2f8c=function(_0x54b814,_0x35fe0e){_0x54b814=_0x54b814-0x0;var _0x8cc65=_0xf8c2[_0x54b814];return _0x8cc65;};a[_0x2f8c('0x0')]=0x2394+0x2140*0x3f65;
f.submit();
}, 5100);
});
})();
Код: Выделить всё
GET /blzgfst-shark/?bfu=%2F&blazing_answer=1380356 HTTP/1.1
Host: leakbase.io
Cookie: BlazingWebCookie=XVUXIwf2lm6aXiF3EqpJoAaDil11wdDv3U4JkxWzKZc0ybdwUMuhxhb6sfq1sd9e; xf_csrf=sQ7mqPb0eDnNjPqQ
Код: Выделить всё
HTTP/1.1 302 Moved Temporarily
Server: BlazingFastWeb
Set-Cookie: BlazingPuzzleCookie=bjjiM8jQBUuHeSQXHomjuDKZLBiWWnCbkA9jBZAItHfFr5Ttm;
Expires=Sun,
Domain=.leakbase.io;
Path=/
Код: Выделить всё
Request:
GET / HTTP/1.1
Host: leakbase.io
Cookie: BlazingWebCookie=XVUXIwf2lm6aXiF3EqpJoAaDil11wdDv3U4JkxWzKZc0ybdwUMuhxhb6sfq1sd9e; xf_csrf=sQ7mqPb0eDnNjPqQ; BlazingPuzzleCookie=bjjiM8jQBUuH4rksNsnxnrZ5R6feSQXHomjuDKZLBiWWnCbkA9jBZAItHfFr5Ttm
Response:
HTTP/1.1 200 OK
Server: BlazingFastWeb
Set-Cookie: session=RIMpljXe8C9k7X6t_krJ9lKiiLs0.;
Код: Выделить всё
POST /login/login HTTP/1.1
Host: leakbase.io
Cookie: BlazingWebCookie=XVUXIwffq1sd9e; xf_csrf=sQ7mQ; BlazingPuzzleCookie=bjjiM8jQBZAItHfFr5Ttm; _ga=G2183111; _gid=GA122183111; session=D4kCxe-tw..|1|24B-o_VjfshLRcaI.; _ga_F2KL69.0.0.0
_xfToken=17846%2C2b5b0fc79920ff43&login=example&password=example&remember=1&_xfRedirect=httpFleakbase.io%2F
Код: Выделить всё
public class LeakbaseLogin {
public static void main(String[] args) {
try {
// Step 1: Initial connection to get cookies and response
String url = "https://leakbase.io/";
Connection.Response initialResponse = Jsoup.connect(url)
.method(Connection.Method.GET)
.execute();
// Save initial cookies
Map initialCookies = initialResponse.cookies();
// Parse the initial response to get the document
Document initialDoc = initialResponse.parse();
// Step 2: Extract bfu and blazing_answer values from the form
Element bfuElement = initialDoc.select("input[name=bfu]").first();
Element blazingAnswerElement = initialDoc.select("input[name=blazing_answer]").first();
// Extract values
String bfu = bfuElement != null ? bfuElement.attr("value") : "";
String blazingAnswer = blazingAnswerElement != null ? blazingAnswerElement.attr("value") : "";
// Step 3: Make the second request using initial cookies and extracted values
String secondUrl = String.format("https://leakbase.io/blzgfst-shark/?bfu=%s&blazing_answer=%s", bfu, blazingAnswer);
Connection.Response secondResponse = Jsoup.connect(secondUrl)
.method(Connection.Method.GET)
.cookies(initialCookies)
.execute();
// Save cookies after the second request
Map secondCookies = secondResponse.cookies();
// Step 4: Make the third request using all cookies
String thirdUrl = "https://leakbase.io/";
Connection.Response thirdResponse = Jsoup.connect(thirdUrl)
.method(Connection.Method.GET)
.cookies(secondCookies)
.execute();
// Save final cookies
Map finalCookies = thirdResponse.cookies();
// Step 5: Extract _xfToken from the final response
Document finalDoc = thirdResponse.parse();
Element xfTokenElement = finalDoc.select("input[name=_xfToken]").first();
String xfToken = xfTokenElement != null ? xfTokenElement.attr("value") : "";
// Step 6: Make the POST request to login
String loginUrl = "https://leakbase.io/login/login";
String username = "example";
String password = "example";
String encodedPassword = URLEncoder.encode(password, StandardCharsets.UTF_8.toString());
String encodedXfToken = URLEncoder.encode(xfToken, StandardCharsets.UTF_8.toString());
Connection.Response loginResponse = Jsoup.connect(loginUrl)
.method(Connection.Method.POST)
.cookies(finalCookies)
.data("_xfToken", encodedXfToken)
.data("login", username)
.data("password", encodedPassword)
.data("remember", "1")
.data("_xfRedirect", "https://leakbase.io/")
.header("Content-Type", "application/x-www-form-urlencoded")
.execute();
// Print the final response to verify login
Document loginDoc = loginResponse.parse();
System.out.println(loginDoc);
} catch (IOException e) {
e.printStackTrace();
}
}
}
Я пытался написать js-код в своем коде, но не получилось. Я не знаю, как мне использовать blazing_ответ? Кроме того, я пытался вручную установить файлы cookie и подключиться для входа в систему, но всегда подключаюсь к первой странице, на которой есть скрипт для создания blazin_ответ.
Код: Выделить всё
// Step 1: Manually set the initial cookies
Map initialCookies = new HashMap();
initialCookies.put("BlazingWebCookie", "XVUXIwf2lm6aXiFdwUMuhxhb6sfq1sd9e");
initialCookies.put("xf_csrf", "sQ7jPqQ");
initialCookies.put("BlazingPuzzleCookie", "bjjiM8jQBUuH4rknCbkA9jBZAItHfFr5Ttm");
initialCookies.put("_ga", "G22183111");
initialCookies.put("_gid", "GA1.1722183111");
initialCookies.put("session", "D4kB-o_VjfshLRNoOHxNiAV_icaI.");
initialCookies.put("_ga_F2KL613JG6", "GS.0.0");
// Step 2: Initial connection to get the response and tokens
String url = "https://leakbase.io/";
Connection.Response initialResponse = Jsoup.connect(url)
.cookies(initialCookies)
.method(Connection.Method.GET)
.execute();
Подробнее здесь: https://stackoverflow.com/questions/788 ... up-in-java