Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
AttParser parses a string like you might find in an HTML tag. Optionally, it will convert certain values into other classes like Integer or TrueClass.
In its simplest use, give AttParser a string that is formatted like the
attributes in HTML. Then run the string through AttParser.parse()
. That method
will return a hash.
raw = 'whatever="dude" ready YEAH=man'
atts = AttParser.parse(raw)
atts['whatever'] # => "dude"
atts['ready'] # => nil
atts['yeah'] # => "man"
The attribute names are downcased. Values quotes are returned as string. Values
without spaces are returned as string. If an attribute does not have a value
(i.e. there is no equals sign) then the value is nil
.
If you add the infer
option then certain values are inferred as objects other
than strings. NOTE: Only unquoted strings are inferred, never quoted strings.
Quoted strings are always returned as strings.
raw = 'my-false=false my-true=true my-int=-2 my-float=3.4 my-nil=nil'
atts = AttParser.parse(raw, 'infer'=>true)
atts['my-false'].class # => FalseClass
atts['my-true'].class # => TrueClass
atts['my-int'].class # => Integer
atts['my-float'].class # => Float
atts['my-nil'].class # => NilClass
That's what AttParser does. If you want to get more complex, it's probably best to use JSON.
gem install attparser
Mike O'Sullivan mike@idocs.com
version | date | notes |
---|---|---|
1.0 | June 18, 2020 | Initial upload. |
FAQs
Unknown package
We found that attparser 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.