aboutsummaryrefslogtreecommitdiffstats
path: root/toys/brhute-py/pphidden_async.py
blob: 463364f4e1597fd8f6dbfe667a12ab3fdbd2da7b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import sys
import argparse
import grbrute
import brhute_threaded

# http://www.pointerpointer.com/gridPositions.json

class Pp_url:
    def __init__(self, image, x, y, max_x=100, max_y=100):
        self.host = "www.pointerpointer.com"
        self.base_url = "/images"
        self.image = image
        self.x = x
        self.y = y
        self.max_x = max_x
        self.max_y = max_y
        print ">>> Looking for image %d <<<" % image
        print ">>>> starting x=%d y=%d <<<<" % (x, y)
    def __iter__(self):
        return self
    def next(self):
        url = "%s/N%04d_%d_%d.jpg" % (self.base_url, self.image, self.x, self.y)
        self.y += 1
        if self.y > self.max_y:
            self.x += 1
            self.y = 0
        if self.x > self.max_x:
            raise StopIteration
        return (self.host, url)

def cb_response_grbrute(res):
    global found
    if not found:
        print "[-] %s : %d" % (res.url, res.status_code)
    if res.status_code != 404:
        found = res.url
        return False
    return True

def cb_response_brhute(res):
    global found
    if not found:
        print "res: %s" % res
    #if res.status_code != 404:
    #    found = res.url
    #    return False
    #return True

parser = argparse.ArgumentParser(description='pphidden_async',
                                 epilog="Example: %s 73 0 0" % sys.argv[0])
parser.add_argument('image', action="store", type=int,
                    help="Image number")
parser.add_argument('start_x', action="store", type=int,
                    help="Start at coordinate X=")
parser.add_argument('start_y', action="store", type=int,
                    help="Start at coordinate Y=")
parser.add_argument('-b', action="store", dest="backend", default="gbrute",
                    help="Backend, can be gbrute (default) or brhute (work in progress)")
parser.add_argument('-v', action="store_true", dest="verbose", default=False,
                    help="verbose")
args = parser.parse_args()                                               

found = None

if args.backend == "gbrute":
    url_iter = Pp_url(args.image, args.start_x, args.start_y)
    grbrute.Grbrute(url_iter, cb_response_grbrute, verbose=args.verbose)
elif args.backend == "brhute":
    url_iter = Pp_url(args.image, args.start_x, args.start_y)
    #brhute_threaded.Brhute_ip(url_iter, "207.171.163.203", # Amazon
    #                 cb_response=cb_response_brhute, verbose=args.verbose)
    #brhute.Brhute_ip(url_iter, "173.194.34.14", # Google
    #                 cb_response=cb_response_brhute, verbose=args.verbose)
    brhute_threaded.Brhute_ip(url_iter, "www.pointerpointer.com", # Amazon
                     cb_response=cb_response_brhute, verbose=args.verbose)
else:
    print "Error: Unknown backend specified"
    sys.exit(1)

if found is False:
    print "[*] not found"
    sys.exit(1)
print "[*] found: %s" % found