Advertisement
Guest User

Untitled

a guest
May 4th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.67 KB | None | 0 0
  1. const requests = [
  2. {
  3. pathname: "/dorf1.php",
  4. type: "GET",
  5. names: [
  6. "Upgrade-Insecure-Requests",
  7. "User-Agent",
  8. "Accept",
  9. "Referer",
  10. "Accept-Encoding",
  11. "Accept-Language",
  12. "Cookie"
  13. ],
  14. headers: [
  15. {
  16. name: "Upgrade-Insecure-Requests",
  17. value: "1"
  18. },
  19. {
  20. name: "Accept",
  21. value:
  22. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  23. },
  24. {
  25. name: "Accept-Encoding",
  26. value: "gzip, deflate, br"
  27. }
  28. ]
  29. },
  30. {
  31. pathname: "/statistiken.php",
  32. type: "GET",
  33. names: [
  34. "Upgrade-Insecure-Requests",
  35. "User-Agent",
  36. "Accept",
  37. "Referer",
  38. "Accept-Encoding",
  39. "Accept-Language",
  40. "Cookie"
  41. ],
  42. headers: [
  43. {
  44. name: "Upgrade-Insecure-Requests",
  45. value: "1"
  46. },
  47. {
  48. name: "Accept",
  49. value:
  50. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  51. },
  52. {
  53. name: "Accept-Encoding",
  54. value: "gzip, deflate, br"
  55. }
  56. ]
  57. },
  58. {
  59. pathname: "/karte.php",
  60. type: "GET",
  61. names: [
  62. "Upgrade-Insecure-Requests",
  63. "User-Agent",
  64. "Accept",
  65. "Referer",
  66. "Accept-Encoding",
  67. "Accept-Language",
  68. "Cookie"
  69. ],
  70. headers: [
  71. {
  72. name: "Upgrade-Insecure-Requests",
  73. value: "1"
  74. },
  75. {
  76. name: "Accept",
  77. value:
  78. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  79. },
  80. {
  81. name: "Accept-Encoding",
  82. value: "gzip, deflate, br"
  83. }
  84. ]
  85. },
  86. {
  87. pathname: "/minimap.php",
  88. type: "GET",
  89. names: [
  90. "User-Agent",
  91. "Accept",
  92. "Referer",
  93. "Accept-Encoding",
  94. "Accept-Language",
  95. "Cookie"
  96. ],
  97. headers: [
  98. {
  99. name: "Accept",
  100. value: "image/webp,image/apng,image/*,*/*;q=0.8"
  101. },
  102. {
  103. name: "Accept-Encoding",
  104. value: "gzip, deflate, br"
  105. }
  106. ]
  107. },
  108. {
  109. pathname: "/map_block.php",
  110. type: "GET",
  111. names: [
  112. "User-Agent",
  113. "Accept",
  114. "Referer",
  115. "Accept-Encoding",
  116. "Accept-Language",
  117. "Cookie"
  118. ],
  119. headers: [
  120. {
  121. name: "Accept",
  122. value: "image/webp,image/apng,image/*,*/*;q=0.8"
  123. },
  124. {
  125. name: "Accept-Encoding",
  126. value: "gzip, deflate, br"
  127. }
  128. ]
  129. },
  130. {
  131. pathname: "/map_mark.php",
  132. type: "GET",
  133. names: [
  134. "User-Agent",
  135. "Accept",
  136. "Referer",
  137. "Accept-Encoding",
  138. "Accept-Language",
  139. "Cookie"
  140. ],
  141. headers: [
  142. {
  143. name: "Accept",
  144. value: "image/webp,image/apng,image/*,*/*;q=0.8"
  145. },
  146. {
  147. name: "Accept-Encoding",
  148. value: "gzip, deflate, br"
  149. }
  150. ]
  151. },
  152. {
  153. pathname: "/dorf2.php",
  154. type: "GET",
  155. names: [
  156. "Upgrade-Insecure-Requests",
  157. "User-Agent",
  158. "Accept",
  159. "Referer",
  160. "Accept-Encoding",
  161. "Accept-Language",
  162. "Cookie"
  163. ],
  164. headers: [
  165. {
  166. name: "Upgrade-Insecure-Requests",
  167. value: "1"
  168. },
  169. {
  170. name: "Accept",
  171. value:
  172. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  173. },
  174. {
  175. name: "Accept-Encoding",
  176. value: "gzip, deflate, br"
  177. }
  178. ]
  179. },
  180. {
  181. pathname: "/logout.php",
  182. type: "GET",
  183. names: [
  184. "Upgrade-Insecure-Requests",
  185. "User-Agent",
  186. "Accept",
  187. "Referer",
  188. "Accept-Encoding",
  189. "Accept-Language",
  190. "Cookie"
  191. ],
  192. headers: [
  193. {
  194. name: "Upgrade-Insecure-Requests",
  195. value: "1"
  196. },
  197. {
  198. name: "Accept",
  199. value:
  200. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  201. },
  202. {
  203. name: "Accept-Encoding",
  204. value: "gzip, deflate, br"
  205. }
  206. ]
  207. },
  208. {
  209. pathname: "/dorf1.php",
  210. type: "POST",
  211. names: [
  212. "Upgrade-Insecure-Requests",
  213. "Content-Type",
  214. "User-Agent",
  215. "Accept",
  216. "Referer",
  217. "Accept-Encoding",
  218. "Accept-Language",
  219. "Cookie"
  220. ],
  221. headers: [
  222. {
  223. name: "Upgrade-Insecure-Requests",
  224. value: "1"
  225. },
  226. {
  227. name: "Content-Type",
  228. value: "application/x-www-form-urlencoded"
  229. },
  230. {
  231. name: "Accept",
  232. value:
  233. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  234. },
  235. {
  236. name: "Accept-Encoding",
  237. value: "gzip, deflate, br"
  238. }
  239. ]
  240. },
  241. {
  242. pathname: "/messages.php",
  243. type: "GET",
  244. names: [
  245. "Upgrade-Insecure-Requests",
  246. "User-Agent",
  247. "Accept",
  248. "Referer",
  249. "Accept-Encoding",
  250. "Accept-Language",
  251. "Cookie"
  252. ],
  253. headers: [
  254. {
  255. name: "Upgrade-Insecure-Requests",
  256. value: "1"
  257. },
  258. {
  259. name: "Accept",
  260. value:
  261. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  262. },
  263. {
  264. name: "Accept-Encoding",
  265. value: "gzip, deflate, br"
  266. }
  267. ]
  268. },
  269. {
  270. pathname: "/ajax.php",
  271. type: "POST",
  272. names: [
  273. "Accept",
  274. "X-Requested-With",
  275. "X-Request",
  276. "User-Agent",
  277. "Content-Type",
  278. "Referer",
  279. "Accept-Encoding",
  280. "Accept-Language",
  281. "Cookie"
  282. ],
  283. headers: [
  284. {
  285. name: "Accept",
  286. value: "application/json, text/javascript, */*; q=0.01"
  287. },
  288. {
  289. name: "Content-Type",
  290. value: "application/x-www-form-urlencoded; charset=UTF-8"
  291. },
  292. {
  293. name: "Accept-Encoding",
  294. value: "gzip, deflate, br"
  295. }
  296. ]
  297. },
  298. {
  299. pathname: "/build.php",
  300. type: "GET",
  301. names: [
  302. "Upgrade-Insecure-Requests",
  303. "User-Agent",
  304. "Accept",
  305. "Referer",
  306. "Accept-Encoding",
  307. "Accept-Language",
  308. "Cookie"
  309. ],
  310. headers: [
  311. {
  312. name: "Upgrade-Insecure-Requests",
  313. value: "1"
  314. },
  315. {
  316. name: "Accept",
  317. value:
  318. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  319. },
  320. {
  321. name: "Accept-Encoding",
  322. value: "gzip, deflate, br"
  323. }
  324. ]
  325. },
  326. {
  327. pathname: "/build.php",
  328. type: "POST",
  329. names: [
  330. "Upgrade-Insecure-Requests",
  331. "Content-Type",
  332. "User-Agent",
  333. "Accept",
  334. "Referer",
  335. "Accept-Encoding",
  336. "Accept-Language",
  337. "Cookie"
  338. ],
  339. headers: [
  340. {
  341. name: "Upgrade-Insecure-Requests",
  342. value: "1"
  343. },
  344. {
  345. name: "Content-Type",
  346. value: "application/x-www-form-urlencoded"
  347. },
  348. {
  349. name: "Accept",
  350. value:
  351. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  352. },
  353. {
  354. name: "Accept-Encoding",
  355. value: "gzip, deflate, br"
  356. }
  357. ]
  358. },
  359. {
  360. pathname: "/hero.php",
  361. type: "GET",
  362. names: [
  363. "Upgrade-Insecure-Requests",
  364. "User-Agent",
  365. "Accept",
  366. "Referer",
  367. "Accept-Encoding",
  368. "Accept-Language",
  369. "Cookie"
  370. ],
  371. headers: [
  372. {
  373. name: "Upgrade-Insecure-Requests",
  374. value: "1"
  375. },
  376. {
  377. name: "Accept",
  378. value:
  379. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  380. },
  381. {
  382. name: "Accept-Encoding",
  383. value: "gzip, deflate, br"
  384. }
  385. ]
  386. },
  387. {
  388. pathname: "/start_adventure.php",
  389. type: "GET",
  390. names: [
  391. "Upgrade-Insecure-Requests",
  392. "User-Agent",
  393. "Accept",
  394. "Referer",
  395. "Accept-Encoding",
  396. "Accept-Language",
  397. "Cookie"
  398. ],
  399. headers: [
  400. {
  401. name: "Upgrade-Insecure-Requests",
  402. value: "1"
  403. },
  404. {
  405. name: "Accept",
  406. value:
  407. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  408. },
  409. {
  410. name: "Accept-Encoding",
  411. value: "gzip, deflate, br"
  412. }
  413. ]
  414. },
  415. {
  416. pathname: "/dorf3.php",
  417. type: "GET",
  418. names: [
  419. "Upgrade-Insecure-Requests",
  420. "User-Agent",
  421. "Accept",
  422. "Referer",
  423. "Accept-Encoding",
  424. "Accept-Language",
  425. "Cookie"
  426. ],
  427. headers: [
  428. {
  429. name: "Upgrade-Insecure-Requests",
  430. value: "1"
  431. },
  432. {
  433. name: "Accept",
  434. value:
  435. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  436. },
  437. {
  438. name: "Accept-Encoding",
  439. value: "gzip, deflate, br"
  440. }
  441. ]
  442. },
  443. {
  444. pathname: "/berichte.php",
  445. type: "GET",
  446. names: [
  447. "Upgrade-Insecure-Requests",
  448. "User-Agent",
  449. "Accept",
  450. "Referer",
  451. "Accept-Encoding",
  452. "Accept-Language",
  453. "Cookie"
  454. ],
  455. headers: [
  456. {
  457. name: "Upgrade-Insecure-Requests",
  458. value: "1"
  459. },
  460. {
  461. name: "Accept",
  462. value:
  463. "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
  464. },
  465. {
  466. name: "Accept-Encoding",
  467. value: "gzip, deflate, br"
  468. }
  469. ]
  470. },
  471. {
  472. pathname: "/hero_body.php",
  473. type: "GET",
  474. names: [
  475. "User-Agent",
  476. "Accept",
  477. "Referer",
  478. "Accept-Encoding",
  479. "Accept-Language",
  480. "Cookie"
  481. ],
  482. headers: [
  483. {
  484. name: "Accept",
  485. value: "image/webp,image/apng,image/*,*/*;q=0.8"
  486. },
  487. {
  488. name: "Accept-Encoding",
  489. value: "gzip, deflate, br"
  490. }
  491. ]
  492. }
  493. ];
  494.  
  495. const _Urls = [
  496. "https://request.urih.com/",
  497. "*://*.traviantactics.com/*",
  498. "http://localhost:8080/*",
  499. "*://*.google.com/recaptcha/*",
  500. "*://*.kingdoms.com/*",
  501. "https://*.travian.ae/*",
  502. "https://*.travian.com/*",
  503. "https://*.travian.asia/*",
  504. "https://*.travian.com.au/*",
  505. "https://*.travian.ba/*",
  506. "https://*.travian.bg/*",
  507. "https://*.travian.com.br/*",
  508. "https://*.travian.cl/*",
  509. "https://*.travian.cz/*",
  510. "https://*.travian.de/*",
  511. "https://*.travian.dk/*",
  512. "https://*.travian.com.eg/*",
  513. "https://*.travian.fi/*",
  514. "https://*.travian.fr/*",
  515. "https://*.travian.gr/*",
  516. "https://*.travian.hk/*",
  517. "https://*.travian.com.hr/*",
  518. "https://*.travian.hu/*",
  519. "https://*.travian.co.id/*",
  520. "https://*.travian.co.il/*",
  521. "https://*.travian.ir/*",
  522. "https://*.travian.it/*",
  523. "https://*.travian.jp/*",
  524. "https://*.travian.lt/*",
  525. "https://*.travian.com.my/*",
  526. "https://*.travian.net/*",
  527. "https://*.travian.nl/*",
  528. "https://*.travian.no/*",
  529. "https://*.travian.pl/*",
  530. "https://*.travian.pt/*",
  531. "https://*.travian.ro/*",
  532. "https://*.travian.rs/*",
  533. "https://*.travian.ru/*",
  534. "https://*.travian.com.sa/*",
  535. "https://*.travian.se/*",
  536. "https://*.travian.si/*",
  537. "https://*.travian.sk/*",
  538. "https://*.travian.com.tr/*",
  539. "https://*.travian.tw/*",
  540. "https://*.travian.co.uk/*",
  541. "https://*.travian.us/*",
  542. "https://*.travian.vn/*"
  543. ];
  544.  
  545. const HEADERS_TO_STRIP_LOWERCASE = [
  546. "content-security-policy",
  547. "x-frame-options"
  548. ];
  549.  
  550. class Domain {
  551. constructor(host, tabId) {
  552. this.host = host;
  553. this.time = new Date().getTime();
  554. this.tabId = tabId;
  555. this.users = [];
  556. this.requests = [];
  557. requests.forEach(request => {
  558. this.requests.push(
  559. new Request(
  560. request.pathname,
  561. request.type,
  562. request.headers,
  563. request.names
  564. )
  565. );
  566. });
  567. this.referer = "https://" + host + "/dorf1.php";
  568. }
  569.  
  570. addRequest(pathname, type, headers, bot) {
  571. let request = this.requests.find(
  572. h => h.pathname === pathname && h.type === type
  573. );
  574. if (request === undefined && bot === true) {
  575. request = this.requests.find(h => h.type === type);
  576. }
  577.  
  578. if (request === undefined) {
  579. if (bot) {
  580. console.log("request from bot is unknown", pathname, type);
  581. }
  582. this.requests.push(new Request(pathname, type, headers));
  583. } else {
  584. request.checkHeaders(headers, bot);
  585. }
  586. }
  587. getPassword(name) {
  588. return this.users.find(u => u.name === name);
  589. }
  590. setPassword(name, password) {
  591. let user = this.users.find(u => u.name === name);
  592. if (user === undefined) {
  593. this.users.push(new User(name, password));
  594. } else {
  595. user.password = password;
  596. }
  597. }
  598. }
  599.  
  600. class User {
  601. constructor(name, password) {
  602. this.name = name;
  603. this.password = password;
  604. }
  605. }
  606.  
  607. class Request {
  608. constructor(pathname, type, headers, names) {
  609. this.pathname = pathname;
  610. this.type = type;
  611. if (names === undefined) {
  612. this.names = [];
  613. this.headers = [];
  614. headers.forEach(element => {
  615. this.names.push(element.name);
  616. if (
  617. [
  618. "Accept",
  619. "Accept-Encoding",
  620. "Content-Type",
  621. "Upgrade-Insecure-Requests"
  622. ].some(r => r === element.name)
  623. ) {
  624. this.headers.push(element);
  625. }
  626. });
  627. } else {
  628. this.headers = headers;
  629. this.names = names;
  630. }
  631. }
  632. checkHeaders(headersRequest, bot) {
  633. headersRequest.forEach(element => {
  634. if (this.names.find(n => n === element.name) === undefined) {
  635. console.log("new header: ", element, this);
  636. }
  637. });
  638.  
  639. this.headers.forEach(element => {
  640. let header = headersRequest.find(h => h.name === element.name);
  641. if (header === undefined) {
  642. if (!bot) {
  643. console.log("unknown header", element);
  644. }
  645. headersRequest.push(element);
  646. } else {
  647. if (header.value !== element.value) {
  648. if (!bot) {
  649. console.log("value changed", header, element);
  650. }
  651. header.value = element.value;
  652. }
  653. }
  654. });
  655. }
  656. }
  657.  
  658. function randomXToY(x, y) {
  659. return Math.round(Math.random() * (y - x)) + x;
  660. }
  661.  
  662. function sendRequest(req, sendResponse) {
  663. let origin=req.url.split("/")[2];
  664. let timenow=new Date().getTime()
  665. //console.log(new Date(timenow),new Date(timelastrequest[origin]),timelastrequest,timenow-timelastrequest[origin],mintimebetweenreq)
  666. if(timelastrequest[origin])
  667. {
  668. //console.log("timelastrequest[origin]",timelastrequest[origin])
  669. if(timenow-timelastrequest[origin]<mintimebetweenreq)
  670. {
  671.  
  672. let mintime=mintimebetweenreq-(timenow-timelastrequest[origin])
  673. let maxtime=maxtimeinterval-(timenow-timelastrequest[origin])
  674. let movetime=randomXToY(mintime, maxtime)
  675. console.log("Request timeouted for",movetime,"ms")
  676. setTimeout(function(){
  677. sendRequest(req, sendResponse)
  678. },movetime)
  679. return
  680. }
  681. }
  682. let xhr = new XMLHttpRequest();
  683. xhr.open(req.type, req.url, true);
  684. xhr.timeout = req.timeout;
  685. xhr.setRequestHeader("request", "true");
  686.  
  687. xhr.onreadystatechange = function() {
  688. if (xhr.readyState == 4) {
  689. sendResponse({
  690. document: xhr.responseText,
  691. request: req,
  692. responseURL: xhr.responseURL,
  693. timeout: false
  694. });
  695. }
  696. };
  697. xhr.ontimeout = function(e) {
  698. sendResponse({
  699. document: "",
  700. request: req,
  701. responseURL: req.url,
  702. timeout: true
  703. });
  704. };
  705. xhr.send(req.data);
  706. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement