Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25 July #1

Open
Gargee31 opened this issue Jul 25, 2024 · 0 comments
Open

25 July #1

Gargee31 opened this issue Jul 25, 2024 · 0 comments

Comments

@Gargee31
Copy link
Owner

import re
from collections import Counter

suspicious_phrases = [
"send me your password",
"what's your OTP",
"give me your account number",
"verify your social security number",
"transfer money",
"click on the link",
"urgent action required",
"confirm your identity",
"verify your details",
"update your account",
"security alert",
"sensitive information"
]

suspicious_keywords = [
"password", "OTP", "account number", "social security", "transfer",
"click", "link", "urgent", "verify", "confirm", "update", "security", "sensitive"
]

def extract_keywords(text):
words = re.findall(r'\b\w+\b', text.lower())
keywords = [word for word in words if word in suspicious_keywords]
return Counter(keywords)

def detect_suspicious_content(text):
alerts = []
for phrase in suspicious_phrases:
if phrase in text.lower():
alerts.append(f"Phrase match: {phrase}")

keyword_counts = extract_keywords(text)
if keyword_counts:
    for keyword, count in keyword_counts.items():
        if count > 1:  # Consider it suspicious if a keyword appears more than once
            alerts.append(f"Keyword match: {keyword} (count: {count})")

return alerts

def sentiment_analysis(text):
urgency_phrases = ["urgent", "immediately", "asap", "right away", "important", "do it now"]
coercion_phrases = ["must", "need", "have to", "required"]

urgent = any(phrase in text.lower() for phrase in urgency_phrases)
coercive = any(phrase in text.lower() for phrase in coercion_phrases)

sentiment_flags = []
if urgent:
    sentiment_flags.append("Urgency detected")
if coercive:
    sentiment_flags.append("Coercion detected")

return sentiment_flags

if name == "main":
# Simulated input text (In a real scenario, this would be the output from a speech-to-text system)
input_text = """
Hi, this is your bank calling. We need you to verify your account number.
Please send me your password to confirm your identity immediately.
This is urgent, and failure to comply will result in account suspension.
"""

# Detect suspicious content
suspicious_content = detect_suspicious_content(input_text)
sentiment_flags = sentiment_analysis(input_text)

if suspicious_content or sentiment_flags:
    print("Suspicious content detected:")
    for alert in suspicious_content:
        print(f"- {alert}")
    for flag in sentiment_flags:
        print(f"- {flag}")
else:
    print("No suspicious content detected.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant