DEV Community

Cover image for ๐— ๐—ถ๐˜€๐˜€๐—ถ๐—ผ๐—ป ๐—›๐—ผ๐—ป๐—ฒ๐˜†๐—ฝ๐—ผ๐˜: ๐—›๐—ผ๐˜„ ๐—œ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐—ฒ๐—ฑ ๐—ฎ๐—ป ๐—”๐˜‚๐˜๐—ผ๐—ป๐—ผ๐—บ๐—ผ๐˜‚๐˜€ ๐—”๐—œ ๐˜๐—ผ ๐—ฆ๐—ฐ๐—ฎ๐—บ ๐˜๐—ต๐—ฒ ๐—ฆ๐—ฐ๐—ฎ๐—บ๐—บ๐—ฒ๐—ฟ๐˜€
praveena 0506
praveena 0506

Posted on

๐— ๐—ถ๐˜€๐˜€๐—ถ๐—ผ๐—ป ๐—›๐—ผ๐—ป๐—ฒ๐˜†๐—ฝ๐—ผ๐˜: ๐—›๐—ผ๐˜„ ๐—œ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐—ฒ๐—ฑ ๐—ฎ๐—ป ๐—”๐˜‚๐˜๐—ผ๐—ป๐—ผ๐—บ๐—ผ๐˜‚๐˜€ ๐—”๐—œ ๐˜๐—ผ ๐—ฆ๐—ฐ๐—ฎ๐—บ ๐˜๐—ต๐—ฒ ๐—ฆ๐—ฐ๐—ฎ๐—บ๐—บ๐—ฒ๐—ฟ๐˜€

I Over-Engineered an AI to Gaslight Financial Scammers at 80ms Latency ๐Ÿฏ๐Ÿ‘ด
Scammer: "URGENT: Your SBI account is blocked. Send OTP."
Me, an intellectual: spins up an asynchronous, multi-agent AI pipeline to systematically destroy their patience.

We all get those spam texts. Most normal, well-adjusted humans just block the number and move on with their lives. But as a developer, I saw a problem: Ignoring scammers doesn't waste their time. So, rather than doing something useful with my weekend like fixing my broken Docker containers, I built an Autonomous Counter-Scamming Agent.

Welcome to Project Grandpa.

The Architecture of Petty Vengeance
The goal wasn't just to talk to them. A basic while True loop with a randomized response could do that. I wanted to build a system that baits them, maintains a consistent, infuriating persona, and silently harvests their threat data in the background.

Here is the tech stack I used to make a scammer question their life choices:

1. The Brain: DSPy & Llama-3 ๐Ÿง 
I could have used a basic OpenAI wrapper, but why write an if statement when you can use a declarative programming framework to mathematically optimize a confused 72-year-old man?

I used DSPy to define a rigorous Cognitive Engine. The persona? Ramachandran. Heโ€™s 72, he doesn't know what a "UPI" is, his caps-lock is occasionally stuck, and he is very eager to give you his bank details if he could just figure out how to unlock his phone.

I ran this on Groqโ€™s LPUs (Llama-3). Because when a scammer asks for my OTP, the AI needs to generate five paragraphs of pure, unfiltered technological confusion in under 80 milliseconds.

2. The Extraction Trap: Regex & Background Tasks ๐Ÿ•ธ๏ธ
While the LLM is distracting them with questions about "where the 'any' key is," the real work happens in the background.

Every incoming message is parsed through deterministic Regex patterns. The moment the frustrated scammer drops a "secure" UPI ID (like scammer.fraud@fakebank) or a phone number to "call for help," the system silently intercepts it.

It then triggers a background FastAPI task to POST their structured threat data straight to a callback URL for the authorities. They think they are extracting my bank details, while I am literally JSON-serializing their identity.

3. The Backbone: FastAPI & Render โšก
Built on an async FastAPI event-loop, because wasting scammers' time should be highly concurrent and non-blocking.

But hereโ€™s the best part: Cloud APIs rate-limit you. Groq occasionally throws a 429 Too Many Requests. Instead of letting the server crash, I built a custom zero-retry fallback. If the LLM chokes, the API instantly catches the exception and returns:

"Oh dear, my internet seems slow. Can you say that again?"

It takes <0.08 seconds to execute, and it is a canonically perfect boomer response. Itโ€™s not a bug; itโ€™s a feature.

Is AI going to take our jobs? Maybe. But today, itโ€™s taking the jobs of scam victims.

If you want to spin up your own honeypot, check out the source code below. Feel free to fork it, add your own personas, and deploy it. Ruining a scammer's day should be open-source.

๐Ÿ‘พ Source Code:

Have you ever built something incredibly complex for an incredibly petty reason? Let me know in the comments. ๐Ÿ‘‡

Top comments (0)