Foro de elhacker.net

Seguridad Informática => Hacking => Mensaje iniciado por: @XSStringManolo en 13 Febrero 2021, 01:09 am



Título: [Aporte]Herramienta que realiza busquedas avanzadas(dorks) sobre un objetivo.
Publicado por: @XSStringManolo en 13 Febrero 2021, 01:09 am
Os traigo esta herramienta sencilla para buscar información en google.

Google puede detectar vuestra actividad como robots y no responder. En redes de casa suele funcionar.

Instalar:
  Necesitais tener quickjs y lynx instalados. Ocupan muy poco.
  Guardais el código como dorks.js y lo ejecutais con qjs dorks.js -t https://example.com -s

Está testeado que funciona en Linux y Termux.
No lo probé en windows pero es probable que también funcione.

Cita de: uso
usage: qjs dorks [options]
  -b  --backup-files         .bkf, .bkp, .bak, .old, .backup 
 
  -c  --config-files         .xml, .conf, .cnf, .reg, .inf, .rdp, .cfg, .txt, .ora, .ini, .env 
 
  -d  --directory-listing    index of dir list 
 
  -e  --exposed-databases    .sql, .dbf, .mdb 
 
  -g  --git                  github.com, gitlab.com 
 
  -h  --help                this message
 
  -l  --log                  .log 
 
  -L  --login-urls           login in url 
 
  -n  --number               phone numbers 
 
  -p  --public-documents     .doc, .docx, .odt, .rtf, .sxw, .psw, .ppt, .pptx, .pps, .csv 
 
  -P  --php-errors           .php errors in document 
 
      --pastes               pastebin.com, paste2.org, pastehtml.com, slexy.org, snipplr.com, snipt.net, textsnip.com, bitpaste.app, justpaste.it, heypasteit.com, hastebin.com, dpaste.org, dpaste.com, codepad.org, jsitor.com, codepen.io, jsfiddle.net, dotnetfiddle.net, phpfiddle.org, ide.geeksforgeeks.org, repl.it, ideone.com, paste.debian.net, paste.org, paste.org.ru, codebeautify.org, codeshare.io, trello.com 
 
      --php-info             .php info files 
 
  -s  --source               source code of target 
 
  -S  --sql-errors           sql syntax errors in document 
 
      --stackoverflow        stackoverflow.com 
 
  -t  --target               Your target. Can be a domain, a full url, etc. Based on the arguments of your chose. 
 
  -v  --view                 text representation of the target.

Código
  1. import * as std from "std";
  2. import * as os from "os";
  3.  
  4. let run = command => {
  5.  let p = std.popen(command, "r"),
  6.  msg = "",
  7.  r = "";
  8.  while(( r = p.getline() ) != null) {
  9.    msg += r + "\n";
  10.  }
  11.  return msg;
  12. }                                                                                                                            
  13.  
  14. let cli = {};
  15. cli.COLORS = {                                                    
  16.  RED: "\x1b[31m",
  17.  RESET: "\x1b[0m",
  18.  YELLOW:"\x1b[33m",
  19.  BLUE: "\x1b[34m",
  20.  GREEN: "\x1b[32m"                                            
  21. };
  22.  
  23. for (let i in scriptArgs) {
  24. switch(scriptArgs[i]) {
  25.    case "-b":                                                      
  26.    case "--backup-files":
  27.      cli.backupFiles = true;
  28.    break;
  29.  
  30.    case "-c":
  31.    case "--config-files":                                            
  32.      cli.configFiles = true;
  33.    break;
  34.  
  35.    case "-d":
  36.    case "--directory-listing":
  37.      cli.directoryListing = true;
  38.    break;
  39.  
  40.    case "-e":
  41.    case "--exposed-databases":
  42.      cli.exposedDatabases = true;
  43.    break;
  44.  
  45.    case "-g":
  46.    case "--git":
  47.      cli.git = true;
  48.    break;
  49.  
  50.    case "-l":
  51.    case "--log":
  52.      cli.logFiles = true;
  53.    break;
  54.  
  55.    case "-L":
  56.    case "--login-urls":
  57.      cli.loginUrls = true;
  58.    break;
  59.  
  60.    case "-p":
  61.    case "--public-documents":
  62.      cli.publicDocuments = true;
  63.    break;
  64.  
  65.    case "-P":
  66.    case "--php-errors":
  67.      cli.phpErrors = true;
  68.    break;
  69.  
  70.    case "--php-info":
  71.      cli.phpInfo = true;
  72.    break;
  73.  
  74.    case "--pastes":
  75.      cli.pastes = true;
  76.    break;
  77.  
  78.    case "-s":
  79.    case "--source":
  80.      cli.source = true;
  81.    break;
  82.  
  83.    case "-S":
  84.    case "--sql-errors":
  85.      cli.sqlErrors = true;
  86.    break;
  87.  
  88.    case "--stackoverflow":
  89.      cli.stackoverflow = true;
  90.    break;
  91.  
  92.    case "-t":
  93.    case "--target":
  94.      cli.target = encodeURIComponent(scriptArgs[+i + +1]);
  95.    break;
  96.  
  97.    case "-v":
  98.    case "--view":
  99.      cli.view = true;
  100.    break;
  101.  
  102.    case "-h":
  103.    case "--help":
  104.      console.log(`
  105.  
  106. usage: qjs dorks [options]
  107.  -b  --backup-files         .bkf, .bkp, .bak, .old, .backup
  108.  
  109.  -c  --config-files         .xml, .conf, .cnf, .reg, .inf, .rdp, .cfg, .txt, .ora, .ini, .env
  110.  
  111.  -d  --directory-listing    index of dir list
  112.  
  113.  -e  --exposed-databases    .sql, .dbf, .mdb
  114.  
  115.  -g  --git                  github.com, gitlab.com
  116.  
  117.  -h  --help                 this message
  118.  
  119.  -l  --log                  .log
  120.  
  121.  -L  --login-urls           login in url
  122.  
  123.  -p  --public-documents     .doc, .docx, .odt, .rtf, .sxw, .psw, .ppt, .pptx, .pps, .csv
  124.  
  125.  -P  --php-errors           .php errors in document
  126.  
  127.      --pastes               pastebin.com, paste2.org, pastehtml.com, slexy.org, snipplr.com, snipt.net, textsnip.com, bitpaste.app, justpaste.it, heypasteit.com, hastebin.com, dpaste.org, dpaste.com, codepad.org, jsitor.com, codepen.io, jsfiddle.net, dotnetfiddle.net, phpfiddle.org, ide.geeksforgeeks.org, repl.it, ideone.com, paste.debian.net, paste.org, paste.org.ru, codebeautify.org, codeshare.io, trello.com
  128.  
  129.      --php-info             .php info files
  130.  
  131.  -s  --source               source code of target
  132.  
  133.  -S  --sql-errors           sql syntax errors in document
  134.  
  135.      --stackoverflow        stackoverflow.com
  136.  
  137.  -t  --target               Your target. Can be a domain, a full url, etc. Based on the arguments of your chose.
  138.  
  139.  -v  --view                 text representation of the target.
  140.  
  141.  
  142. `);
  143.  std.exit(0);
  144.  }
  145. }
  146.  
  147. let checkResults = res => {
  148.  /* Check if connection error */
  149.  
  150.  /* Check if captcha */
  151.    /* Use good proxy chain list to evade captcha */
  152.    /* Instruct user to evade if dynamic ip */
  153.  
  154.  /* Check if not found */
  155.  if (new RegExp("ningún resultado. Sugerencias: ", "gim").test(res.replace(/\n/gm, " "))) {
  156.    throw `${cli.COLORS.GREEN}Everything fine but nothing found.${cli.COLORS.RESET}`
  157.  } else {
  158.    console.log(res);
  159.  }
  160.  
  161.  /* check if more than one page of results */
  162. }
  163.  
  164. if (!cli.target) {
  165.  throw `Missing target.
  166.  write ${cli.COLORS.RED}qjs dorks --help${cli.COLORS.RESET} to show usage.
  167.  `;
  168. }
  169.  
  170. if (cli.backupFiles) {
  171.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:bkf+|+ext:bkp+|+ext:bak+|+ext:old+|+ext:backup'`));
  172. }
  173.  
  174. else if (cli.configFiles) {
  175.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:xml+|+ext:conf+|+ext:cnf+|+ext:reg+|+ext:inf+|+ext:rdp+|+ext:cfg+|+ext:txt+|+ext:ora+|+ext:ini+|+ext:env'`));
  176. }
  177.  
  178. else if (cli.directoryListing) {
  179.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+intitle:index.of'`));
  180. } else if (cli.exposedDatabases) {
  181.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:sql+|+ext:dbf+|+ext:mdb'`));
  182. }
  183.  
  184. else if (cli.exposedDatabases) {
  185.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+intext:'"'"'sql syntax near'"'"'+|+intext:'"'"'syntax error has occurred'"'"'+|+intext:'"'"'incorrect syntax near'"'"'+|+intext:'"'"'unexpected end of SQL command'"'"'+|+intext:'"'"'Warning: mysql_connect()'"'"'+|+intext:'"'"'Warning: mysql_query()'"'"'+|+intext:'"'"'Warning: pg_connect()'"'"''`));
  186. }
  187.  
  188. else if (cli.git) {
  189.  checkResults(run(`lynx --dump 'https://www.google.com/search?q="${cli.target}"+site:github.com+|+site:gitlab.com'`));
  190. }
  191.  
  192. else if (cli.logFiles) {
  193.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:log'`));
  194. }
  195.  
  196. else if (cli.loginUrls) {
  197.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+inurl:login+|+inurl:ingresar'`));
  198. }
  199.  
  200. else if (cli.publicDocuments) {
  201.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:doc+|+ext:docx+|+ext:odt+|+ext:rtf+|+ext:sxw+|+ext:psw+|+ext:ppt+|+ext:pptx+|+ext:pps+|+ext:csv'`));
  202. }
  203.  
  204. else if (cli.pastes) {
  205.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=${cli.target}+site:pastebin.com+|+site:paste2.org+|+site:pastehtml.com+|+site:slexy.org+|+site:snipplr.com+|+site:snipt.net+|+site:textsnip.com+|+site:bitpaste.app+|+site:justpaste.it+|+site:heypasteit.com+|+site:hastebin.com+|+site:dpaste.org+|+site:dpaste.com+|+site:codepad.org+|+site:jsitor.com+|+site:codepen.io+|+site:jsfiddle.net+|+site:dotnetfiddle.net+|+site:phpfiddle.org+|+site:ide.geeksforgeeks.org+|+site:repl.it+|+site:ideone.com+|+site:paste.debian.net+|+site:paste.org+|+site:paste.org.ru+|+site:codebeautify.org +|+site:codeshare.io+|+site:trello.com'`));
  206. }
  207.  
  208. else if (cli.phpErrors) {
  209.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+'"'"'PHP Parse error'"'"'+|+'"'"'PHP Warning'"'"'+|+'"'"'PHP Error'"'"''`));
  210. }
  211.  
  212. else if (cli.phpInfo) {
  213.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+ext:php+intitle:phpinfo+'"'"'published by the PHP Group'"'"''`));
  214. }
  215.  
  216. else if (cli.source) {
  217.  console.log(run(`lynx --source ${decodeURIComponent(cli.target)}`));
  218. }
  219.  
  220. else if (cli.sqlErrors) {
  221.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=site:${cli.target}+intext:'"'"'sql syntax near'"'"'+|+intext:'"'"'syntax error has occurred'"'"'+|+intext:'"'"'incorrect syntax near'"'"'+|+intext:'"'"'unexpected end of SQL command'"'"'+|+intext:'"'"'Warning: mysql_connect()'"'"'+|+intext:'"'"'Warning: mysql_query()'"'"'+|+intext:'"'"'Warning: pg_connect()'"'"''`));
  222. }
  223.  
  224. else if (cli.stackoverflow) {
  225.  checkResults(run(`lynx --dump 'https://www.google.com/search?q=${cli.target}+site:stackoverflow.com'`));
  226. }
  227.  
  228. else if (cli.view) {
  229.  console.log(run(`lynx --dump '${decodeURIComponent(cli.target)}'`));
  230. }
  231.  
  232. else {
  233.  throw `Missing argument. You need at least 1 argument more.
  234.  write ${cli.COLORS.RED}qjs dorks --help${cli.COLORS.RESET} to show usage.
  235.  
  236.  `;
  237. }

Podeis añadirle vuestros dorks al código siguiente el patrón.