Пример #1
0
    def _createSession(self):
        try:
            data = json.loads(request.data.decode())

            random_name = ''.join(
                random.choice(string.ascii_uppercase + string.digits)
                for _ in range(12))
            hash_file = os.path.join(
                self.hash_directory,
                data["name"] + "_" + random_name + ".list")

            f = open(hash_file, "w")
            f.write(data["hashes"])
            f.close()

            Hashcat.create_session(
                data["name"], data["crack_type"], hash_file,
                int(data["hash_mode_id"]),
                data["wordlist"] if "wordlist" in data else None,
                data["rule"] if "rule" in data else None,
                data["mask"] if "mask" in data else None,
                data["username_included"])

            res = {"response": "ok"}

            return json.dumps(res)
        except Exception as e:
            traceback.print_exc()

            return json.dumps({
                "response": "error",
                "message": str(e),
            })
Пример #2
0
    def _createSession(self):
        try:
            data = json.loads(request.form.get('json'))

            random_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(12))
            hash_file = os.path.join(self.hash_directory, data["name"]+"_"+random_name+".list")

            file = request.files['file']
            file.save(hash_file)

            Hashcat.create_session(
                data["name"],
                data["crack_type"],
                hash_file,
                int(data["hash_mode_id"]),
                data["wordlist"] if "wordlist" in data else None,
                data["rule"] if "rule" in data else None,
                data["mask"] if "mask" in data else None,
                data["username_included"],
                int(data["device_type"]),
                int(data["brain_mode"]),
                int(data["end_timestamp"]) if data["end_timestamp"] != None else None,
                data["hashcat_debug_file"],
            )

            res = {"response": "ok"}

            return json.dumps(res)
        except Exception as e:
            traceback.print_exc()

            return json.dumps({
                "response": "error",
                "message": str(e),
            })