
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
This module extends [`kylestev/jvm.js`](https://github.com/kylestev/jvm.js) by exposing classes used for traversing the contents of a `ClassInfo` object from jvm.js (a JavaScript representation of the JVM class file format) by utilizing the [Visitor Patte
This module extends kylestev/jvm.js
by
exposing classes used for traversing the contents of a ClassInfo
object from
jvm.js (a JavaScript representation of the JVM class file format) by utilizing
the Visitor Pattern.
import { Jar } from 'jvm';
import { ClassVisitor } from 'jvm-visitor';
// instantiate a new ClassVisitor object
let visitor = new ClassVisitor;
// bind an event listener to the `visit-field` event whose callback is passed
// a `ClassInfo` object as well as a `FieldInfo` object.
visitor.on('visit-field', (cls, field) => {
console.log(' %s %s.%s', field.desc, cls.name, field.name);
});
// parse the jar contents
Jar.unpack('/path/to/your.jar')
// called when the Promise returned from `Jar#unpack(string)` succeeds
.then((jar) => {
// iterate all `ClassInfo` objects (`cls`) in the jar
for (let [name, cls] of jar) {
// pass the `ClassInfo` object to `ClassVisitor#accept(ClassInfo)`
// in order to visit `cls` and its members
visitor.accept(cls);
}
})
// catch any uncaught errors during this Promise chain and log them to the console
.catch(console.error.bind(console));
jvm-visitor
ships with a verbose version of the default ClassVisitor
which
has the same interface for interacting with it and behaves the same way with
one caveat: it binds event listeners for each type of even that ClassVisitor
emits and prints out basic information about the class file when visited.
This can aid debugging efforts without hampering development time as you can
simply swap new ClassVisitor
references with new VerboseClassVisitor
in
your code -- even if you're binding your own event listeners on top of those
used by VerboseClassVisitor
.
import { Jar } from 'jvm';
import { VerboseClassVisitor } from 'jvm-visitor';
let visitor = new VerboseClassVisitor;
Jar.unpack('/path/to/your.jar')
.then((jar) => {
for (let [name, cls] of jar) {
visitor.accept(cls);
// output will look similar to the following:
// >>> [visit-start] ClassName
// >>> [visit-field] FieldDesc ClassName.FieldName
// >>> [visit-field] ...
// >>> [visit-method] ClassName#MethodName+MethodDesc
// >>> [visit-method] ...
// >>> [visit-end] ClassName completed in 0.004365655s
// >>> [visit-start] ClassName1
// >>> ...
// >>> [visit-end] ClassName1 completed in 0.004233272s
}
})
.catch(console.error.bind(console));
FAQs
This module complements [`kylestev/jvm.js`](https://github.com/kylestev/jvm.js) by exposing transformation functions used to deobfuscate class files.
The npm package jvm-deob receives a total of 0 weekly downloads. As such, jvm-deob popularity was classified as not popular.
We found that jvm-deob 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.