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.
The console, rewritten from scratch.
To install,
npm install conslog
or
yarn add conslog
After that, there are three ways to use ConsLog. The first way is to replace the console
object.
delete console;
const console = require('conslog');
The second, semi-safe way is to move the console
object.
const v8 = require('v8');
const clone = obj => {
return v8.deserialize(v8.serialize(obj));
};
const oldConsole = clone(console) // Or however you want to deepclone.
delete console;
const console = require('conslog')
The third, safer way, is to include it as a separate package.
const cons = require('conslog');
console
is ConsLog, oldC
is the original console
.log
function log(msg: any, ...optionalParams?: any[]);
Logs to stdout
. Works exactly like oldC.log
except for the indentation.
warn
function warn(msg: any, head?: string, ...optionalParams?: any[]);
Logs to stdout
as a warning. Prefixed with 'warn' or head
.
info
function info(msg: any, head?: string, ...optionalParams?: any[]);
Logs to stdout
as an information. Prefixed with 'info' or head
.
error
function error(e: Error, head?: string, ...optionalParams?: any[]);
Logs to stdout
as an error. Doesn't throw. Prefixed with 'err' or head
.
success
function success(msg: any, head?: string, ...optionalParams?: any[]);
Logs to stdout
as a success message. Prefixed with 'succ' or head
.
fatal
function fatal(e: Error, head?: string, ...optionalParams?: any[]);
Logs to stdout
as a fatal error. Throws. Prefixed with 'fatal' or head
.
changeTheme
interface Theme {
i: string[], // Info color, defaults to ["blue"]
hi: string[],// Info prefix color, defaults to ["bgBlue", "white"]
w: string[], // Warn color, defaults to ["yellow"]
hw: string[],// Warn prefix color, defaults to ["bgYellow", "white"]
e: string[], // Error color, defaults to ["red"]
he: string[],// Error prefix color, defaults to ["bgRed", "white"]
f: string[], // Fatal color, defaults to ["magenta"]
hf: string[],// Fatal prefix color, defaults to ["bgMagenta", "white"]
s: string[], // Success color, defaults to ["green"]
hs: string[],// Success prefix color, defaults to ["bgGreen", "white"]
c: string[], // Catched error color, defaults to ["red"]
hc: string[],// Catched error prefix color, defaults to ["bgGreen", "white"]
g: string[] // Group header color, defaults to ["inverse"]
}
function changeTheme(theme: Theme);
Sets the color theme. See the colors
doc for information on how to write a theme.
indentationSteps
let indentationSteps: number = 1;
How many spaces to indent each time.
maxIndent
let maxIndent: number = 10;
The maximum indentation you can reach. Set to -1 for no limit.
msg
interface Messages {
info: string,
warn: string,
error: string,
fatal: string,
catched: string,
success: string,
groupIn: string,
groupOut: string
}
let msg: Messages = {
info: " INFO ",
warn: " WARN ",
error: " ERR ",
fatal: "FATAL ",
catched: "CATCH ",
success: " SUCC ",
groupIn: "> ",
groupOut: "< "
}
The prefixes applied to the specific logging functions.
MIT
FAQs
Console Logging, done the right way.
The npm package conslog receives a total of 0 weekly downloads. As such, conslog popularity was classified as not popular.
We found that conslog 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.