Jump to content

We get spam and we have a question.


Go to solution Solved by gizmola,

Recommended Posts

We have a chat platform and one person is constantly spamming the same number, however, adding the number and thus bypassing the filter system.
Example:
 

0 ## 7 ## 17 ## 88 ## 78 ## 12
0 "" "" 7 "" "" 1 "" "" "7887" "" 812


Is there any way to check, for example with preg_match or Normalizer, if the string contains exactly these 10 digits and any other symbols in the string are removed?
Thanks.

Link to comment
Share on other sites

Sure, but that won't stop anything - they'll just find a way around it, or do something else.

The only solution to spam that actually has any effect is adding a captcha to the form. That's for bots, of course.
For human beings, you'll just have to block them.

Link to comment
Share on other sites

  • Solution

I worked on a similar problem for a company some years back.  It was also a chat system, and every chat message was filtered for a variety of personal information disclosure.  This problem of people trying to get around these filters is difficult.  When they are already putting in a bunch of whitespace and other characters to obfuscate (some of which are valid) is annoying.  

What I implemented was a chain of filters that would do take the original text and then strip out all the extra characters.

In your case, this would not be too difficult, given that you are looking to blacklist a phone #.

So:

  • Generate a version of the message that has removed any characters that are not 0-9, or A-Z
  • Convert newlines to something known
  • Remove all whitespace (tabs and spaces)
  • convert newline "something known" string or non-printable character back into newline
  • use regex to find phone # sequences
    • This should be farily simple, since you can use character classes and match [0-9]{9,12}
    • From this list of numbers see if you can get a full match against any of these number sequences.

Hopefully you get the idea.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.