Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
azheda-utils
Advanced tools
| [Server-Side](#for-node) | [Client-Side](#client) | |:--------------------------------------------:|:----------------------------------------:| | [Installation](#install) | [Installation](#inst
npm install azhedautils
const azhedautils = require('azhedautils');
await azhedautils.sleep(1000);
This will stop the code for 1000ms (1 second)
Download a file from a url
await azhedautils.downloadFile(url, filename);
This function will download a file from a url and save it with a specific filename.
const server = new azhedautils.WebServer({
host: 'localhost',
port: 7788
});
This function will start a webserver, the default command are limited.
// method 1:
const mysur = new azhedautils.MySurreal();
mysur.setUser('<your username>', '<your password>');
mysur.setNamespace('<namespace>');
mysur.setDatabase('<database>');
// method 2:
const mysur = new azhedautils.MySurreal({
username: '<your username>',
password: '<your password>',
namespace: '<namespace>',
database: '<database>',
// You can also use custom host, port and path, these are the default for SurrealDB, you can ignore them if you want
host: '127.0.0.1',
port: 8000,
path: 'rpc'
});
// Querys:
await mysur.query('...'); // Any surreal query
await mysur.create('person:toby', { name: 'Toby', age: 20 });
await mysur.insert('person', [{ name: 'Toby', age: 20 }, { name: 'Derek', age: 30 }])
await mysur.patch('person:toby', { age: 25 });
await mysur.delete('person:toby');
await mysur.live('person');
await mysur.kill('<surreal query uuid>');
await mysur.close();
Once you've asign the new instance of the class to a variable, you just need to call .set() to save the current time
const chTime = new azhedautils.CheckTime();
(async () => {
chTime.set();
await azhedautils.sleep(4 * 1000) // 4 Seconds written in milliseconds
console.log(chTime.set()+'ms');
>>> 4004ms
})();
<script src="https://unpkg.com/azheda-utils/dist/client.js"></script>
const testValue = 123;
const testKey = 't-key';
const time = 1000 * 60 * 60; // 1 hour in milliseconds
Add value 123 to localStorage with 't-key' as key, return true if the the value was set correctly, false or null otherwise
myStorage.add(testKey, testValue);
Checks if there's that key saved in localStorage and return the value, if the key was not found, that returns null
myStorage.get(testKey);
If a value is saved in localStorage with that key, the value'll be removed, return true if this was successful, false if there was some kind of problem
myStorage.remove(testKey);
Clear all data saved in localStorage, returns 0 if everything was cleared correctly
myStorage.clear();
Same as myStorage.add(), but this time, the value has an expiry time.
myStorage.localcookie.set(testKey, testValue, time);
This function'll try to read and the value with the given key saved in localStorage. if the key was not found this'll return null. if the expiry time was passed, the value will'be cleared and this'll return null.
myStorage.localcookie.get(key);
const theme = 'dark'; // or 'light'
const loader = new Loader(theme);
loader.append(); // -> Add the loader in the center of the window
loader.remove(); // -> Remove the loader
New properties (added with prototype):
This will convert the number from the first range of numbers to the second one
const testNumber = 7;
console.log(testNumber.map(0, 10, 0, 100));
>>> 70
const myNumber = 123;
console.log(myNumber.getid());
>>> 3050889136
const testString = 'Hello';
const asciiString = testString.encodeAscii();
console.log(asciiString);
>>> 72|101|108|108|111
const testString = '72|101|108|108|111';
console.log(testString.decodeAscii());
>>> Hello
const testString = 'Hello';
console.log(testString.hashSeed());
>>> 4867314475583282
console.log(testString.hashSeed(1));
>>> 7386249923560166
console.log(testString.hashSeed(2));
>>> 715765420405280
const myString = 'Hello';
console.log(myString.getid());
>>> 1987897324
console.log('hello'.capitalize());
>>> Hello
console.log('Hello world'.capitalize());
>>> Hello world
Create a deepcopy of the array
const myList = [1, 2, 3];
console.log(myList.copy());
>>> [1, 2, 3]
This function will return a copy of the array but every item has a new random index
const arr = [1, 2, 3, 4, 5];
console.log(arr.randomize());
>>> [5, 3, 1, 4, 2]
console.log(arr.randomize());
>>> [5, 1, 3, 2, 4]
console.log(arr.randomize());
>>> [1, 4, 5, 2, 3]
console.log(arr.randomize());
>>> [1, 3, 5, 2, 4]
This function will sort A-Z the array, and then put the given values at the start (in the same order)
const arrayToSort = [
'dog', 'cat', 'shark',
'parrot', 'giraffe',
'zebra', 'dolphin'
];
const newList = arrayToSort.sortByList(['zebra', 'dolphin']);
console.log(newList);
>>> ['zebra', 'dolphin', 'dog', 'cat', 'giraffe', 'parrot', 'shark']
Create a deepcopy of the object
const myObject = { x: 1, y: 2 };
console.log(myObject.copy());
>>> { x: 1, y: 2 }
const obj = {
i: 1,
a: 2,
z: 3,
y: 4
};
console.log(obj.sort());
>>> { a: 2, i: 1 y: 4, z: 3 }
const obj = {
x: 1,
y: 2,
z: 3
};
console.log(obj.getList());
>>> [ ['x', 'y', 'z'], [ 1 , 2 , 3 ] ]
FAQs
| [Server-Side](#for-node) | [Client-Side](#client) | |:--------------------------------------------:|:----------------------------------------:| | [Installation](#install) | [Installation](#inst
The npm package azheda-utils receives a total of 0 weekly downloads. As such, azheda-utils popularity was classified as not popular.
We found that azheda-utils 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.