[SHEHZADE//ABDULLAH ANSARI]
Red Team Consultant @ Google | MS in Cybersecurity @ NYU
● Notice //GitHub (@shehzade) is temporarily suspended pending an automated false-positive review. All tools are hosted on this Code Mirror and available on request (contact); GitHub links will return once reinstated.
PUBLIC MIRRORPython
AI-driven badge OSINT, credential harvesting, and calibrated CR80 card cloning for physical red teams.
$
git clone https://shehzade.io/repos/lanyard.git
Copy
Source ZIP (1.35 MB)
33 lines · 2.8 KB
| 1 | from abc import ABC, abstractmethod |
| 2 | |
| 3 | from lanyard.vision.models import BadgeFinding |
| 4 | |
| 5 | DETECTOR_PROMPT = """Analyze this image with high scrutiny for physical security, social engineering, and red team OSINT assessment. |
| 6 | Your objective is to identify REAL, PHYSICAL employee identification badges, physical access control cards (HID/RFID/iCLASS/prox cards), security passes, visitor credentials, or corporate access cards worn by individuals or placed on surfaces. |
| 7 | |
| 8 | CRITICAL INSTRUCTIONS TO ELIMINATE FALSE POSITIVES: |
| 9 | 1. PHYSICAL BADGES ONLY: Do NOT flag generic digital illustrations, clipart, mockups, infographics, stock icons, cartoon drawings (e.g. Acme/Coyote), or abstract badge templates. If it is an illustration/graphic and NOT a photograph of a real physical badge/card, set has_badge = false and confidence = 0.0. |
| 10 | 2. DISTANCE AND RESOLUTION: Do NOT flag people where a tiny blur or lanyard string is visible far away in the background or crowd where NO card face details or badge outline can actually be distinguished. |
| 11 | 3. CONFERENCES/EVENTS: Only flag real employee/contractor corporate access badges, or company-issued visitor credentials. Do NOT flag generic paper conference attendee name tags (e.g. TED, IEEE, generic trade shows) unless they are official corporate-issued access credentials. |
| 12 | |
| 13 | If a REAL physical ID badge or access pass is visible: |
| 14 | 1. Set has_badge = true and provide an accurate confidence (0.0 to 1.0). |
| 15 | 2. Classify badge_type: 'employee', 'contractor', 'visitor', 'access_card', 'parking_pass'. |
| 16 | 3. Provide tight bounding box coordinates (ymin, xmin, ymax, xmax) normalized to a 0-1000 scale enclosing the badge and its immediate clip/holder. |
| 17 | 4. Provide card_corners: pinpoint the exact 4 outer corners of the rectangular card face itself (top_left, top_right, bottom_right, bottom_left) in upright card reading orientation (where the company header/logo is at the top), excluding any lanyard clip, lanyard strap, lanyard reel, badge holder tabs, or fingers holding the card. |
| 18 | 5. Perform OCR on any legible text on the card: employee name, company name, department/role, badge ID/number. |
| 19 | 6. Identify any visible physical security features: rfid_chip, smart_chip, magstripe, barcode, qr_code, photo, hologram, branded_lanyard. |
| 20 | 7. Provide a concise technical summary of the findings. |
| 21 | |
| 22 | If NO real physical badge is visible in the image, set has_badge = false and confidence = 0.0 with bounding_box = null and card_corners = null.""" |
| 23 | |
| 24 | |
| 25 | class BaseVisionProvider(ABC): |
| 26 | def __init__(self, model_name: str, api_key: str = "", api_base: str = ""): |
| 27 | self.model_name = model_name |
| 28 | self.api_key = api_key |
| 29 | self.api_base = api_base |
| 30 | |
| 31 | @abstractmethod |
| 32 | def analyze_image(self, image_bytes: bytes, mime_type: str = "image/jpeg") -> BadgeFinding: |
| 33 | """Analyze an image and extract structured badge finding.""" |