Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
mx-connect
Advanced tools
Establish TCP connection to a MX server. This module takes a target domain or email address, resolves appropriate MX servers for this target and tries to get a connection, starting from higher priority servers.
Supports unicode hostnames and IPv6.
npm install mx-connect
const mxConnect = require('mx-connect');
mxConnect(options, callback);
Where
Example
This example establishes a connection to the MX of gmail.com and pipes output to console
const mxConnect = require('mx-connect');
mxConnect('user@gmail.com', (err, connection) => {
if (err) {
console.error(err);
} else {
console.log('Connection to %s:%s', connection.hostname, connection.port);
// Connection to aspmx.l.google.com:25
connection.socket.pipe(process.stdout);
// 220 mx.google.com ESMTP k11-v6si869487ljk.7 - gsmtp
}
});
You can use a domain name or an email address as the target, for additional configuration you would need to use configurtion object with the following properties (most are optional)
target is either a domain name or an email address or an IP address or IP address literal (basically anything you can have after the @-sign in an email address). Unicode is allowed.
port is the port number to connect to. Defaults to 25.
localAddress is the local IP address to use for the connection
localHostname is the hostname of the local address
localAddressIPv4 is the local IPv4 address to use for the connection if you want to specify an address both for IPv4 and IPv6
localAddressIPv6 is the local IPv6 address to use for the connection if you want to specify an address both for IPv4 and IPv6
dnsOptions is an object for IP address related options
false
) If true then never use IPv6 addresses for sendingfalse
) If true then use IPv6 address even if IPv4 address is also availablefalse
) If true then refuses to connect to IP addresses that are either in loopback, private network or attached to the server. People put every kind of stuff in MX records, you do not want to flood your loopback interface because someone thought it is a great idea to set 127.0.0.1 as the MX serverdns.resolve
, callback-style)mx is a resolved MX object or an array of MX objects to skip DNS resolving. Useful if you want to connect to a specific host.
connectHook function (options, socketOptions, callback) is a function handler to run before establishing a tcp connection to current target (defined in socketOptions
). If the socketOptions
object has a socket
property after the callback then connection is not established. Useful if you want to divert the connection is ome cases, for example if the target domain is in the Onion network then you could create a socket against a SOCK proxy yourself.
mtaSts is an object for MTA-STS configuration
true
then does not run MTA-STS checks, disabled by defaultconnectError function (err, options, socketOptions) is a function handler to run when a connection to a MX fails.
Function callback gets connection object as the second argument
EUPL v1.1 or newer
FAQs
Establish TCP connection to a MX server
The npm package mx-connect receives a total of 72 weekly downloads. As such, mx-connect popularity was classified as not popular.
We found that mx-connect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.