def add_owtf_transaction(self, request_hash): owtf_transaction = transaction.HTTP_Transaction(timer.Timer()) request = request_from_cache(request_hash, self.cache_dir) response = response_from_cache(request_hash, self.cache_dir) request.in_scope = self.Core.IsInScopeURL(request.url) owtf_transaction.ImportProxyRequestResponse(request, response) self.Core.DB.Transaction.LogTransaction(owtf_transaction)
def get_owtf_transactions(self, hash_list): transactions_dict = None target_list = self.target.GetIndexedTargets() if target_list: # If there are no targets in db, where are we going to add. OMG transactions_dict = {} host_list = self.target.GetAllInScope('host_name') for request_hash in hash_list: request = request_from_cache(os.path.join(self.cache_dir, request_hash)) response = response_from_cache(os.path.join(self.cache_dir, request_hash)) target_id, request.in_scope = self.derive_target_for_transaction(request, response, target_list, host_list) owtf_transaction = transaction.HTTP_Transaction(timer.Timer()) owtf_transaction.ImportProxyRequestResponse(request, response) try: transactions_dict[target_id].append(owtf_transaction) except KeyError: transactions_dict[target_id] = [owtf_transaction] return(transactions_dict)