Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const requests = [
- {
- pathname: "/dorf1.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/statistiken.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/karte.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/minimap.php",
- type: "GET",
- names: [
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Accept",
- value: "image/webp,image/apng,image/*,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/map_block.php",
- type: "GET",
- names: [
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Accept",
- value: "image/webp,image/apng,image/*,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/map_mark.php",
- type: "GET",
- names: [
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Accept",
- value: "image/webp,image/apng,image/*,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/dorf2.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/logout.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/dorf1.php",
- type: "POST",
- names: [
- "Upgrade-Insecure-Requests",
- "Content-Type",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Content-Type",
- value: "application/x-www-form-urlencoded"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/messages.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/ajax.php",
- type: "POST",
- names: [
- "Accept",
- "X-Requested-With",
- "X-Request",
- "User-Agent",
- "Content-Type",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Accept",
- value: "application/json, text/javascript, */*; q=0.01"
- },
- {
- name: "Content-Type",
- value: "application/x-www-form-urlencoded; charset=UTF-8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/build.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/build.php",
- type: "POST",
- names: [
- "Upgrade-Insecure-Requests",
- "Content-Type",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Content-Type",
- value: "application/x-www-form-urlencoded"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/hero.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/start_adventure.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/dorf3.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/berichte.php",
- type: "GET",
- names: [
- "Upgrade-Insecure-Requests",
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Upgrade-Insecure-Requests",
- value: "1"
- },
- {
- name: "Accept",
- value:
- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- },
- {
- pathname: "/hero_body.php",
- type: "GET",
- names: [
- "User-Agent",
- "Accept",
- "Referer",
- "Accept-Encoding",
- "Accept-Language",
- "Cookie"
- ],
- headers: [
- {
- name: "Accept",
- value: "image/webp,image/apng,image/*,*/*;q=0.8"
- },
- {
- name: "Accept-Encoding",
- value: "gzip, deflate, br"
- }
- ]
- }
- ];
- const _Urls = [
- "https://request.urih.com/",
- "*://*.traviantactics.com/*",
- "http://localhost:8080/*",
- "*://*.google.com/recaptcha/*",
- "*://*.kingdoms.com/*",
- "https://*.travian.ae/*",
- "https://*.travian.com/*",
- "https://*.travian.asia/*",
- "https://*.travian.com.au/*",
- "https://*.travian.ba/*",
- "https://*.travian.bg/*",
- "https://*.travian.com.br/*",
- "https://*.travian.cl/*",
- "https://*.travian.cz/*",
- "https://*.travian.de/*",
- "https://*.travian.dk/*",
- "https://*.travian.com.eg/*",
- "https://*.travian.fi/*",
- "https://*.travian.fr/*",
- "https://*.travian.gr/*",
- "https://*.travian.hk/*",
- "https://*.travian.com.hr/*",
- "https://*.travian.hu/*",
- "https://*.travian.co.id/*",
- "https://*.travian.co.il/*",
- "https://*.travian.ir/*",
- "https://*.travian.it/*",
- "https://*.travian.jp/*",
- "https://*.travian.lt/*",
- "https://*.travian.com.my/*",
- "https://*.travian.net/*",
- "https://*.travian.nl/*",
- "https://*.travian.no/*",
- "https://*.travian.pl/*",
- "https://*.travian.pt/*",
- "https://*.travian.ro/*",
- "https://*.travian.rs/*",
- "https://*.travian.ru/*",
- "https://*.travian.com.sa/*",
- "https://*.travian.se/*",
- "https://*.travian.si/*",
- "https://*.travian.sk/*",
- "https://*.travian.com.tr/*",
- "https://*.travian.tw/*",
- "https://*.travian.co.uk/*",
- "https://*.travian.us/*",
- "https://*.travian.vn/*"
- ];
- const HEADERS_TO_STRIP_LOWERCASE = [
- "content-security-policy",
- "x-frame-options"
- ];
- class Domain {
- constructor(host, tabId) {
- this.host = host;
- this.time = new Date().getTime();
- this.tabId = tabId;
- this.users = [];
- this.requests = [];
- requests.forEach(request => {
- this.requests.push(
- new Request(
- request.pathname,
- request.type,
- request.headers,
- request.names
- )
- );
- });
- this.referer = "https://" + host + "/dorf1.php";
- }
- addRequest(pathname, type, headers, bot) {
- let request = this.requests.find(
- h => h.pathname === pathname && h.type === type
- );
- if (request === undefined && bot === true) {
- request = this.requests.find(h => h.type === type);
- }
- if (request === undefined) {
- if (bot) {
- console.log("request from bot is unknown", pathname, type);
- }
- this.requests.push(new Request(pathname, type, headers));
- } else {
- request.checkHeaders(headers, bot);
- }
- }
- getPassword(name) {
- return this.users.find(u => u.name === name);
- }
- setPassword(name, password) {
- let user = this.users.find(u => u.name === name);
- if (user === undefined) {
- this.users.push(new User(name, password));
- } else {
- user.password = password;
- }
- }
- }
- class User {
- constructor(name, password) {
- this.name = name;
- this.password = password;
- }
- }
- class Request {
- constructor(pathname, type, headers, names) {
- this.pathname = pathname;
- this.type = type;
- if (names === undefined) {
- this.names = [];
- this.headers = [];
- headers.forEach(element => {
- this.names.push(element.name);
- if (
- [
- "Accept",
- "Accept-Encoding",
- "Content-Type",
- "Upgrade-Insecure-Requests"
- ].some(r => r === element.name)
- ) {
- this.headers.push(element);
- }
- });
- } else {
- this.headers = headers;
- this.names = names;
- }
- }
- checkHeaders(headersRequest, bot) {
- headersRequest.forEach(element => {
- if (this.names.find(n => n === element.name) === undefined) {
- console.log("new header: ", element, this);
- }
- });
- this.headers.forEach(element => {
- let header = headersRequest.find(h => h.name === element.name);
- if (header === undefined) {
- if (!bot) {
- console.log("unknown header", element);
- }
- headersRequest.push(element);
- } else {
- if (header.value !== element.value) {
- if (!bot) {
- console.log("value changed", header, element);
- }
- header.value = element.value;
- }
- }
- });
- }
- }
- function randomXToY(x, y) {
- return Math.round(Math.random() * (y - x)) + x;
- }
- function sendRequest(req, sendResponse) {
- let origin=req.url.split("/")[2];
- let timenow=new Date().getTime()
- //console.log(new Date(timenow),new Date(timelastrequest[origin]),timelastrequest,timenow-timelastrequest[origin],mintimebetweenreq)
- if(timelastrequest[origin])
- {
- //console.log("timelastrequest[origin]",timelastrequest[origin])
- if(timenow-timelastrequest[origin]<mintimebetweenreq)
- {
- let mintime=mintimebetweenreq-(timenow-timelastrequest[origin])
- let maxtime=maxtimeinterval-(timenow-timelastrequest[origin])
- let movetime=randomXToY(mintime, maxtime)
- console.log("Request timeouted for",movetime,"ms")
- setTimeout(function(){
- sendRequest(req, sendResponse)
- },movetime)
- return
- }
- }
- let xhr = new XMLHttpRequest();
- xhr.open(req.type, req.url, true);
- xhr.timeout = req.timeout;
- xhr.setRequestHeader("request", "true");
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- sendResponse({
- document: xhr.responseText,
- request: req,
- responseURL: xhr.responseURL,
- timeout: false
- });
- }
- };
- xhr.ontimeout = function(e) {
- sendResponse({
- document: "",
- request: req,
- responseURL: req.url,
- timeout: true
- });
- };
- xhr.send(req.data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement