Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
associate metadata or calls with patterns of speech and analysis using NLP
A means to associate metadata or calls with patterns of speech so that when text is analyzed, a match is provided (along with a level of confidence) so that the program can determine a course of action in response.
Designed for use with deftly-bot
but generic enough to be used with other approaches. Deftly's declarative resource approach coupled with the initialization process performs the router's initialization which may seem otherwise tedious.
Consider stealing the code (modlo, fount, deftly) to provide your own means of creating a way to associate patterns of speech with methods to be dispatched on matches.
Observations of support and operational tooling that makes use of chat interfaces is that it is very difficult to remember specific command patterns and incantations.
This leads not only to command misses and frequent command list invocations (littering the common channel) but can have unintended outcomes.
By utilizing natural speech processing the focus can be on specific keywords, synonyms and possible patterns for a valid request. This follows the paradigm, "be liberal in what you accept".
Chat interfaces are far more welcoming and powerful when they don't expect people to provide explicit/perfect incantations and punish them for omissions, transpositions, and typos.
A typical "router" pattern that can be plugged into an HTTP or message dispatch stack directly.
This same table is available in a single document here
Tag | Description | Example |
---|---|---|
, | Comma | , |
: | Mid-sent punctuation | : ,; |
. | Sent-final punctuation | . , ! , ? |
" | quote | " |
( | Left paren | ( |
) | Right paren | ) |
# | Pound sign | # |
CC | Coordinating conjunction | and , but , or |
CD | Cardinal number | one , two , 1 , 2 |
DT | Determiner | the , some |
EX | Existential there | there |
FW | Foreign word | mon dieu |
IN | Preposition | of , in , by |
JJ | Adjective | big |
JJR | Adjective comparitive | bigger |
JJS | Adjective superlative | biggest |
LS | List item maker | 1 , One |
MD | Modal | can , should |
NN | Noun, singular or mass | dog |
NNP | Proper noun, singular | Edingburgh |
NNPS | Proper noun, plural | Smiths |
NNS | Noun, plural | dogs |
PDT | Predeterminer | all , both |
POS | Possessive ending | 's |
PP | Personal pronoun | I , you , she |
PRP$ | Possessive pronoun | my , one's |
RB | Adverb | quickly , not |
RBR | Adverb, comparative | faster |
RBS | Adverb, superlative | fastest |
RP | Particle | up , off |
SYM | Symbol | % , + , & |
TO | 'to' | to |
UH | Interjection | oh , oops |
VB | Verb, base form | eat |
VBD | Verb, past tense | ate |
VBG | Verb, gerund | eating |
VBN | Verb, past part | eaten |
VBP | Verb, present | eat |
VBZ | Verb, present | eats |
WDT | Wh-determiner | which , that |
WP | Wh pronoun | who , what |
WP$ | Possessive-Wh | whose |
WRB | Wh-adverb | how , where |
The API supports adding, retrieving, changing the value of, and evaluating rule definitions.
Adds a rule to the router and returns a promise that either resolves to the current rank for the rule or rejects with validation errors.
const rank = router.addRule(
'checkStatus',
{}
engine.checkStatus
)
// rank is the current order of the rule provided
Changes the value associated with the rule.
router.changeValue('myRule', engine.someNewMethod)
Returns an array with a boolean indicating whether a matching rule was deleted and an integer indicating the number of rules left in the router.
const [deleted, remaining] = router.deleteRule('myRule')
Returns the rule definition for the name. undefined
is returned if the name does not match.
const rule = router.getRule('myRule')
Returns the current rank for the rule. If the rule name does not match an existing rule, a -1
is returned.
const rank = router.getRank('myRule')
Evaluates a sentence for a potential match and, if there is a match, returns data extracted from the sentence as well as the value. If no match is found, undefined
is returned.
const match = router.evaluate('my voice is my passport verify me')
// match will have the properties `data` and `value`
// it's more likely that you'd want to feed the match into a
// dispatcher, but YMMV
match.value(match.data.values)
The data returned in the match will contain the properties:
sentiment
- 'positive'|'neutral'|'mixed'|'negative'confidence
- %degree
- %dirtiness
- %ordered
- true|falsepoliteness
- %tense
- 'past'|'present'tokens
- the full token array extracted during sentence analysistype
- 'declarative'|'imperative'|'interrogative'values
- a hash of name/value pairs extractedEach token has the following properties:
abbreviation
- true|falseacronym
- true|falsealt
- alternate text for the tag's valueentity
- either undefined or a hash with the following details:
alt
- alternate text contentvalue
- the value of the entity detectedtype
- 'unknown'|'email'|'ip'|etc.plural
- true|falsepos
- part of speech tag,value
- text content for the tag,verb
- true|falseFAQs
associate metadata or calls with patterns of speech and analysis using NLP
The npm package nlp-router receives a total of 0 weekly downloads. As such, nlp-router popularity was classified as not popular.
We found that nlp-router 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.