• ODT Gun Show & Swap Meet - May 4, 2024! - Click here for info

No Scammers

Hi Everyone,

I just wanted to have a chat about "scammers" and hear suggestions/comments on what we can do to better combat them and keep folks from getting scammed.

I have a couple ideas, I'll start a little list and add anything that sounds promising.

- Thread or Forum where people can post the types of scams they are seeing
- Voting system where if a listing gets X amount of votes it gets pulled as a scam or spam. I can't allow the entire community to have this power or it would get abused, but maybe I could make it a lifetime supporter benefit or something. (We used to have a "Good Deal!" feature where everyone could vote on listings they considered a good deal, but it got abused and was used more ironically than anything, promoting more terrible deals than good ones.) (Side thought, a terrible deal feature could work as well. We could have "Today's Worst Deal" )

Things to look out for so far:
- Do not send money to anyone unless you are 100% sure of who they are. Check feedback, check posts, etc.
Maybe a referral option? Run it by another seasoned user? Don't think everyone would trust a potential good deal to a random other user though, if it were indeed real.
 
  1. Set up the database: Create a MySQL database and tables to store forum data. Typically, you would have a table for forum posts or comments, which includes columns like "id," "content," "user_id," and "is_spam."
  2. Collect training data: Gather a dataset of labeled examples where each forum post/comment is marked as either spam or not spam. This dataset will be used to train the Bayesian inference model.
  3. Preprocess the data: Clean and preprocess the forum post/comment data by removing any HTML tags, special characters, and converting everything to lowercase. You can use regular expressions or string manipulation functions for this purpose.
  4. Train the Bayesian inference model: Implement the Naive Bayes algorithm using your preferred programming language (such as Python). The Naive Bayes classifier assumes that the presence of a particular feature is independent of the presence of other features, which makes it suitable for text classification tasks.
    a. Calculate the prior probabilities: Calculate the prior probabilities of spam and non-spam posts/comments in your training dataset. This involves counting the number of spam and non-spam instances and dividing them by the total number of examples.
    b. Build the vocabulary: Create a vocabulary of unique words by extracting all the words from the training dataset. You can use techniques like tokenization or splitting the text on whitespace to obtain individual words.
    c. Calculate conditional probabilities: Calculate the conditional probabilities of each word occurring given that the post/comment is spam or non-spam. This involves counting the occurrences of each word in spam and non-spam posts/comments and dividing them by the respective totals.
  5. Store the trained model: Store the trained model parameters (prior probabilities, vocabulary, and conditional probabilities) in the database for future use.
  6. Detect spam: When a new forum post/comment is submitted, retrieve the trained model parameters from the database. Preprocess the content of the new post/comment, as done in step 3.
  7. Apply Bayesian inference: Calculate the posterior probability of the post/comment being spam or non-spam using the Naive Bayes algorithm. Multiply the prior probabilities with the conditional probabilities of the words present in the new post/comment to obtain the likelihoods. Finally, normalize the likelihoods and compare them to determine if the post/comment should be classified as spam or not.
  8. Mark as spam: Update the "is_spam" column in the corresponding database table to mark the post/comment as spam if it exceeds a certain threshold probability. You can choose a threshold based on experimentation and adjusting the balance between false positives and false negatives.
  9. Implement feedback loop: Periodically review and update the spam detection system based on feedback from moderators or users who report false positives or false negatives. Adjust the model parameters and retrain the model using new labeled data to improve its accuracy over time.

Code to do this:
 
import mysql.connector
import re
from collections import defaultdict

# Database connection configuration
db_config = {
'host': 'localhost',
'user': 'your_username',
'password': 'your_password',
'database': 'your_database'
}

# Preprocessing function
def preprocess_text(text):
# Remove HTML tags
clean_text = re.sub('<.*?>', '', text)
# Remove special characters and convert to lowercase
clean_text = re.sub('[^\w\s]', '', clean_text).lower()
return clean_text

# Naive Bayes spam detector class
class SpamDetector:
def __init__(self):
self.prior_spam = 0
self.prior_not_spam = 0
self.word_spam_counts = defaultdict(int)
self.word_not_spam_counts = defaultdict(int)
self.vocab = set()

def train(self, conn):
cursor = conn.cursor()
# Retrieve training data from the database
cursor.execute("SELECT content, is_spam FROM forum_posts")
posts = cursor.fetchall()

total_spam = 0
total_not_spam = 0

for post in posts:
content = preprocess_text(post[0])
is_spam = post[1]

# Update counts and vocabulary
for word in content.split():
if is_spam:
self.word_spam_counts[word] += 1
total_spam += 1
else:
self.word_not_spam_counts[word] += 1
total_not_spam += 1
self.vocab.add(word)

# Calculate prior probabilities
num_posts = len(posts)
self.prior_spam = total_spam / num_posts
self.prior_not_spam = total_not_spam / num_posts

# Calculate conditional probabilities
for word in self.vocab:
self.word_spam_counts[word] = (self.word_spam_counts[word] + 1) / (total_spam + len(self.vocab))
self.word_not_spam_counts[word] = (self.word_not_spam_counts[word] + 1) / (total_not_spam + len(self.vocab))

def classify(self, text):
clean_text = preprocess_text(text)
words = clean_text.split()

spam_prob = self.prior_spam
not_spam_prob = self.prior_not_spam

for word in words:
if word in self.vocab:
spam_prob *= self.word_spam_counts[word]
not_spam_prob *= self.word_not_spam_counts[word]

# Normalize probabilities
total_prob = spam_prob + not_spam_prob
spam_prob /= total_prob
not_spam_prob /= total_prob

return spam_prob > not_spam_prob

def mark_as_spam(self, conn, post_id):
cursor = conn.cursor()
cursor.execute("UPDATE forum_posts SET is_spam = 1 WHERE id = %s", (post_id,))
conn.commit()


# Main function
def main():
# Connect to the database
conn = mysql.connector.connect(**db_config)

# Initialize and train the spam detector
detector = SpamDetector()
detector.train(conn)

# Get new forum post
new_post = input("Enter a new forum post: ")

# Classify and mark as spam if necessary
if detector.classify(new_post):
post_id = input("Enter the ID of the post to mark as spam: ")
detector.mark_as_spam(conn, post_id)
print("Post marked as spam.")
else:
print("Post is not spam.")

# Close the database connection
conn.close()


if __name__ == '__main__':
main()
 
They are similar to most ads, as they are usually copied from another ad.
Find some that way by doing Google searches, but they have learned to just change a word or two and use different pictures.

In the PMs they are quite distinctive and it simply amazes me that there are people still falling for them.
Good grief: just look the hoaxes that 90%+ of the nation falls for every day.....
 
It would help the membership to have a "read only" thread that lists actual busted scams from this site.
Admins could post details of how the scam worked (or was supposed to work) and key words or phrases from said scam to be on the look out for in the future...
Knowledge is power....
 
import mysql.connector
import re
from collections import defaultdict

# Database connection configuration
db_config = {
'host': 'localhost',
'user': 'your_username',
'password': 'your_password',
'database': 'your_database'
}

# Preprocessing function
def preprocess_text(text):
# Remove HTML tags
clean_text = re.sub('<.*?>', '', text)
# Remove special characters and convert to lowercase
clean_text = re.sub('[^\w\s]', '', clean_text).lower()
return clean_text

# Naive Bayes spam detector class
class SpamDetector:
def __init__(self):
self.prior_spam = 0
self.prior_not_spam = 0
self.word_spam_counts = defaultdict(int)
self.word_not_spam_counts = defaultdict(int)
self.vocab = set()

def train(self, conn):
cursor = conn.cursor()
# Retrieve training data from the database
cursor.execute("SELECT content, is_spam FROM forum_posts")
posts = cursor.fetchall()

total_spam = 0
total_not_spam = 0

for post in posts:
content = preprocess_text(post[0])
is_spam = post[1]

# Update counts and vocabulary
for word in content.split():
if is_spam:
self.word_spam_counts[word] += 1
total_spam += 1
else:
self.word_not_spam_counts[word] += 1
total_not_spam += 1
self.vocab.add(word)

# Calculate prior probabilities
num_posts = len(posts)
self.prior_spam = total_spam / num_posts
self.prior_not_spam = total_not_spam / num_posts

# Calculate conditional probabilities
for word in self.vocab:
self.word_spam_counts[word] = (self.word_spam_counts[word] + 1) / (total_spam + len(self.vocab))
self.word_not_spam_counts[word] = (self.word_not_spam_counts[word] + 1) / (total_not_spam + len(self.vocab))

def classify(self, text):
clean_text = preprocess_text(text)
words = clean_text.split()

spam_prob = self.prior_spam
not_spam_prob = self.prior_not_spam

for word in words:
if word in self.vocab:
spam_prob *= self.word_spam_counts[word]
not_spam_prob *= self.word_not_spam_counts[word]

# Normalize probabilities
total_prob = spam_prob + not_spam_prob
spam_prob /= total_prob
not_spam_prob /= total_prob

return spam_prob > not_spam_prob

def mark_as_spam(self, conn, post_id):
cursor = conn.cursor()
cursor.execute("UPDATE forum_posts SET is_spam = 1 WHERE id = %s", (post_id,))
conn.commit()


# Main function
def main():
# Connect to the database
conn = mysql.connector.connect(**db_config)

# Initialize and train the spam detector
detector = SpamDetector()
detector.train(conn)

# Get new forum post
new_post = input("Enter a new forum post: ")

# Classify and mark as spam if necessary
if detector.classify(new_post):
post_id = input("Enter the ID of the post to mark as spam: ")
detector.mark_as_spam(conn, post_id)
print("Post marked as spam.")
else:
print("Post is not spam.")

# Close the database connection
conn.close()


if __name__ == '__main__':
main()
All well and good I suppose. However, why not just use your head and think it through while you still can.
 
It would be interesting to know the "characteristics" of a scammer

  1. Always a newbie?
  2. Always no face to face deal?
  3. Supporter or freebie?
  4. Any feedback or always zero?
  5. Responding to a listing, created a listing or out of the blue DM?

I am sure there are more possible warning signs one might look for.
 
Back
Top Bottom