def output(self, args): self._parse(args.raw) if args.json: json_output = {} for cred in self._credentials: ssp, domain, username, password, lhmash, nthash = cred domain = self._decode(domain) username = self._decode(username) password = self._decode(password) if domain not in json_output: json_output[domain] = {} if username not in json_output[domain]: json_output[domain][username] = [] credential = { "password": password, "lmhash": lhmash, "nthash": nthash } if credential not in json_output[domain][username]: json_output[domain][username].append(credential) print(json.dumps(json_output), end='') elif args.grep: credentials = set() for cred in self._credentials: credentials.add(':'.join( [self._decode(c) if c is not None else '' for c in cred])) for cred in credentials: print(cred) else: if len(self._credentials) == 0: self._log.warn('No credentials found') return RetCode(ERROR_NO_CREDENTIAL_FOUND) max_size = max(len(c[1]) + len(c[2]) for c in self._credentials) credentials = [] for cred in self._credentials: ssp, domain, username, password, lhmash, nthash = cred domain = self._decode(domain) username = self._decode(username) password = self._decode(password) if password is None: password = '******'.join(h for h in [lhmash, nthash] if h is not None) if [domain, username, password] not in credentials: credentials.append([domain, username, password]) self._log.success("{}\\{}{}{}".format( domain, username, " " * (max_size - len(domain) - len(username) + 2), Logger.highlight(password)), force=True)
def output(self, args): self._parse(args.raw) if args.json: json_output = {} for cred in self.credentials: ssp, domain, username, password, lhmash, nthash = cred if domain not in json_output: json_output[domain] = {} if username not in json_output[domain]: json_output[domain][username] = [] credential = { "password": password, "lmhash": lhmash, "nthash": nthash } if credential not in json_output[domain][username]: json_output[domain][username].append(credential) print(json.dumps(json_output), end='') elif args.grep: credentials = set() for cred in self.credentials: credentials.add(':'.join( [c if c is not None else '' for c in cred])) for cred in credentials: print(cred) else: if len(self.credentials) == 0: self.log.error('No credentials found') return 0 max_size = max(len(c[0]) + len(c[1]) for c in self.credentials) credentials = [] for cred in self.credentials: ssp, domain, username, password, lhmash, nthash = cred if password is None: password = '******'.join(h for h in [lhmash, nthash] if h is not None) if [domain, username, password] not in credentials: credentials.append([domain, username, password]) self.log.success("{}\\{}{}{}".format( domain, username, " " * (max_size - len(domain) - len(username)), Logger.highlight(password)))