Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c6c870

Browse files
committed
removed some problematic user agents (google won't work with them) and added page rank next to tested item in multi target mode
1 parent 6651ba0 commit 5c6c870

4 files changed

Lines changed: 103 additions & 12 deletions

File tree

extra/pagerank/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
#
3+
# The MIT License
4+
#
5+
# Copyright 2010 Corey Goldberg
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in
15+
# all copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
# THE SOFTWARE.
24+
#
25+
26+
pass

extra/pagerank/pagerank.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env python
2+
#
3+
# Script for getting Google Page Rank of page
4+
# Google Toolbar 3.0.x/4.0.x Pagerank Checksum Algorithm
5+
#
6+
# original from http://pagerank.gamesaga.net/
7+
# this version was adapted from http://www.djangosnippets.org/snippets/221/
8+
# by Corey Goldberg - 2010
9+
#
10+
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
11+
12+
import urllib
13+
14+
def get_pagerank(url):
15+
hsh = check_hash(hash_url(url))
16+
gurl = 'http://www.google.com/search?client=navclient-auto&features=Rank:&q=info:%s&ch=%s' % (urllib.quote(url), hsh)
17+
try:
18+
f = urllib.urlopen(gurl)
19+
rank = f.read().strip()[9:]
20+
except Exception:
21+
rank = 'N/A'
22+
if rank == '':
23+
rank = '0'
24+
return rank
25+
26+
def int_str(string, integer, factor):
27+
for i in range(len(string)) :
28+
integer *= factor
29+
integer &= 0xFFFFFFFF
30+
integer += ord(string[i])
31+
return integer
32+
33+
def hash_url(string):
34+
c1 = int_str(string, 0x1505, 0x21)
35+
c2 = int_str(string, 0, 0x1003F)
36+
37+
c1 >>= 2
38+
c1 = ((c1 >> 4) & 0x3FFFFC0) | (c1 & 0x3F)
39+
c1 = ((c1 >> 4) & 0x3FFC00) | (c1 & 0x3FF)
40+
c1 = ((c1 >> 4) & 0x3C000) | (c1 & 0x3FFF)
41+
42+
t1 = (c1 & 0x3C0) << 4
43+
t1 |= c1 & 0x3C
44+
t1 = (t1 << 2) | (c2 & 0xF0F)
45+
46+
t2 = (c1 & 0xFFFFC000) << 4
47+
t2 |= c1 & 0x3C00
48+
t2 = (t2 << 0xA) | (c2 & 0xF0F0000)
49+
50+
return (t1 | t2)
51+
52+
def check_hash(hash_int):
53+
hash_str = '%u' % (hash_int)
54+
flag = 0
55+
check_byte = 0
56+
57+
i = len(hash_str) - 1
58+
while i >= 0:
59+
byte = int(hash_str[i])
60+
if 1 == (flag % 2):
61+
byte *= 2;
62+
byte = byte / 10 + byte % 10
63+
check_byte += byte
64+
flag += 1
65+
i -= 1
66+
67+
check_byte %= 10
68+
if 0 != check_byte:
69+
check_byte = 10 - check_byte
70+
if 1 == flag % 2:
71+
if 1 == check_byte % 2:
72+
check_byte += 9
73+
check_byte >>= 1
74+
75+
return '7' + str(check_byte) + hash_str

lib/controller/controller.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from lib.core.session import setInjection
3939
from lib.core.target import initTargetEnv
4040
from lib.core.target import setupTargetEnv
41+
from extra.pagerank.pagerank import get_pagerank
4142

4243
def __selectInjection():
4344
"""
@@ -193,7 +194,7 @@ def start():
193194
if conf.forms:
194195
message = "[#%d] form:\n%s %s" % (hostCount, conf.method or HTTPMETHOD.GET, targetUrl)
195196
else:
196-
message = "%s %d:\n%s %s" % ("url", hostCount, conf.method or HTTPMETHOD.GET, targetUrl)
197+
message = "%s %d:\n%s %s (PR: %s)" % ("url", hostCount, conf.method or HTTPMETHOD.GET, targetUrl, get_pagerank(targetUrl))
197198

198199
if conf.cookie:
199200
message += "\nCookie: %s" % conf.cookie

txt/user-agents.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com)
55
Baiduspider ( http://www.baidu.com/search/spider.htm)
6-
curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7b zlib/1.2.2
76
GameSpyHTTP/1.0
87
Gigabot/2.0
98
Googlebot-Image/1.0
@@ -28,11 +27,8 @@ Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)
2827
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220)
2928
Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 240x320)
3029
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
31-
Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 6.0 [en]
3230
Mozilla/4.0 (compatible; MSIE 5.0; SunOS 5.9 sun4u; X11)
3331
Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.03 [en]
34-
Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC)
35-
Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
3632
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
3733
Mozilla/4.0 (compatible; MSIE 6.0; ; Linux armv5tejl; U) Opera 8.02 [en_US] Maemo browser 0.4.31 N770/SU-18
3834
Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.1; Windows NT 5.1;)
@@ -44,17 +40,10 @@ Mozilla/4.0 (compatible; MSIE 6.0; Nitro) Opera 8.50 [ja]
4440
Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; Nokia 6630/4.03.38; 6937) Opera 8.50 [es]
4541
Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile m.n) where
4642
Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; Motorola VIP12xx)
47-
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser [avantbrowser.com]; iOpus-I-M; QXW03416; .NET CLR 1.1.4322)
4843
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50
4944
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
50-
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727)
51-
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
52-
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215) Netscape/8.0.1
5345
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
5446
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2)
55-
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
56-
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; Arcor 5.005; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
57-
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.0.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
5847
Mozilla/4.0 (compatible; MSIE 7.0b; Win32)
5948
Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1)
6049
Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)

0 commit comments

Comments
 (0)