MCPcopy Index your code
hub / github.com/SpecterOps/DeepPass2 / scan_secret

Function scan_secret

deeppass2.py:183–218  ·  view source on GitHub ↗

Main function to scan the document for secrets

(doc)

Source from the content-addressed store, hash-verified

181 return bert_secret
182
183async def scan_secret(doc):
184 """Main function to scan the document for secrets"""
185 secrets = []
186 try:
187 np_secret, doc_np_cleaned = await get_nosey_parker_results(doc)
188 secrets.append({'Nosey Parker': np_secret})
189 except Exception as e:
190 print(f"Nosey Parker error: {e}")
191 doc_np_cleaned = doc # Use original doc if Nosey Parker fails
192 secrets.append({'Nosey Parker': 'Failed'})
193
194 try:
195 chunks = chunk_document(doc_np_cleaned, tokenizer)
196 except Exception as e:
197 print(f"Chunking error: {e}")
198 chunks = None
199
200 if chunks: # Only proceed if chunking succeeded
201 try:
202 bert_secret = get_secrets_BERT(chunks)
203 secrets.append({'BERT_secrets': bert_secret})
204 except Exception as e:
205 print(f"BERT error: {e}")
206 bert_secret = None
207 secrets.append({'BERT_secrets': 'Failed'})
208
209 if bert_secret: # Only run LLM if BERT succeeded
210 try:
211 LLM_secret = get_secrets_LLM(bert_secret)
212 secrets.append({'LLM_scanning': LLM_secret})
213 except Exception as e:
214 print(f"LLM scanning error: {e}")
215 secrets.append({'LLM_scanning': 'Failed'})
216
217
218 return secrets
219
220
221@app.route('/api/deeppass2', methods=['POST'])

Callers 1

deeppass_scanningFunction · 0.85

Calls 4

get_nosey_parker_resultsFunction · 0.85
chunk_documentFunction · 0.85
get_secrets_BERTFunction · 0.85
get_secrets_LLMFunction · 0.85

Tested by

no test coverage detected