MCPcopy Create free account
hub / github.com/SpecterOps/DeepPass2 / get_secrets_LLM

Function get_secrets_LLM

deeppass2.py:130–167  ·  view source on GitHub ↗

Run LLM check and confirmation on the retrieved xlm-RoBERTa-base model

(bert_output)

Source from the content-addressed store, hash-verified

128 return prompt
129
130def get_secrets_LLM(bert_output):
131 """Run LLM check and confirmation on the retrieved xlm-RoBERTa-base model"""
132 secrets_list = []
133 litellm_model = os.environ["AUGMENT_MODEL"]
134
135 start = time.time()
136
137 for secrets in bert_output:
138 passw = secrets["secret"]
139 text = secrets["chunk"]
140 prompt = get_prompt(text, passw)
141
142 ## Change the code here to accomodate non-litellm infra
143 response = litellm_client.chat.completions.create(
144 model=litellm_model,
145 messages = [
146 {
147 "role": "system",
148 "content": "You are a helpful assistant. Your expertise is to identify the presence of APIs, database links, or leaked passwords. Do not explain."
149 },
150 {
151 "role": "user",
152 "content": prompt
153 }
154 ],
155 )
156 execution_time = (time.time()-start)
157 message = response.choices[0].message.content
158
159 credential_pattern = r"<credential>(.*?)</credential>"
160 credential_matches = list(re.finditer(credential_pattern, message))
161
162
163 credentials = [match.group(1) for match in credential_matches]
164
165 secrets_list.append({'Extracted_Credentials':credentials, 'LLM_response':message,'chunk':text, 'generation_time': execution_time})
166
167 return secrets_list
168
169
170def get_secrets_BERT(chunks, model=model, tokenizer=tokenizer):

Callers 1

scan_secretFunction · 0.85

Calls 1

get_promptFunction · 0.85

Tested by

no test coverage detected