Exemplo n.º 1
0
def brute_digits(thread_id, start_length, end_length):
    print("Starting thread ID #{}".format(thread_id))
    l = "9" * end_length
    for i in range(int("1" + "0" * start_length), int("9" * (end_length + 1))):
        word = str(i)
        decoded = cookie_decode(cookie, word)
        print("#{} - [{}/{}] {}: {}".format(thread_id, i + 1, l, word, decoded), end="\r")
        if decoded:
            print()
            print()
            print()
            print()
            print()
            print("==========================================")
            print("FOUND KEY:", word)
            with open("secret_key.txt", "a") as f:
                f.write(word + "\n")
            print("==========================================")
            print()
            print()
            print()
            print()
            print()
            print()
            exit(0)
Exemplo n.º 2
0
    def wrapper(*args, **kwargs):
      collection = self.__database[self.__collection]
      sid = bottle.request.get_cookie(Plugin.key,
                                      secret = Plugin.secret)
      bottle.request.session_id = sid
      bottle.request.session = {}
      clone_session = False
      if 'session-id' in bottle.request.query:
        sid_data = bottle.request.query['session-id']
        if len(sid_data) != 0 and sid_data[0] == '"':
          sid_data = sid_data[1:-1]
        if sid is None:
          sid = bottle.cookie_decode(sid_data, Plugin.secret)
          if sid is not None:
            sid = sid[1]
            bottle.response.set_cookie(Plugin.key,
                                       sid,
                                       secret = Plugin.secret,
                                       max_age = 3600 * 24 * 365)
            clone_session = True
        del bottle.request.query['session-id']
      if sid is not None:
        session = collection.find_one({'_id': sid})
        if session is not None:
          del session['_id']
          bottle.request.session = session
      previous = copy.deepcopy(bottle.request.session)
      res = callback(*args, **kwargs)
      session = bottle.request.session
      if clone_session:
        sid = None #Force creation with a new sid
      if session != previous or clone_session:
        if sid is None:
          if len(session):
            sid = collection.insert(session)
            bottle.response.set_cookie(Plugin.key,
                                       sid,
                                       secret = Plugin.secret,
                                       max_age = 3600 * 24 * 365,
                                       path = '/')
        elif len(session):
          session['_id'] = sid
          sid = collection.save(session)
        else:
          bottle.response.delete_cookie(Plugin.key)
          collection.remove(sid)

      return res
Exemplo n.º 3
0
def brute(thread_id, words):
    print("Starting thread ID #{}".format(thread_id))
    l = len(words)
    for i, word in enumerate(words):
        decoded = cookie_decode(cookie, word)
        print("#{} - [{}/{}] {}: {}".format(thread_id, i + 1, l, word, decoded))
        if decoded:
            print()
            print()
            print()
            print()
            print()
            print("==========================================")
            print("FOUND KEY:", word)
            with open("secret_key.txt", "a") as f:
                f.write(word + "\n")
            print("==========================================")
            print()
            print()
            print()
            print()
            print()
            print()
            exit(0)
Exemplo n.º 4
0
 def testDeEncode(self):
     cookie = bottle.cookie_encode(self.data, self.key)
     decoded = bottle.cookie_decode(cookie, self.key)
     self.assertEqual(self.data, decoded)
     decoded = bottle.cookie_decode(cookie+tob('x'), self.key)
     self.assertEqual(None, decoded)
Exemplo n.º 5
0
    print(f"Charset: {charset}")

    if min_length > max_length:
        print("[ERROR] min_length is larger than max_length")
        exit(1)


    print("Generating permutations, this might take a while...")
    #a = itertools.permutations(charset)
    
    for length in range(min_length, max_length + 1):
        print(f"Starting bruteforce of length: {length}")
        for elem in itertools.product(charset, repeat=length):
            word = "".join(elem)
            print(word, end="\r")
            decoded = cookie_decode(raw_cookie, word)
            if decoded:
                print()
                print()
                print()
                print()
                print()
                print("==========================================")
                print("FOUND KEY:", word)
                with open("secret_key.txt", "a") as f:
                    f.write(word + "\n")
                print("==========================================")
                print()
                print()
                print()
                print()