Commit ·
deeaf96
1
Parent(s): 84ae2d0
Clean agentNotes: human-readable format per GUVI spec Section 12
Browse files- app/utils/guvi_handler.py +61 -28
app/utils/guvi_handler.py
CHANGED
|
@@ -342,36 +342,69 @@ class GUVIHandler:
|
|
| 342 |
if agg_intel.get("is_synthetic"):
|
| 343 |
ethics_note = " [NOTE: Synthetic identifiers injected for sandbox visibility]"
|
| 344 |
|
| 345 |
-
# [SCORING]
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
-
#
|
|
|
|
| 361 |
if guvi_intel.upiIds:
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
|
| 376 |
# Evaluation Flags
|
| 377 |
is_scam = result.get("is_scam", False)
|
|
|
|
| 342 |
if agg_intel.get("is_synthetic"):
|
| 343 |
ethics_note = " [NOTE: Synthetic identifiers injected for sandbox visibility]"
|
| 344 |
|
| 345 |
+
# [SCORING] Build CLEAN human-readable agentNotes (per GUVI spec Section 12)
|
| 346 |
+
# Example: "Scammer used urgency tactics and payment redirection"
|
| 347 |
+
|
| 348 |
+
# Map tactics to readable descriptions
|
| 349 |
+
tactic_descriptions = {
|
| 350 |
+
"urgency": "urgency pressure",
|
| 351 |
+
"authority": "authority impersonation",
|
| 352 |
+
"fear": "fear tactics",
|
| 353 |
+
"greed": "fake reward promises",
|
| 354 |
+
"social_proof": "social proof manipulation",
|
| 355 |
+
"reciprocity": "reciprocity manipulation",
|
| 356 |
+
"scarcity": "scarcity pressure",
|
| 357 |
+
"time_pressure": "time-based coercion",
|
| 358 |
+
"identity_theft": "identity theft attempt",
|
| 359 |
+
"phishing": "phishing attempt",
|
| 360 |
+
"credential_harvesting": "credential harvesting"
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
# Build readable tactics list
|
| 364 |
+
readable_tactics = []
|
| 365 |
+
for t in tactics[:3]:
|
| 366 |
+
readable_tactics.append(tactic_descriptions.get(t.lower(), t.replace("_", " ")))
|
| 367 |
|
| 368 |
+
# Determine primary scam vector
|
| 369 |
+
scam_vectors = []
|
| 370 |
if guvi_intel.upiIds:
|
| 371 |
+
scam_vectors.append("UPI payment redirect")
|
| 372 |
+
if guvi_intel.bankAccounts:
|
| 373 |
+
scam_vectors.append("bank account harvesting")
|
| 374 |
+
if guvi_intel.phishingLinks:
|
| 375 |
+
scam_vectors.append("phishing link distribution")
|
| 376 |
+
if guvi_intel.phoneNumbers:
|
| 377 |
+
scam_vectors.append("phone number collection")
|
| 378 |
+
if any(k in ["OTP", "otp"] for k in guvi_intel.suspiciousKeywords):
|
| 379 |
+
scam_vectors.append("OTP theft attempt")
|
| 380 |
+
|
| 381 |
+
# Build clean agent notes
|
| 382 |
+
tactics_str = " and ".join(readable_tactics) if readable_tactics else "social engineering"
|
| 383 |
+
vectors_str = " and ".join(scam_vectors[:2]) if scam_vectors else "credential extraction"
|
| 384 |
+
|
| 385 |
+
agent_notes = f"Scammer used {tactics_str}. Detected {vectors_str}."
|
| 386 |
+
|
| 387 |
+
# Add intel summary if available
|
| 388 |
+
intel_items = []
|
| 389 |
+
if guvi_intel.upiIds:
|
| 390 |
+
intel_items.append(f"{len(guvi_intel.upiIds)} UPI ID(s)")
|
| 391 |
+
if guvi_intel.bankAccounts:
|
| 392 |
+
intel_items.append(f"{len(guvi_intel.bankAccounts)} bank account(s)")
|
| 393 |
+
if guvi_intel.phoneNumbers:
|
| 394 |
+
intel_items.append(f"{len(guvi_intel.phoneNumbers)} phone number(s)")
|
| 395 |
+
if guvi_intel.phishingLinks:
|
| 396 |
+
intel_items.append(f"{len(guvi_intel.phishingLinks)} phishing link(s)")
|
| 397 |
+
|
| 398 |
+
if intel_items:
|
| 399 |
+
agent_notes += f" Extracted: {', '.join(intel_items)}."
|
| 400 |
+
|
| 401 |
+
# Add engagement depth
|
| 402 |
+
turns = total_messages // 2
|
| 403 |
+
if turns >= 5:
|
| 404 |
+
agent_notes += f" Successfully engaged for {turns} turns."
|
| 405 |
+
|
| 406 |
+
# Add ethics note if applicable
|
| 407 |
+
agent_notes += ethics_note
|
| 408 |
|
| 409 |
# Evaluation Flags
|
| 410 |
is_scam = result.get("is_scam", False)
|