Spaces:
Sleeping
Sleeping
Ankit19102004 commited on
Commit ·
5e843fa
1
Parent(s): 3589264
Update honeypot_api and README
Browse files- honeypot_api.py +58 -5
honeypot_api.py
CHANGED
|
@@ -132,6 +132,17 @@ def extract_intelligence(text):
|
|
| 132 |
clean_bank.append(digits)
|
| 133 |
extracted["bankAccounts"] = list(set(clean_bank))
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
return extracted
|
| 136 |
|
| 137 |
# ============================
|
|
@@ -151,6 +162,41 @@ def generate_agent_reply(session_id):
|
|
| 151 |
|
| 152 |
text_lower = last_scammer_text.lower()
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
upi_hint = None
|
| 155 |
email_hint = None
|
| 156 |
amount_hint = None
|
|
@@ -179,11 +225,14 @@ def generate_agent_reply(session_id):
|
|
| 179 |
"Can you share an official way I can confirm that this UPI ID actually belongs to your organisation?"
|
| 180 |
)
|
| 181 |
elif otp_flag:
|
| 182 |
-
|
| 183 |
-
"You are asking for my OTP and that makes me very uncomfortable. "
|
| 184 |
-
"I
|
| 185 |
-
"
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
| 187 |
elif fee_flag or amount_hint:
|
| 188 |
if amount_hint:
|
| 189 |
reply = (
|
|
@@ -215,6 +264,10 @@ def generate_agent_reply(session_id):
|
|
| 215 |
]
|
| 216 |
reply = random.choice(generic_questions)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
if not reply.endswith("?"):
|
| 219 |
reply += "?"
|
| 220 |
|
|
|
|
| 132 |
clean_bank.append(digits)
|
| 133 |
extracted["bankAccounts"] = list(set(clean_bank))
|
| 134 |
|
| 135 |
+
bank_digits_list = extracted["bankAccounts"]
|
| 136 |
+
clean_phones = []
|
| 137 |
+
for ph in extracted["phoneNumbers"]:
|
| 138 |
+
d = re.sub(r"\D", "", ph)
|
| 139 |
+
if len(d) != 10:
|
| 140 |
+
continue
|
| 141 |
+
if any(d in b for b in bank_digits_list):
|
| 142 |
+
continue
|
| 143 |
+
clean_phones.append(ph)
|
| 144 |
+
extracted["phoneNumbers"] = list(set(clean_phones))
|
| 145 |
+
|
| 146 |
return extracted
|
| 147 |
|
| 148 |
# ============================
|
|
|
|
| 162 |
|
| 163 |
text_lower = last_scammer_text.lower()
|
| 164 |
|
| 165 |
+
intel_so_far = intelligence_store.get(session_id, {})
|
| 166 |
+
missing_type = None
|
| 167 |
+
info_priority = [
|
| 168 |
+
"phoneNumbers",
|
| 169 |
+
"bankAccounts",
|
| 170 |
+
"upiIds",
|
| 171 |
+
"emailAddresses",
|
| 172 |
+
"phishingLinks",
|
| 173 |
+
"caseIds",
|
| 174 |
+
"orderNumbers",
|
| 175 |
+
"policyNumbers",
|
| 176 |
+
]
|
| 177 |
+
for t in info_priority:
|
| 178 |
+
if not intel_so_far.get(t):
|
| 179 |
+
missing_type = t
|
| 180 |
+
break
|
| 181 |
+
|
| 182 |
+
info_prompt = ""
|
| 183 |
+
if missing_type == "phoneNumbers":
|
| 184 |
+
info_prompt = " Also, can you share your official contact phone number so that I can call and verify this?"
|
| 185 |
+
elif missing_type == "bankAccounts":
|
| 186 |
+
info_prompt = " Also, can you clearly write the full bank account number and account holder name where this money is supposed to go?"
|
| 187 |
+
elif missing_type == "upiIds":
|
| 188 |
+
info_prompt = " Also, please send the exact UPI ID with correct spelling so that I do not send money to the wrong place."
|
| 189 |
+
elif missing_type == "emailAddresses":
|
| 190 |
+
info_prompt = " Is there any official support email where I can write if something goes wrong?"
|
| 191 |
+
elif missing_type == "phishingLinks":
|
| 192 |
+
info_prompt = " Is there an official link or page from my bank where I can read about this process?"
|
| 193 |
+
elif missing_type == "caseIds":
|
| 194 |
+
info_prompt = " Can you share the official case or reference ID so that I can mention it if I talk to the branch?"
|
| 195 |
+
elif missing_type == "orderNumbers":
|
| 196 |
+
info_prompt = " Can you share any order or reference number that is connected to this payment?"
|
| 197 |
+
elif missing_type == "policyNumbers":
|
| 198 |
+
info_prompt = " Can you share any policy number that this issue is linked to?"
|
| 199 |
+
|
| 200 |
upi_hint = None
|
| 201 |
email_hint = None
|
| 202 |
amount_hint = None
|
|
|
|
| 225 |
"Can you share an official way I can confirm that this UPI ID actually belongs to your organisation?"
|
| 226 |
)
|
| 227 |
elif otp_flag:
|
| 228 |
+
otp_replies = [
|
| 229 |
+
"You are asking for my OTP and that makes me very uncomfortable. I was always told never to share an OTP with anyone. Why do you need my OTP at all if you already have my details?",
|
| 230 |
+
"I really do not feel safe sharing any OTP with you. If you are truly from the bank, why can you not verify me in some other way?",
|
| 231 |
+
"Everyone says that sharing an OTP is the fastest way to lose money. Can you explain why you still need my OTP if you already have my account details?",
|
| 232 |
+
"This feels risky because you keep insisting on the OTP. Can you clearly show me any official bank message that says I should share my OTP like this?",
|
| 233 |
+
]
|
| 234 |
+
idx = min(turn, len(otp_replies) - 1)
|
| 235 |
+
reply = otp_replies[idx]
|
| 236 |
elif fee_flag or amount_hint:
|
| 237 |
if amount_hint:
|
| 238 |
reply = (
|
|
|
|
| 264 |
]
|
| 265 |
reply = random.choice(generic_questions)
|
| 266 |
|
| 267 |
+
reply = reply.strip()
|
| 268 |
+
if info_prompt:
|
| 269 |
+
reply = reply + " " + info_prompt.strip()
|
| 270 |
+
|
| 271 |
if not reply.endswith("?"):
|
| 272 |
reply += "?"
|
| 273 |
|