Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
mname-client
Advanced tools
A DNS client library using the packet parsing/generating code from node-mname.
const mod_mname_client = require('mname-client');
var client = new mod_name_client.DnsClient({
/* Will try all of the set name servers in parallel. */
resolvers: ['8.8.8.8', '8.8.4.4']
});
client.lookup({
domain: 'google.com',
type: 'AAAA',
timeout: 3000
}, function (err, message) {
if (err) {
/* ... */
return;
}
var ans = msg.getAnswers();
/* ans will look like: */
ans = [ { name: 'google.com',
type: 'A',
class: 'IN',
ttl: 299,
target: '216.58.192.14' } ];
});
const mod_mname_client = require('mname-client');
var req = new mod_mname_client.DnsMessage();
req.addQuestion('google.com', 'A');
req.addEDNS({ maxUDPLength: 1480 });
req.on('error', function (err) {
/*
* For socket-level errors that occurred while our request was
* outstanding
*/
...
});
req.on('reply', function (msg, done) {
if (msg.isError()) {
/* For successful DNS queries that returned an error code. */
var e = msg.toError();
...
done();
return;
}
var ans = msg.getAnswers();
/* ans will look like: */
ans = [ { name: 'google.com',
type: 'A',
class: 'IN',
ttl: 299,
target: '216.58.192.14' } ];
/*
* Need to call done() to indicate that this query is complete.
* This is important so that AXFR and similar queries that can result
* in multiple replies know when they are finished (the receiver of
* the results can tell by comparing the SOA at the top and bottom)
*/
done();
});
var sock = new mod_mname_client.DnsTcpSocket({
address: '8.8.8.8',
port: 53
});
sock.on('ready', function () {
/*
* sock.send can throw if the query cannot be encoded (e.g. it's
* way too big)
*/
sock.send(req);
/* Call end once you've added all pipelined queries you want. */
sock.end();
});
sock.on('error', function (err) {
/*
* A socket-level error resulting in this connection being unusable.
* If this happens after sock.send() was called in on('ready') above, then
* we will get an 'error' event on the req as well.
*/
});
var sock = new mod_mname_client.DnsUdpSocket({ family: 'udp4' });
sock.on('ready', function () {
/*
* You have to provide a destination to send on a DnsUdpSocket, as you
* can re-use the one bound socket for multiple destinations.
*/
sock.send(req, { address: '8.8.8.8', port: 53 });
/* Will cause the socket to close after the last outstanding query returns. */
sock.end();
});
sock.on('error', function (err) {
/* A socket-level error resulting in this socket being unusable. */
});
FAQs
DNS client library for node.js
The npm package mname-client receives a total of 6 weekly downloads. As such, mname-client popularity was classified as not popular.
We found that mname-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 11 open source maintainers 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.