Skip to content

Commit 34147d1

Browse files
feat: Initial setup for social_platform and openpage app
Initializes the Django project `social_platform` and the core app `openpage`. Features included: - `openpage` app for creating posts with AI-generated images. - `Post` model with fields for user, prompt, AI-generated image, caption, and timestamps. - Integration with OpenAI's DALL-E API for image generation (via `openpage.services.generate_image_from_prompt`). - Django Forms (`PostForm`) for post creation. - Views for creating, listing, and detailing posts (`create_post_view`, `post_list_view`, `post_detail_view`). - Basic HTML templates for these views, extending a common `base.html`. - URL configurations for the app and project, including media file serving in development. - Django admin interface for `Post` model with customizations for display and filtering. - Basic user authentication relies on Django admin login/logout. - Comprehensive unit and integration tests for models, services (mocking external API), views, and forms. - `social_platform_requirements.txt` for project dependencies (Django, Pillow, openai, requests). - Configuration for `MEDIA_ROOT`, `MEDIA_URL`, `LOGIN_URL`, and placeholder for `OPENAI_API_KEY` (loaded from environment).
1 parent 2529c7a commit 34147d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1889
-497
lines changed

db.sqlite3

136 KB
Binary file not shown.

facebook_analyzer/fake_profile_detector.py

Lines changed: 77 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,77 +13,80 @@
1313
"prompt": "Is the profile picture generic, a stock photo, an illustration, or of a celebrity (i.e., not a clear photo of a unique, real person)?",
1414
"type": "yes_no",
1515
"weight_if_yes": 2,
16-
"details_if_yes": "Generic or stolen profile pictures are common for fake accounts."
16+
"details_if_yes": "Generic or stolen profile pictures are common for fake accounts.",
1717
},
1818
{
1919
"id": "profile_picture_reverse_search",
2020
"prompt": "Have you tried a reverse image search (e.g., Google Images, TinEye) on the profile picture? If so, did it show the image is widely used, a stock photo, or belongs to someone else?",
2121
"type": "yes_no",
2222
"weight_if_yes": 3,
23-
"details_if_yes": "Reverse image search can often quickly identify stolen or common stock photos."
23+
"details_if_yes": "Reverse image search can often quickly identify stolen or common stock photos.",
2424
},
2525
{
2626
"id": "account_age_very_new",
2727
"prompt": "Does the profile seem very new with little history (e.g., join date is recent, few old posts)? (Requires manual check on the profile)",
2828
"type": "yes_no",
2929
"weight_if_yes": 1,
30-
"details_if_yes": "While not definitive, many fake accounts are newly created."
30+
"details_if_yes": "While not definitive, many fake accounts are newly created.",
3131
},
3232
{
3333
"id": "few_posts_or_activity",
3434
"prompt": "Does the profile have very few posts, photos, or other activity over its lifespan? (Requires manual check)",
3535
"type": "yes_no",
3636
"weight_if_yes": 1,
37-
"details_if_yes": "Lack of genuine activity can be a sign."
37+
"details_if_yes": "Lack of genuine activity can be a sign.",
3838
},
3939
{
4040
"id": "generic_or_copied_posts",
4141
"prompt": "Are the posts (if any) generic, nonsensical, repetitive, or seem copied from other sources? (Requires manual check)",
4242
"type": "yes_no",
4343
"weight_if_yes": 2,
44-
"details_if_yes": "Content that isn't original or personal is suspicious."
44+
"details_if_yes": "Content that isn't original or personal is suspicious.",
4545
},
4646
{
4747
"id": "friend_count_mismatch",
4848
"prompt": "Does the profile have a very high number of friends but very little engagement (likes/comments) on their posts, or an unusually low number of friends for a long-standing account? (Requires manual check)",
4949
"type": "yes_no",
5050
"weight_if_yes": 1,
51-
"details_if_yes": "Unusual friend counts or activity ratios can be indicators."
51+
"details_if_yes": "Unusual friend counts or activity ratios can be indicators.",
5252
},
5353
{
5454
"id": "poor_grammar_spelling",
5555
"prompt": "Is the language used in the profile's 'About' section or posts consistently poor in grammar or spelling (beyond typical typos)? (Requires manual check)",
5656
"type": "yes_no",
5757
"weight_if_yes": 1,
58-
"details_if_yes": "Often, hastily created fake profiles have noticeable language issues."
58+
"details_if_yes": "Often, hastily created fake profiles have noticeable language issues.",
5959
},
6060
{
6161
"id": "about_section_sparse_or_inconsistent",
6262
"prompt": "Is the 'About' section very sparse, missing key information (like education, work), or contains information that seems inconsistent or overly glamorous/fake? (Requires manual check)",
6363
"type": "yes_no",
6464
"weight_if_yes": 2,
65-
"details_if_yes": "Incomplete or suspicious 'About' information is a red flag."
65+
"details_if_yes": "Incomplete or suspicious 'About' information is a red flag.",
6666
},
6767
{
6868
"id": "mutual_friends_suspicious",
6969
"prompt": "If you have mutual friends, do those mutual connections seem legitimate or are they also suspicious-looking profiles?",
7070
"type": "yes_no",
7171
"weight_if_yes": 1,
72-
"details_if_yes": "Fake accounts often connect with other fake accounts."
72+
"details_if_yes": "Fake accounts often connect with other fake accounts.",
7373
},
7474
{
7575
"id": "pressure_or_strange_requests",
7676
"prompt": "Has this profile sent you messages that pressure you for information, money, or to click suspicious links shortly after connecting?",
7777
"type": "yes_no",
7878
"weight_if_yes": 3,
79-
"details_if_yes": "This is a strong indicator of a malicious fake account."
80-
}
79+
"details_if_yes": "This is a strong indicator of a malicious fake account.",
80+
},
8181
]
8282

83+
8384
def guide_reverse_image_search(image_url=None):
8485
"""Opens browser tabs to guide the user through reverse image search."""
8586
print("\n--- Guiding Reverse Image Search ---")
86-
print("You can use services like Google Images or TinEye to check if a profile picture is used elsewhere.")
87+
print(
88+
"You can use services like Google Images or TinEye to check if a profile picture is used elsewhere."
89+
)
8790
if image_url:
8891
print(f"If you have a direct URL for the image: {image_url}")
8992
google_url = f"https://images.google.com/searchbyimage?image_url={image_url}"
@@ -98,7 +101,9 @@ def guide_reverse_image_search(image_url=None):
98101
webbrowser.open("https://images.google.com/")
99102
print("TinEye: https://tineye.com/")
100103
webbrowser.open("https://tineye.com/")
101-
print("Look for whether the image is a common stock photo, belongs to a different person, or appears on many unrelated profiles.")
104+
print(
105+
"Look for whether the image is a common stock photo, belongs to a different person, or appears on many unrelated profiles."
106+
)
102107
input("Press Enter to continue after performing your search...")
103108

104109

@@ -111,32 +116,45 @@ def analyze_profile_based_on_user_input(profile_url):
111116
print(f"Please open the Facebook profile in your browser: {profile_url}")
112117
print("You will be asked a series of questions based on your observations.")
113118
print("This tool does NOT access Facebook directly or scrape any data.")
114-
webbrowser.open(profile_url) # Open for user convenience
119+
webbrowser.open(profile_url) # Open for user convenience
115120

116121
user_responses = {}
117122
total_score = 0
118123
positive_indicators = []
119124

120125
# Ask about reverse image search first
121-
perform_ris = input("Do you want guidance to perform a reverse image search on the profile picture? (yes/no): ").strip().lower()
122-
if perform_ris == 'yes':
123-
img_url_known = input("Do you have a direct URL for the profile image? (yes/no): ").strip().lower()
124-
if img_url_known == 'yes':
126+
perform_ris = (
127+
input(
128+
"Do you want guidance to perform a reverse image search on the profile picture? (yes/no): "
129+
)
130+
.strip()
131+
.lower()
132+
)
133+
if perform_ris == "yes":
134+
img_url_known = (
135+
input("Do you have a direct URL for the profile image? (yes/no): ")
136+
.strip()
137+
.lower()
138+
)
139+
if img_url_known == "yes":
125140
actual_img_url = input("Please paste the direct image URL: ").strip()
126141
guide_reverse_image_search(actual_img_url)
127142
else:
128143
guide_reverse_image_search()
129-
print("Now, let's answer the question about the reverse image search based on your findings.")
130-
144+
print(
145+
"Now, let's answer the question about the reverse image search based on your findings."
146+
)
131147

132148
for indicator in FAKE_PROFILE_INDICATORS:
133149
while True:
134150
answer = input(f"{indicator['prompt']} (yes/no): ").strip().lower()
135-
if answer in ['yes', 'no']:
136-
user_responses[indicator['id']] = answer
137-
if answer == 'yes':
138-
total_score += indicator['weight_if_yes']
139-
positive_indicators.append(f"- {indicator['prompt']} ({indicator['details_if_yes']})")
151+
if answer in ["yes", "no"]:
152+
user_responses[indicator["id"]] = answer
153+
if answer == "yes":
154+
total_score += indicator["weight_if_yes"]
155+
positive_indicators.append(
156+
f"- {indicator['prompt']} ({indicator['details_if_yes']})"
157+
)
140158
break
141159
else:
142160
print("Invalid input. Please answer 'yes' or 'no'.")
@@ -145,39 +163,58 @@ def analyze_profile_based_on_user_input(profile_url):
145163
print(f"Profile URL: {profile_url}")
146164

147165
if not positive_indicators:
148-
print("Based on your answers, no common fake profile indicators were strongly identified.")
166+
print(
167+
"Based on your answers, no common fake profile indicators were strongly identified."
168+
)
149169
print("However, always remain cautious.")
150170
else:
151-
print("The following indicators suggestive of a fake profile were noted based on your input:")
171+
print(
172+
"The following indicators suggestive of a fake profile were noted based on your input:"
173+
)
152174
for pi in positive_indicators:
153175
print(pi)
154176

155177
print(f"\nOverall 'suspicion score': {total_score}")
156178
if total_score == 0:
157-
print("Assessment: No strong indicators noted from your input.")
179+
print("Assessment: No strong indicators noted from your input.")
158180
elif total_score <= 3:
159-
print("Assessment: Low likelihood of being fake based on your input, but remain cautious.")
181+
print(
182+
"Assessment: Low likelihood of being fake based on your input, but remain cautious."
183+
)
160184
elif total_score <= 6:
161-
print("Assessment: Medium likelihood. Some indicators suggest this profile could be fake. Exercise caution.")
185+
print(
186+
"Assessment: Medium likelihood. Some indicators suggest this profile could be fake. Exercise caution."
187+
)
162188
elif total_score <= 9:
163-
print("Assessment: High likelihood. Several indicators suggest this profile may be fake. High caution advised.")
189+
print(
190+
"Assessment: High likelihood. Several indicators suggest this profile may be fake. High caution advised."
191+
)
164192
else:
165-
print("Assessment: Very high likelihood. Many strong indicators suggest this profile is likely fake. Avoid interaction and consider reporting.")
193+
print(
194+
"Assessment: Very high likelihood. Many strong indicators suggest this profile is likely fake. Avoid interaction and consider reporting."
195+
)
166196

167197
print("\nDisclaimer:")
168-
print("This analysis is based SOLELY on your manual observations and answers to the checklist.")
169-
print("It is not a definitive judgment. False positives and negatives are possible.")
198+
print(
199+
"This analysis is based SOLELY on your manual observations and answers to the checklist."
200+
)
201+
print(
202+
"It is not a definitive judgment. False positives and negatives are possible."
203+
)
170204
print("Always use your best judgment when interacting with profiles online.")
171-
print("If you suspect a profile is fake and malicious, consider reporting it to Facebook through their official channels.")
205+
print(
206+
"If you suspect a profile is fake and malicious, consider reporting it to Facebook through their official channels."
207+
)
172208

173209
return {
174210
"profile_url": profile_url,
175211
"score": total_score,
176212
"positive_indicators_details": positive_indicators,
177-
"user_responses": user_responses
213+
"user_responses": user_responses,
178214
}
179215

180-
if __name__ == '__main__':
216+
217+
if __name__ == "__main__":
181218
print("Fake Profile Detector - Manual Checklist Tool")
182219
print("IMPORTANT: This tool does NOT access Facebook or scrape data.")
183220
print("It guides YOU to manually check a profile and answer questions.")
@@ -187,7 +224,9 @@ def analyze_profile_based_on_user_input(profile_url):
187224
# First, ensure the user is aware of the process for reverse image search, as it's a common first step.
188225
# For the test, we'll simulate this.
189226

190-
test_profile_url = input("Enter a Facebook profile URL to simulate analyzing (e.g., https://www.facebook.com/some.profile): ").strip()
227+
test_profile_url = input(
228+
"Enter a Facebook profile URL to simulate analyzing (e.g., https://www.facebook.com/some.profile): "
229+
).strip()
191230
if not test_profile_url:
192231
print("No URL entered, exiting.")
193232
else:

0 commit comments

Comments
 (0)