Skip to content

Commit b83ceb5

Browse files
authored
Merge pull request #14 from GYFX35/feature/identity-usurpation-detection
feat: Add identity usurpation detection feature
2 parents 71026c6 + 58e3954 commit b83ceb5

File tree

6 files changed

+131
-4
lines changed

6 files changed

+131
-4
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

social_media_analyzer/fake_profile_detector.py

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,47 @@
196196
}
197197
]
198198

199+
# --- Identity Usurpation Indicators ---
200+
IDENTITY_USURPATION_INDICATORS = [
201+
{
202+
"id": "is_new_or_backup_account",
203+
"prompt": "Is the profile claiming to be a 'new' or 'backup' account for someone you already know?",
204+
"weight_if_yes": 3,
205+
"details_if_yes": "Scammers often create fake accounts claiming to have lost access to their old one."
206+
},
207+
{
208+
"id": "exact_match_of_known_profile",
209+
"prompt": "Does the profile use the exact same name and profile picture as an existing profile of someone you know?",
210+
"weight_if_yes": 3,
211+
"details_if_yes": "Directly cloning a profile is a major red flag for impersonation."
212+
},
213+
{
214+
"id": "unverified_new_account_claim",
215+
"prompt": "Have you verified with the person through a different, trusted communication method that this new profile is actually theirs?",
216+
"weight_if_no": 2, # Note: Weight is applied if the answer is 'no'
217+
"details_if_no": "If you haven't verified the new account, it's highly suspicious."
218+
},
219+
{
220+
"id": "inconsistent_behavior",
221+
"prompt": "Are there inconsistencies in writing style, language, or behavior compared to the person you know?",
222+
"weight_if_yes": 2,
223+
"details_if_yes": "A change in communication style can indicate a different person is behind the account."
224+
},
225+
{
226+
"id": "suspicious_friend_list",
227+
"prompt": "Does the friend list seem unusually small, or does it lack mutual friends you'd expect?",
228+
"weight_if_yes": 1,
229+
"details_if_yes": "Impersonation accounts often have hastily assembled or illogical friend lists."
230+
},
231+
{
232+
"id": "urgent_requests_for_money_or_info",
233+
"prompt": "Is the account making urgent requests for money, gift cards, or personal information, often citing an emergency?",
234+
"weight_if_yes": 3,
235+
"details_if_yes": "This is a classic scam tactic used by impersonators to exploit the trust of friends and family."
236+
}
237+
]
238+
239+
199240
def guide_reverse_image_search(image_url=None):
200241
"""Opens browser tabs to guide the user through reverse image search."""
201242
print("\n--- Guiding Reverse Image Search ---")
@@ -287,9 +328,87 @@ def analyze_profile_based_on_user_input(profile_url, platform):
287328
"positive_indicators": positive_indicators,
288329
}
289330

331+
332+
def analyze_identity_usurpation(profile_url, platform):
333+
"""
334+
Guides the user through a checklist to assess if a profile is impersonating someone.
335+
"""
336+
print(f"\n--- Analyzing {platform.capitalize()} Profile for Identity Usurpation (Manual Check) ---")
337+
print("This check is designed to help you determine if a profile is impersonating someone you know.")
338+
print(f"Please open the profile in your browser or app: {profile_url}")
339+
webbrowser.open(profile_url)
340+
341+
user_responses = {}
342+
total_score = 0
343+
positive_indicators = []
344+
345+
print("\nYou will now be asked a series of questions about the profile.")
346+
for indicator in IDENTITY_USURPATION_INDICATORS:
347+
while True:
348+
answer = input(f"{indicator['prompt']} (yes/no): ").strip().lower()
349+
if answer in ['yes', 'no']:
350+
user_responses[indicator['id']] = answer
351+
if answer == 'yes' and 'weight_if_yes' in indicator:
352+
total_score += indicator['weight_if_yes']
353+
positive_indicators.append(f"- {indicator['prompt']} ({indicator['details_if_yes']})")
354+
elif answer == 'no' and 'weight_if_no' in indicator:
355+
total_score += indicator['weight_if_no']
356+
positive_indicators.append(f"- (Unverified) {indicator['prompt']} ({indicator['details_if_no']})")
357+
break
358+
else:
359+
print("Invalid input. Please answer 'yes' or 'no'.")
360+
361+
print("\n--- Identity Usurpation Analysis Results ---")
362+
print(f"Profile URL: {profile_url}")
363+
364+
if not positive_indicators:
365+
print("Based on your answers, no strong indicators of identity usurpation were identified.")
366+
else:
367+
print("The following indicators suggestive of identity usurpation were noted:")
368+
for pi in positive_indicators:
369+
print(pi)
370+
371+
print(f"\nOverall 'impersonation suspicion score': {total_score}")
372+
if total_score <= 3:
373+
print("Assessment: Low likelihood of impersonation.")
374+
elif total_score <= 6:
375+
print("Assessment: Medium likelihood. Exercise extreme caution and verify independently.")
376+
else:
377+
print("Assessment: High likelihood. Avoid interaction and report the profile.")
378+
379+
print("\nDisclaimer: This analysis is based SOLELY on your manual observations.")
380+
print("Always use your best judgment. If you suspect impersonation, contact the person being impersonated through a trusted channel and report the fake profile to the platform.")
381+
382+
return {
383+
"profile_url": profile_url,
384+
"platform": platform,
385+
"score": total_score,
386+
"positive_indicators": positive_indicators,
387+
}
388+
389+
290390
if __name__ == '__main__':
291391
print("Fake Profile Detector - Manual Checklist Tool")
292-
test_platform = input("Enter the social media platform to simulate analyzing (e.g., instagram): ").strip().lower()
392+
393+
while True:
394+
print("\nSelect the type of analysis to perform:")
395+
print("1. General Fake Profile Analysis")
396+
print("2. Identity Usurpation Analysis")
397+
398+
try:
399+
choice = int(input("Enter your choice (1-2): "))
400+
if choice in [1, 2]:
401+
break
402+
else:
403+
print("Invalid choice. Please try again.")
404+
except ValueError:
405+
print("Invalid input. Please enter a number.")
406+
407+
test_platform = input("\nEnter the social media platform to simulate analyzing (e.g., instagram): ").strip().lower()
293408
test_profile_url = input(f"Enter a {test_platform.capitalize()} profile URL to simulate analyzing: ").strip()
409+
294410
if test_profile_url and test_platform:
295-
analyze_profile_based_on_user_input(test_profile_url, test_platform)
411+
if choice == 1:
412+
analyze_profile_based_on_user_input(test_profile_url, test_platform)
413+
elif choice == 2:
414+
analyze_identity_usurpation(test_profile_url, test_platform)

social_media_analyzer/main.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ def main():
4040
while True:
4141
print(f"\nWhat do you want to do for {platform.capitalize()}?")
4242
print("1. Analyze a profile for signs of being fake.")
43-
print("2. Analyze a message for phishing or scam attempts.")
43+
print("2. Analyze a profile for identity usurpation.")
44+
print("3. Analyze a message for phishing or scam attempts.")
4445

4546
try:
46-
analysis_choice = int(input("Enter your choice (1-2): "))
47+
analysis_choice = int(input("Enter your choice (1-3): "))
4748
if analysis_choice == 1:
4849
profile_url = input(f"Enter the {platform.capitalize()} profile URL to analyze: ").strip()
4950
if profile_url:
@@ -52,6 +53,13 @@ def main():
5253
print("No profile URL entered.")
5354
break
5455
elif analysis_choice == 2:
56+
profile_url = input(f"Enter the {platform.capitalize()} profile URL to analyze for impersonation: ").strip()
57+
if profile_url:
58+
fake_profile_detector.analyze_identity_usurpation(profile_url, platform)
59+
else:
60+
print("No profile URL entered.")
61+
break
62+
elif analysis_choice == 3:
5563
message = input("Paste the message you want to analyze: ").strip()
5664
if message:
5765
result = scam_detector.analyze_text_for_scams(message, platform)

0 commit comments

Comments
 (0)