From 4b420e75798526d8ab1445e872150bdda11acf91 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 23 Feb 2017 11:33:39 +0100 Subject: [PATCH] Removing Google PageRank as it is dead now --- doc/COPYING | 1 - doc/THIRD-PARTY.md | 2 - lib/controller/controller.py | 3 +- lib/core/settings.py | 2 +- thirdparty/pagerank/__init__.py | 26 ---------- thirdparty/pagerank/pagerank.py | 87 --------------------------------- txt/checksum.md5 | 6 +-- 7 files changed, 4 insertions(+), 123 deletions(-) delete mode 100644 thirdparty/pagerank/__init__.py delete mode 100644 thirdparty/pagerank/pagerank.py diff --git a/doc/COPYING b/doc/COPYING index 30e652cf9..3fc1d5ad6 100644 --- a/doc/COPYING +++ b/doc/COPYING @@ -361,7 +361,6 @@ This license does not apply to the following components: * The MultipartPost library located under thirdparty/multipartpost/. * The Odict library located under thirdparty/odict/. * The Oset library located under thirdparty/oset/. -* The PageRank library located under thirdparty/pagerank/. * The PrettyPrint library located under thirdparty/prettyprint/. * The PyDes library located under thirdparty/pydes/. * The SocksiPy library located under thirdparty/socks/. diff --git a/doc/THIRD-PARTY.md b/doc/THIRD-PARTY.md index d0d24f2c7..2bf01b6ea 100644 --- a/doc/THIRD-PARTY.md +++ b/doc/THIRD-PARTY.md @@ -281,8 +281,6 @@ be bound by the terms and conditions of this License Agreement. * The bottle web framework library located under thirdparty/bottle/. Copyright (C) 2012, Marcel Hellkamp. -* The PageRank library located under thirdparty/pagerank/. - Copyright (C) 2010, Corey Goldberg. * The Termcolor library located under thirdparty/termcolor/. Copyright (C) 2008-2011, Volvox Development Team. diff --git a/lib/controller/controller.py b/lib/controller/controller.py index f992dcff1..c8b090ed2 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -65,7 +65,6 @@ from lib.core.settings import REFERER_ALIASES from lib.core.settings import USER_AGENT_ALIASES from lib.core.target import initTargetEnv from lib.core.target import setupTargetEnv -from thirdparty.pagerank.pagerank import get_pagerank def _selectInjection(): """ @@ -320,7 +319,7 @@ def start(): if conf.forms and conf.method: message = "[#%d] form:\n%s %s" % (hostCount, conf.method, targetUrl) else: - message = "URL %d:\n%s %s%s" % (hostCount, HTTPMETHOD.GET, targetUrl, " (PageRank: %s)" % get_pagerank(targetUrl) if conf.googleDork and conf.pageRank else "") + message = "URL %d:\n%s %s" % (hostCount, HTTPMETHOD.GET, targetUrl) if conf.cookie: message += "\nCookie: %s" % conf.cookie diff --git a/lib/core/settings.py b/lib/core/settings.py index ca075f9e5..5664a6839 100755 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.1.2.12" +VERSION = "1.1.2.13" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/thirdparty/pagerank/__init__.py b/thirdparty/pagerank/__init__.py deleted file mode 100644 index 678377343..000000000 --- a/thirdparty/pagerank/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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/thirdparty/pagerank/pagerank.py b/thirdparty/pagerank/pagerank.py deleted file mode 100644 index 85dbe82fa..000000000 --- a/thirdparty/pagerank/pagerank.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/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 -# -# important update (http://www.seroundtable.com/google-pagerank-change-14132.html) -# by Miroslav Stampar - 2012 -# -# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php - -import sys -import urllib -import urllib2 - -def get_pagerank(url, timeout=10): - url = url.encode('utf8') if isinstance(url, unicode) else url - _ = 'http://toolbarqueries.google.com/tbr?client=navclient-auto&features=Rank&ch=%s&q=info:%s' % (check_hash(hash_url(url)), urllib.quote(url)) - try: - req = urllib2.Request(_) - rank = urllib2.urlopen(req, timeout=timeout).read().strip()[9:] - except: - rank = 'N/A' - else: - rank = '0' if not rank or not rank.isdigit() else rank - return rank - -def int_str(string_, integer, factor): - for i in xrange(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 - -def main(): - print get_pagerank(sys.argv[1]) if len(sys.argv) > 1 else "[x] missing hostname" - -if __name__ == "__main__": - main() diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 8ab437c1f..a2386a53d 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -21,7 +21,7 @@ c55b400b72acc43e0e59c87dd8bb8d75 extra/shellcodeexec/windows/shellcodeexec.x32. 7713aa366c983cdf1f3dbaa7383ea9e1 extra/sqlharvest/sqlharvest.py 5df358defc488bee9b40084892e3d1cb lib/controller/action.py 9cb94acd4c59822a5e1a258c4d1a4860 lib/controller/checks.py -fa72e4d6eda241725d90738d61e7d55d lib/controller/controller.py +dc386321e8813788f155dc557a78be8d lib/controller/controller.py b3eec7f44bcc5d784d171a187b7fe8cb lib/controller/handler.py 310efc965c862cfbd7b0da5150a5ad36 lib/controller/__init__.py 19905ecb4437b94512cf21d5f1720091 lib/core/agent.py @@ -45,7 +45,7 @@ e544108e2238d756c94a240e8a1ce061 lib/core/optiondict.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py -9fb5d80b24bf89c326c69de96582c5c0 lib/core/settings.py +17ee99af8efe59e90d66208d1e5ae8a4 lib/core/settings.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py afd0636d2e93c23f4f0a5c9b6023ea17 lib/core/target.py @@ -345,8 +345,6 @@ d41d8cd98f00b204e9800998ecf8427e thirdparty/multipart/__init__.py 08801ea0ba9ae22885275ef65d3ee9dc thirdparty/oset/_abc.py 54a861de0f08bb80c2e8846579ec83bd thirdparty/oset/__init__.py 179f0c584ef3fb39437bdb6e15d9c867 thirdparty/oset/pyoset.py -d24924d878e24946e83cfc1459f806af thirdparty/pagerank/__init__.py -7616693115d08f9b815a567515a0db56 thirdparty/pagerank/pagerank.py 94a4abc0fdac64ef0661b82aff68d791 thirdparty/prettyprint/__init__.py ff80a22ee858f5331b0c088efa98b3ff thirdparty/prettyprint/prettyprint.py 5c70f8e5f7353aedc6d8d21d4fb72b37 thirdparty/pydes/__init__.py