
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
This is a Node.js client library for interacting with XUI-PANEL.
Installation
You can install this library using npm:
npm install xui-client
Usage
Here's how you can use this library in your Node.js application:
const { XuiPanelClient,BitConverter } = require('xui-client');
async function main() {
const xui = new XuiPanelClient();
await xui.login('http://full.fafaamir.xyz:2002', 'Fatima','Fatima');
const listData = await xui.list();
// Datas you can get
console.log(console.log(listData.obj[0].clientStats))
console.log(console.log(listData.obj[0].down))
console.log(console.log(listData.obj[0].enable))
console.log(console.log(listData.obj[0].expiryTime))
console.log(console.log(listData.obj[0].id))
console.log(console.log(listData.obj[0].listen))
console.log(console.log(listData.obj[0].port))
console.log(console.log(listData.obj[0].protocol))
console.log(console.log(listData.obj[0].remark))
console.log(console.log(listData.obj[0].settings))
console.log(console.log(listData.obj[0].sniffing))
console.log(console.log(listData.obj[0].tag))
console.log(console.log(listData.obj[0].total))
console.log(console.log(listData.obj[0].up))
xui.addClient(1, "te2st@example.com", "client2-uuid").then((response) => {
console.log(response);
});
}
main();
XuiPanelClient
constructor()
Creates a new XUI-PANEL client.
login(url, username, password)
Logs in to a specified XUI-PANEL URL using the provided username and password.
url
(string): The URL where the login should be performed.
username
(string): The username for authentication.
password
(string): The password for authentication.
Returns a Promise that resolves with the Axios response containing cookies when the login is successful or rejects on failure.
list()
Fetches a list from the XUI-PANEL using the current session cookies.
Returns a Promise that resolves with the list data or rejects on failure.
BitConverter
Utility class for bit conversions.
bitsToKilobytes(bits)
Converts bits to kilobytes.
bits
(number): The number of bits to convert.
Returns the equivalent value in kilobytes.
bitsToMegabytes(bits)
Converts bits to megabytes.
bits
(number): The number of bits to convert.
Returns the equivalent value in megabytes.
bitsToGigabytes(bits)
Converts bits to gigabytes.
bits
(number): The number of bits to convert.
Returns the equivalent value in gigabytes.
addClient(inboundId, email, uuid, enable = true, flow = "", limitIp = 0, totalGb = 0, expireTime = 0, telegramId = "", subscriptionId = "")
Adds a new client to an existing inbound in the XUI-PANEL.
Parameters:
inboundId
(number): The ID of the inbound where the client will be added.email
(string): The email address of the client.uuid
(string): The UUID (Universally Unique Identifier) of the client.enable
(boolean, optional): Whether the client is enabled. Default is true.flow
(string, optional): The flow associated with the client. Default is an empty string.limitIp
(number, optional): The IP limit for the client. Default is 0 (no limit).totalGb
(number, optional): The total data transfer limit for the client in gigabytes. Default is 0 (no limit).expireTime
(number, optional): The client's expiration time in timestamp (epoch) format. Default is 0 (no expiration).telegramId
(string, optional): The Telegram ID of the client. Default is an empty string.subscriptionId
(string, optional): The subscription ID of the client. Default is an empty string.Returns a Promise that resolves with a boolean indicating the success of adding the client or rejects on failure.
FAQs
A nodejs friendly library for xui panel
The npm package xui-client receives a total of 0 weekly downloads. As such, xui-client popularity was classified as not popular.
We found that xui-client 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 uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.