diff --git a/extra/pagerank/__init__.py b/extra/pagerank/__init__.py new file mode 100644 index 000000000..678377343 --- /dev/null +++ b/extra/pagerank/__init__.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# The MIT License +# +# Copyright 2010 Corey Goldberg +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +pass diff --git a/extra/pagerank/pagerank.py b/extra/pagerank/pagerank.py new file mode 100644 index 000000000..106ac72fb --- /dev/null +++ b/extra/pagerank/pagerank.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# +# Script for getting Google Page Rank of page +# Google Toolbar 3.0.x/4.0.x Pagerank Checksum Algorithm +# +# original from http://pagerank.gamesaga.net/ +# this version was adapted from http://www.djangosnippets.org/snippets/221/ +# by Corey Goldberg - 2010 +# +# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php + +import urllib + +def get_pagerank(url): + hsh = check_hash(hash_url(url)) + gurl = 'http://www.google.com/search?client=navclient-auto&features=Rank:&q=info:%s&ch=%s' % (urllib.quote(url), hsh) + try: + f = urllib.urlopen(gurl) + rank = f.read().strip()[9:] + except Exception: + rank = 'N/A' + if rank == '': + rank = '0' + return rank + +def int_str(string, integer, factor): + for i in range(len(string)) : + integer *= factor + integer &= 0xFFFFFFFF + integer += ord(string[i]) + return integer + +def hash_url(string): + c1 = int_str(string, 0x1505, 0x21) + c2 = int_str(string, 0, 0x1003F) + + c1 >>= 2 + c1 = ((c1 >> 4) & 0x3FFFFC0) | (c1 & 0x3F) + c1 = ((c1 >> 4) & 0x3FFC00) | (c1 & 0x3FF) + c1 = ((c1 >> 4) & 0x3C000) | (c1 & 0x3FFF) + + t1 = (c1 & 0x3C0) << 4 + t1 |= c1 & 0x3C + t1 = (t1 << 2) | (c2 & 0xF0F) + + t2 = (c1 & 0xFFFFC000) << 4 + t2 |= c1 & 0x3C00 + t2 = (t2 << 0xA) | (c2 & 0xF0F0000) + + return (t1 | t2) + +def check_hash(hash_int): + hash_str = '%u' % (hash_int) + flag = 0 + check_byte = 0 + + i = len(hash_str) - 1 + while i >= 0: + byte = int(hash_str[i]) + if 1 == (flag % 2): + byte *= 2; + byte = byte / 10 + byte % 10 + check_byte += byte + flag += 1 + i -= 1 + + check_byte %= 10 + if 0 != check_byte: + check_byte = 10 - check_byte + if 1 == flag % 2: + if 1 == check_byte % 2: + check_byte += 9 + check_byte >>= 1 + + return '7' + str(check_byte) + hash_str diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 8807a8401..71e8422fe 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -38,6 +38,7 @@ from lib.core.exception import sqlmapUserQuitException from lib.core.session import setInjection from lib.core.target import initTargetEnv from lib.core.target import setupTargetEnv +from extra.pagerank.pagerank import get_pagerank def __selectInjection(): """ @@ -193,7 +194,7 @@ def start(): if conf.forms: message = "[#%d] form:\n%s %s" % (hostCount, conf.method or HTTPMETHOD.GET, targetUrl) else: - message = "%s %d:\n%s %s" % ("url", hostCount, conf.method or HTTPMETHOD.GET, targetUrl) + message = "%s %d:\n%s %s (PR: %s)" % ("url", hostCount, conf.method or HTTPMETHOD.GET, targetUrl, get_pagerank(targetUrl)) if conf.cookie: message += "\nCookie: %s" % conf.cookie diff --git a/txt/user-agents.txt b/txt/user-agents.txt index 577ad878a..0f08b3b0d 100644 --- a/txt/user-agents.txt +++ b/txt/user-agents.txt @@ -3,7 +3,6 @@ Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com) Baiduspider ( http://www.baidu.com/search/spider.htm) -curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7b zlib/1.2.2 GameSpyHTTP/1.0 Gigabot/2.0 Googlebot-Image/1.0 @@ -28,11 +27,8 @@ Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320) Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 176x220) Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; Smartphone; 240x320) Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) -Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 6.0 [en] Mozilla/4.0 (compatible; MSIE 5.0; SunOS 5.9 sun4u; X11) Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.03 [en] -Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC) -Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC) Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Mozilla/4.0 (compatible; MSIE 6.0; ; Linux armv5tejl; U) Opera 8.02 [en_US] Maemo browser 0.4.31 N770/SU-18 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] Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; Nokia 6630/4.03.38; 6937) Opera 8.50 [es] Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile m.n) where Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; Motorola VIP12xx) -Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser [avantbrowser.com]; iOpus-I-M; QXW03416; .NET CLR 1.1.4322) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.50 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) -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) -Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) -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 Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2) -Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322) -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) -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) Mozilla/4.0 (compatible; MSIE 7.0b; Win32) Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1) Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)