SHOW:
|
|
- or go back to the newest paste.
1 | <!-- simple bing dorker wroten in js by MatriX Coder !--> | |
2 | <html> | |
3 | <head> | |
4 | <title>Bing Grabber :D</title> | |
5 | </head> | |
6 | <body> | |
7 | <div align="center"> | |
8 | <form id="root" method="POST"> | |
9 | Dork > <input type="text" name="dork" size="32" style="border: 1px dotted #FF0000;width : 600"> | |
10 | Pages : <select name="nbpages"> | |
11 | <option value="50">50</option> | |
12 | <option value="100">100</option> | |
13 | <option value="150">150</option> | |
14 | <option value="200">200</option> | |
15 | </select> | |
16 | <input type="button" onclick="run(dork.value, nbpages.value)" value="Go!"> | |
17 | </form> | |
18 | <textarea rows="10", cols="50" id="out" style="border: 1px dotted #FF0000; width: 964px; height: 343px;" size="32"></textarea> | |
19 | ||
20 | </div> | |
21 | <script type="text/javascript"> | |
22 | function getHtml(url) { | |
23 | var req = new XMLHttpRequest; | |
24 | req.open('GET', url, false); | |
25 | // fixed when installed cors on chrome | |
26 | //req.setRequestHeader("Access-Control-Allow-Origin", "*://*/*"); | |
27 | req.send(null); | |
28 | return req.responseText; | |
29 | ||
30 | } ; | |
31 | ||
32 | function parseHtml(html) { | |
33 | // not the best solution but it's ok http://stackoverflow.com/questions/27581593/javascript-regex-match-url | |
34 | links = html.match(/<h2><a href="(.*?)"/g); | |
35 | var result = links.map(function (link) { | |
36 | return /<h2><a href="(.*?)"/g.exec(link)[1]; | |
37 | }); | |
38 | return result ; | |
39 | }; | |
40 | ||
41 | function run(dork, nbpages){ | |
42 | for (var i = 1 ; i < nbpages ; i += 50) { | |
43 | dork = dork.split(" ").join("+"); | |
44 | var bing = 'http://www.bing.com/search?q='+dork+'&count=50&first='+i.toString(); | |
45 | var html = getHtml(bing); | |
46 | var sites = parseHtml(html); | |
47 | sites.forEach(function (site) { | |
48 | document.getElementById('out').value += site + '\n'; | |
49 | }); | |
50 | }; | |
51 | }; | |
52 | ||
53 | </script> | |
54 | </body> | |
55 | </html> |