|
|
| import re |
|
|
| def is_spam(message: str) -> bool: |
| |
| spam_keywords = ["์ํ๊ฐ", "์๋ดํ๊ธฐ", "์ ์ค์๋ฃ", "์ค๋ฒ๊ฐ์์ธ", "๋ณด์ ํ๊ฒ ์ต๋๋ค", "๋ถ์,์๋ด,์ง๋จ", "๊ฐ๊ตฌ๋ฆฌํต์ฌ์ ๋ณด", |
| "ํด๋ฆญ๋ฅ ", "ํ์ ", "๋ชจ๋ฐ์ผ์๋น์ค ์ด์ฉ์ค์ง", "10๋ถ ์ธ", "์ถ์ฒจ", "์ฃผ์๋น๊ฒฐ", "๋ฌด์", "์ ๊ท์ ๋ณด", "๊ฑฐ๋๋ ํญ๋ฑ", "์ฆ ๊ถ", "์ ๋ต ๋ง๊ฐ์๋ฐ", "์ง์ ํ๋จํ์ธ์", "์์ต๋ฅ ", "์ฐ ๊ธ"] |
|
|
| for keyword in spam_keywords: |
| if keyword in message: |
| return True |
|
|
| |
| url_pattern = r'https?://[^\s]+' |
| urls = re.findall(url_pattern, message) |
|
|
| for url in urls: |
| suspicious_formats = ["me2.kr", "bit.ly", "openkakao", "buly.kr", "vo.la", "ko.gl", "opcn-kakao.com", "me.shinhan", "me2.kr", "openkakao.at"] |
| for format in suspicious_formats: |
| if format in url: |
| return True |
|
|
| |
| special_chars = ["+", "*", "#", "%", "$", "@", "&"] |
| special_char_count = sum([message.count(char) for char in special_chars]) |
| if special_char_count >= 3: |
| return True |
|
|
| return False |
|
|