Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
banned-words-detector
Advanced tools
Detect if input string contains banned words.
Detector does not use any dependencies. 0 dependencies.
In this time, detector worked for only English language.
Test results shows that the detector in 95% cases detects banned words.
The detector takes these steps
more fruits
→ ["more", "fruits"]
)ë
→e
)ɽ
→r
)fffrrruuit
→fruit
)[a-zA-Z]
(fru6it
→fruit
)If the result to all the above mentioned points is false, then convert diacritics from string to latin characters, remove from string all characters except letters and check is banned words includes on a string
You can use detector with default banned words list, calling constructor with { addDefaultWords: true }
default value is false
.
import BannedWords from "banned-words-detector";
const bannedWordsService = new BannedWords({addDefaultWords: true});
or
const BannedWords = require("banned-words-detector");
const bannedWordsService = new BannedWords({addDefaultWords:false})
You can add your banned words. Also, you can add a normal word to normalWordsList, for pass that words, if soundex code of that normal word is equal to any banned word code
bannedWordsService.addWord("apple");
bannedWordsService.addNormalWordForPass("lemon");
You can get banned words list, or print defaults or lists added by yourself for test
bannedWordsService.getWords(); // out: → ["apple"]
bannedWordsService.printDefaultBannedWordsList();
bannedWordsService.printBannedWordsWithCodes();
bannedWordsService.printDefaultNormalWords();
bannedWordsService.printNormalWordsList();
And finally check if string contains banned word. Or get banned words from string
bannedWordsService.isContainsBanned("example fruit apple");
bannedWordsService.getBannedWordsFromString("example fruit appppllle") // out: → ["apple"]
const badWordDetector = new BadWordDetector(badWordList);
import BannedWords from "banned-words-detector";
const bannedWordsService = new BannedWords({addDefaultWords: true});
bannedWordsService.addWord("apple");
bannedWordsService.isContainsBanned("example fruit apple"); → true
bannedWordsService.isContainsBanned("example fruit aaaapple3"); → true
bannedWordsService.isContainsBanned("example fruit app𝐥𝕖"); → true
bannedWordsService.isContainsBanned("example fruit a=🅿=🅿=𝐥=𝕖"); → true
During the test, at first added 2700+ words to banned list, then did the test on a string which contained 5000+ words. Detected 1700+ banned words in string. Here is the result
farmer, → former
the → they
Indiana.) → indian
River. → river
company. → company
“live, → love
Meanwhile, → meanwhile
favour → favor
began → begin
examination, → examination
The → they
capital, → capital
John → join
finally, → finaly
business, → busines
annually, → anual
busy, → busy
not → note
set → swet
another. → another
property, → property
Bridge, → bridge
span → spin
River, → river
patent → patient
moon, → mon
killing. → kiling
clearly, → clearly
fond → fund
company, → company
apart, → apart
show. → show
House. → house
last, → lost
officially → oficial
seeing → swing
prod → proud
together, → together
president, → president
Democrat, → democrat
another, → another
“spot → spot
soil. → soul
meanwhile, → meanwhile
district. → district
politics, → politics
career. → carier
order. → order
men → mon
tall, → tol
speeches, → species
however, → however
campaign. → campaign
argument. → argument
stand. → stand
free.” → fre
“all → aly
all → aly
other.” → other
citizen, → citizen
Black, → block
free, → fre
states” → status
condition.” → condition
founding → funding
fact, → fast
not, → note
office, → ofice
people.” → people
drove → drive
“popular → popular
constitutionally → constitutional
organization. → organization
alone. → alone
Campaign, → campaign
Pope, → pipe
again, → again
turn. → turn
gave → give
unity → unit
army, → army
man → mon
member, → member
himself, → himself
staff. → stuf
strong. → strong
enemy. → enemy
quota → quote
intent, → intend
sold → solid
manufacturer, → manufacturer
design. → design
work. → works
together; → together
specially → special
country. → country
later, → leter
engine, → engine
co-operation → coperation
Germany → german
initially. → initialy
Interest, → interest
design, → design
application, → aplication
States → status
Patent → patient
States. → status
Marc → mark
Mills, → milk
result, → result
came → come
(from → from
successful, → sucesfuly
became → become
enough, → enough
change, → change
example, → example
roof, → rof
common. → comon
Cole, → col
manage: → manage
Depression, → depresion
left. → lift
happen. → hapen
instance, → instance
gone → gene
under. → under
Hurtu, → hurt
(Tree → true
Germany, → german
market. → market
(such → such
future. → future
change. → change
feet → fot
lever → lover
complex. → complex
entertainment. → entertainment
open, → open
massage → mesage
night; → night
driver; → driver
safer → sufer
perspective, → perspective
performance, → performance
performance. → performance
seven, → seven
hand, → hand
include, → include
pollution,[67] → polution
electricity. → electricity
efficient, → eficient
drive. → drive
justice.[1] → justice
suffer, → sufer
tradition, → tradition
widely, → widely
(among → among
food, → fot
pressure, → presure
concentration. → concentration
all, → aly
Furthermore, → furthermore
exposure, → exposure
smoke,[125] → smoke
smoke,[126] → smoke
including; → including
cancer.[129] → cancer
cancer. → cancer
heavy, → heavy
pill → pul
heritage. → heritage
FAQs
Detect and assert if string contains banned word
We found that banned-words-detector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.