aboutsummaryrefslogtreecommitdiffstats
path: root/toys/pphidden_async.py
blob: 229a181beff122272a193ad2dc866794c6fda35c (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
import sys
import argparse
import grbrute

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

class Pp_url:
    def __init__(self, image, x, y, max_x=2000, max_y=2000):
        self.base_url = "http://www.pointerpointer.com/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):
        res = "%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 res

def cb_response(res):
    print "[-] %s : %d" % (res.url, res.status_code)
    if res.status_code != 404:
        print "[*] found: %s" % res.url
        sys.exit(0)

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('-v', action="store_true", dest="verbose", default=False,
                    help="verbose")
args = parser.parse_args()                                               

url_iter = Pp_url(args.image, args.start_x, args.start_y)
grbrute.Grbrute(url_iter, cb_response, verbose=args.verbose)
print "[*] not found"
sys.exit(1)