
Research
Shai-Hulud Descends to Hades: Miasma Worm Campaign Spreads with New PyPI Wave
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.
wg-easy-api
Advanced tools
Русский | English
A robust Node.js client library for interacting with the WireGuard API, designed for WG-Easy servers.
This library provides a programmatic interface to the WireGuard API as implemented by WG-Easy.
Install via npm:
npm install wg-easy-api
node-fetch (^2.7.0) - Included as a dependency.Basic example with password:
const WireGuardAPI = require('wg-easy-api');
async function example() {
const api = new WireGuardAPI('https', 'example.com', 51821, 'your-password');
try {
const auth = await api.initSession({ password: 'your-password' });
const clients = await api.getClients();
console.log('Clients:', JSON.stringify(clients, null, 2));
} catch (error) {
console.error('Error:', JSON.parse(error.message));
}
}
example();
Using cookies:
const api = new WireGuardAPI('https', 'example.com', 51821, undefined, 'connect.sid=s%3A...');
const clients = await api.getClients();
console.log(clients);
Error handling:
try {
const clients = await api.getClients();
} catch (error) {
const err = JSON.parse(error.message);
console.error(err.error, err.statusCode);
}
All methods return a Promise resolving to { status, data|error, [statusCode], [details] }.
initSession({ password })
Logs into the WG-Easy server with a password. Updates cookies automatically.
{ password: string } - WG-Easy password.{ status: 'success', data: any } or error (e.g., 401 for wrong password).await api.initSession({ password: 'myPass' }); // { status: 'success', data: { success: true } }getSession()
Checks current session status.
{ status: 'success', data: { authenticated: boolean } } or error.await api.getSession(); // { status: 'success', data: { authenticated: true } }createSession({ password })
Creates a new session without auto-updating cookies.
{ password: string }.initSession.await api.createSession({ password: 'myPass' });deleteSession()
Logs out by deleting the session.
{ status: 'success', data: null } or error.await api.deleteSession(); // { status: 'success', data: null }getClients()
Lists all WireGuard clients, converting timestamps to Date objects.
{ status: 'success', data: Client[] } or error (e.g., 500 if server fails).await api.getClients(); // { status: 'success', data: [{ id: 'abc', name: 'Client1' }] }createClient({ name })
Adds a new client with the given name.
{ name: string }.{ status: 'success', data: object } or error.await api.createClient({ name: 'MyLaptop' });deleteClient({ clientId })
Removes a client by ID.
{ clientId: string }.{ status: 'success', data: null } or error.await api.deleteClient({ clientId: 'abc' });enableClient({ clientId })
Enables a client to connect.
{ clientId: string }.await api.enableClient({ clientId: 'abc' });disableClient({ clientId })
Disables a client.
{ clientId: string }.await api.disableClient({ clientId: 'abc' });updateClientName({ clientId, name })
Changes a client’s name.
{ clientId: string, name: string }.await api.updateClientName({ clientId: 'abc', name: 'NewName' });updateClientAddress({ clientId, address })
Updates a client’s IP address.
{ clientId: string, address: string }.await api.updateClientAddress({ clientId: 'abc', address: '10.0.0.3' });getClientConfig({ clientId })
Gets a client’s .conf file as text.
{ clientId: string }.{ status: 'success', data: string } or error.await api.getClientConfig({ clientId: 'abc' }); // { status: 'success', data: '[Interface]...' }getClientQRCode({ clientId })
Gets a client’s config as an SVG QR code.
{ clientId: string }.{ status: 'success', data: string } or error.await api.getClientQRCode({ clientId: 'abc' }); // { status: 'success', data: '...' }restoreConfiguration(file)
Restores a server config from a string.
file: string.{ status: 'success', data: null } or error.await api.restoreConfiguration('[Interface]...');getRelease()
Gets the WG-Easy version.
{ status: 'success', data: { version: string } } or error.await api.getRelease(); // { status: 'success', data: { version: '7' } }getLang()
Gets the UI language.
{ status: 'success', data: { lang: string } } or error.await api.getLang(); // { status: 'success', data: { lang: 'en' } }getUITrafficStats()
Gets traffic stats.
{ status: 'success', data: { bytesSent: number, bytesReceived: number } } or error.await api.getUITrafficStats(); // { status: 'success', data: { bytesSent: 12345 } }getChartType()
Gets the UI chart type.
{ status: 'success', data: { type: string } } or error.await api.getChartType(); // { status: 'success', data: { type: 'line' } }{ status: 'success', data: any }{ status: 'error', error: string, statusCode: number, details: any }protocol, ip, port in constructor.api.cookies after initSession.curl to verify server responses.Fork and PR on GitHub.
MIT © fluxnetru.
FAQs
Wg-easy api NodeJS
We found that wg-easy-api 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
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.

Security News
RubyGems and Bundler 4.0.13 introduced an opt-in cooldown feature that delays newly published gems during dependency resolution.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.