Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fullUnicode: true
});
screen.title = 'Message Sender';
process.on('uncaughtException', (err) => {
screen.log(`${err.name} ${err.message} ${err.stack}`);
console.error(err);
setTimeout(() => {
process.exit(1);
}, 3000);
});
screen.log('screen root node loaded');
// Create a box perfectly centered horizontally and vertically.
const logBox = blessed.log({
top: 0,
left: 0,
height: '100%-1',
mouse: true,
vi: true,
scrollOnInput: false,
scrollable: true,
alwaysScroll: true,
scrollbar: {
ch: ' ',
track: {
bg: 'cyan'
},
style: {
bg: 'black',
fg: 'blue'
export default store => {
const screen = blessed.screen({
autoPadding: true,
smartCSR: true,
title: 'Terminal Devtools',
sendFocus: true,
dockBorders: true,
log: './log',
// log: '/dev/ttys001',
terminal: 'xterm-256color',
ignoreLocked: ['C-c']
})
console.log = screen.log.bind(screen)
console.error = screen.log.bind(screen, 'ERROR: ')
keys(store, screen)
try { winpty = which.sync("winpty") }
catch (ex) {
this.fatal("under Windows/MinTTY you need the \"winpty\" utility on PATH")
}
const child = childProcess.spawnSync(winpty, process.argv, {
stdio: [ "inherit", "inherit", "inherit" ]
})
process.exit(child.status)
}
/* final sanity check for TTY */
if (!process.stdin.isTTY || !process.stdout.isTTY)
this.fatal("we are not attached to a TTY device")
/* establish Blessed screen */
this.screen = Blessed.screen({
title: this.argv.title,
smartCSR: true,
autoPadding: false,
warnings: false
})
/* disable cursor */
this.screen.program.hideCursor()
/* optionally enable mouse event handling */
if (this.argv.mouse)
this.screen.enableMouse()
/* determine screen size */
this.calcScreenSize()
const startForm = ({
screen,
formProperties = {},
submitLabel = 'Start',
onSubmit = () => {},
}) => {
// console.log(`arguments[0]: '${JSON.stringify(arguments[0])}'`);
const form = blessed.form({
label: 'Action Form',
mouse: true,
keys: true,
vi: true,
left: 0,
top: 0,
width: "100%",
scrollable: true,
scrollbar: {
ch: " "
},
border: 'line',
...formProperties
});
form.on("submit", onSubmit);
#!/usr/bin/env node
/*
* ----------------
* Blessr2 frontend
* ----------------
* author: pancake@nopcode.org
* date: 2015-12-25
*/
'use strict';
const r2pipe = require('r2pipe');
const process = require('process');
const blessed = require('blessed');
const contrib = require('blessed-contrib');
const program = blessed.program();
/* global vars (must die at some point) */
var regs = undefined;
var offsetStack = [];
//const target = 'http://cloud.radare.org/cmd/';
function parseOptions() {
var config = {};
const argv = require('optimist').argv;
if (argv.h) {
console.log(`Usage:
blessr2 [-HtnwdD] [file|url]
Examples:
bg: 'red',
fg: 'white'
};
function isaBox(x) {
if (x.indexOf('ag') != -1)
return true;
return false;
}
function isaText(x) {
return (x[0] == ':');
}
let res = undefined;
if (isaText(name)) {
res = blessed.textarea(obj);
res.select = function() { /* do nothing */ };
} else if (isaBox(name)) {
res = blessed.box(obj);
res.select = function() { /* do nothing */ };
} else {
obj.selectedFg = 'white';
obj.selectedBg = '#000070';
res = blessed.list(obj);
res.setContent = function(x) {
if (typeof x === 'string') {
res.setItems(x.split('\n'));
}
}
}
res.cmd = name;
return res;
let selected = infoList.selected;
if (selected < OPTIONS.length) {
let optionKey = OPTIONS[selected].split(',')[0].replace(/\W/g, '');
helpText = yargsOptions[optionKey].describe;
boxTitle = optionKey + ' option';
} else {
let replacementObj = REPLACEMENTS[Object.keys(REPLACEMENTS)[selected - OPTIONS.length]];
helpText = replacementObj.description;
boxTitle = replacementObj.name + ' Variable';
if (replacementObj.parameters) {
helpText += '\n\nParameters: ' + replacementObj.parameters.description;
}
}
helpText += '\n\n{center}Press space to close{/center}';
let msg = blessed.message({
parent: screen,
label: boxTitle,
border: 'line',
height: 'shrink',
width: 'half',
top: 'center',
left: 'center',
tags: true,
keys: true
});
msg.display(helpText, 0, function() { msg.destroy(); });
});
// ========== END EVENT HANDLERS ==========
// placeholder for renderering
const canvas = blessed.box({ // box image
parent: screen,
top: 0,
left: 0,
type: 'ansi',
width: '100%',
height: '100%',
// border: { type: 'line' },
search: false,
ascii: true,
optimization: 'cpu', // cpu mem
animate: false
});
const box = blessed.box({
parent: screen,
top: '0',
left: '0',
width: 'shrink',
height: 'shrink',
// label: '{bold}Logs{/bold}',
content: '',
tags: true,
// border: {
// type: 'line'
// },
style: {
fg: 'white',
// bg: 'magenta',
border: {
fg: '#f0f0f0'
const createChannelView = () => {
const view = blessed.box({
top: 1,
height: '100%-3',
content: '',
input: false,
tags: true,
scrollable: true,
alwaysScroll: true,
style: {
fg: textColor,
bg: backgroundColor
}
})
// 🎁
view.on('click', function(data) {
if(orbit && _currentChannel) {
orbit.send(_currentChannel, "🐋")
export default (parent, stores) => {
let SearchResultsStore = stores.SearchResultsStore;
let list = blessed.box({
parent,
top: 0,
left: 0,
width: '100%',
height: '100%-1',
scrollable: true
});
let listHeight = list.height;
let listWidth = list.width;
let listItems;
let listItemsHeights;
let listItemsCurrentOffset;
let listItemsCurrentIdx;
let listCurrentHeight = 0; // Height without extraLastItem
let extraLastItem;