Advertisement
Guest User

Untitled

a guest
Nov 8th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. var random_useragent = require('random-useragent');
  2. var http = require('http');
  3. var net = require('net');
  4. var url = require('url');
  5. var sys = require('sys');
  6. var qs = require('querystring');
  7. var Faker = require('Faker');
  8. var request = require("request");
  9.  
  10. var emailExtensionValue = ['@wanadoo.fr', '@gmail.com', '@hotmail.com', '@hotmail.fr', '@free.fr', '@alice.fr', '@orange.fr']
  11. var profilVar = ['Start-up', 'Etudiant', 'Journaliste', 'Influenceur', 'Pouvoirs publics']
  12.  
  13. var randomData = {
  14. emailExtensionValue: ['@wanadoo.fr', '@gmail.com', '@hotmail.com', '@hotmail.fr', '@free.fr', '@alice.fr', '@orange.fr'],
  15. firstName: Faker.Name.firstName(),
  16. lastName: Faker.Name.lastName(),
  17. sufixe: Faker.random.number(999),
  18. randomMail: getRandomElement(emailExtensionValue),
  19. profilVar: ['Start-up', 'Etudiant', 'Journaliste', 'Influenceur', 'Pouvoirs publics'],
  20. Profil: getRandomElement(profilVar),
  21. thePassword: Faker.random.number(1111111111, 9999999999) + Faker.Name.firstName() + "'",
  22. Useragent: random_useragent.getRandom()
  23. }
  24.  
  25. function getRandomElement(arr) {
  26. return arr[Math.round(Math.random() * (arr.length - 1))]
  27. }
  28.  
  29.  
  30. var data = qs.stringify({
  31. 'first_name-38484': randomData.firstName,
  32. 'last_name-38484': randomData.lastName,
  33. 'user_login-38484': randomData.firstName + randomData.lastName + randomData.sufixe,
  34. 'user_email-38484': randomData.firstName + randomData.lastName + randomData.sufixe + randomData.randomMail,
  35. 'user_password-38484': randomData.thePassword,
  36. 'country': 'France',
  37. 'profile-type': randomData.thePassword,
  38. 'complment-profil-38484': '',
  39. 'titre-38484': '',
  40. 'services': '',
  41. 'public-adress': '',
  42. 'form_id': '38484',
  43. 'timestamp': '1446834025',
  44. 'request': '',
  45. 'role': 'member'
  46. });
  47. var data1 = {
  48. 'action': 'wti_like_post_process_vote',
  49. 'task': 'like',
  50. 'post_id': '6190',
  51. 'nonce': '6517d2ea5f'
  52. };
  53. var arrayCookieUser = []
  54. var lol = []
  55. var options = {
  56. host: 'bonjouridee.com',
  57. port: 80,
  58. path: '/inscription',
  59. method: 'POST',
  60. headers: {
  61. 'Content-Type': 'application/x-www-form-urlencoded',
  62. 'Content-Length': Buffer.byteLength(data),
  63. 'Cookie': 'ct_cookies_test=3f8a7f992813b9f13a29ea2f6a630cc2; ct_timestamp=1446835025; ct_checkjs=1967102595; cookie_notice_accepted=true;'
  64. }
  65. };
  66.  
  67. var req = http.request(options, function(res) {
  68. console.log(options)
  69. res.setEncoding('utf8');
  70. res.on('data', function(chunk) {
  71. console.log("body: " + chunk);
  72. });
  73. var setcookie = res.headers["set-cookie"];
  74. if (setcookie) {
  75. setcookie.forEach(
  76. function(cookiestr) {
  77. var cookieSale = cookiestr.split("path=/") + "";
  78. var cookiePropre = cookieSale.replace(/,/g, "");
  79. lol.push(cookiePropre);
  80. }
  81. );
  82. }
  83. var options1 = {
  84. host: 'bonjouridee.com',
  85. port: 80,
  86. path: '/wp-admin/admin-ajax.php',
  87. method: 'POST',
  88. headers: {
  89. 'Content-Type': 'application/x-www-form-urlencoded',
  90. 'Content-Length': Buffer.byteLength(data1),
  91. 'Accept': 'application/json, text/javascript, */*; q=0.01',
  92. 'Cookie': (lol + "; ").replace(",wo", "wo").replace("wp-content/plugins; httponly,w", "w").replace("wp-admin; httponly,w", "w").replace("; httponly;", ""), // + 'ct_cookies_test=3f8a7f992813b9f13a29ea2f6a630cc2; ct_checkjs=1967102595; ct_timestamp=1446835025; cookie_notice_accepted=true;'
  93. }
  94. };
  95.  
  96. var options2 = {
  97. host: 'bonjouridee.com',
  98. port: 80,
  99. path: '/payname-2/',
  100. method: 'GET',
  101. headers: {
  102. 'Content-Type': 'application/x-www-form-urlencoded',
  103. 'Content-Length': Buffer.byteLength(data1),
  104. 'Accept': 'application/json, text/javascript, */*; q=0.01',
  105. 'Cookie': (lol + "; ").replace(",wo", "wo").replace("wp-content/plugins; httponly,w", "w").replace("wp-admin; httponly,w", "w").replace("; httponly;", ""), // + 'ct_cookies_test=3f8a7f992813b9f13a29ea2f6a630cc2; ct_checkjs=1967102595; ct_timestamp=1446835025; cookie_notice_accepted=true;'
  106. }
  107. };
  108. var req2 = http.request(options1, function(res) {
  109. res.setEncoding('utf8');
  110. console.log(options1)
  111. res.on('data', function(chunk) {
  112. console.log("bodyreq2: ");
  113. console.log(chunk);
  114. });
  115. });
  116. var req1 = http.request(options2, function(res) {
  117. res.setEncoding('utf8');
  118. res.on('data', function(chunk) {
  119. var c = ("body: " + chunk);
  120. var d = new RegExp(/("nonce":")[0-9a-z]*/);
  121. var e = c.match(d)
  122. if(e!== null) {
  123. console.log(e[0]);
  124. var f = e[0].substring(9, e[0].length)
  125. console.log(f);
  126. data1.nonce = f;
  127.  
  128. console.log('************');
  129. console.log(qs.stringify(data1));
  130. console.log('************');
  131.  
  132. req2.write(qs.stringify(data1));
  133. req2.end();
  134. }
  135.  
  136. });
  137. // req.end
  138.  
  139. });
  140. req1.write(qs.stringify(data1));
  141. });
  142. req.write(data);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement