mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 23:34:26 +00:00
c66ae7b2e4
Launch an Xspice and run: echo -ne "\033]844;127.0.0.1;9876\007" This will launch a SPiCE client connecting to 127.0.0.1:9876. Still need to add all the security stuff and generally be more defensive in the implementation.
194 lines
11 KiB
JavaScript
194 lines
11 KiB
JavaScript
wdi.KeymapUS = function() {
|
|
|
|
var charmapUS = [];
|
|
charmapUS['`'] = [[0x29, 0, 0, 0], [0xA9, 0, 0, 0]];
|
|
charmapUS['~'] = [[0x2A, 0, 0, 0], [0x29, 0, 0, 0], [0xA9, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['1'] = [[0x2, 0, 0, 0],[0x82, 0, 0, 0]];
|
|
charmapUS['!'] = [[0x2A, 0, 0, 0], [0x2, 0, 0, 0], [0x82, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['2'] = [[0x3, 0, 0, 0], [0x83, 0, 0, 0]];
|
|
charmapUS['@'] = [[0x2A, 0, 0, 0], [0x3, 0, 0, 0], [0x83, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['3'] = [[0x4, 0, 0, 0], [0x84, 0, 0, 0]];
|
|
charmapUS['#'] = [[0x2A, 0, 0, 0], [0x4, 0, 0, 0], [0x84, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['4'] = [[0x5, 0, 0, 0], [0x85, 0, 0, 0]];
|
|
charmapUS['$'] = [[0x2A, 0, 0, 0], [0x5, 0, 0, 0], [0x85, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['5'] = [[0x6, 0, 0, 0], [0x86, 0, 0, 0]];
|
|
charmapUS['%'] = [[0x2A, 0, 0, 0], [0x6, 0, 0, 0], [0x86, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['6'] = [[0x7, 0, 0, 0], [0x87, 0, 0, 0]];
|
|
charmapUS['^'] = [[0x2A, 0, 0, 0], [0x7, 0, 0, 0], [0x87, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['7'] = [[0x8, 0, 0, 0], [0x88, 0, 0, 0]];
|
|
charmapUS['&'] = [[0x2A, 0, 0, 0], [0x8, 0, 0, 0], [0x88, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['8'] = [[0x9, 0, 0, 0], [0x89, 0, 0, 0]];
|
|
charmapUS['*'] = [[0x2A, 0, 0, 0], [0x9, 0, 0, 0], [0x89, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['9'] = [[0x0A, 0, 0, 0], [0x8A, 0, 0, 0]];
|
|
charmapUS['('] = [[0x2A, 0, 0, 0], [0x0A, 0, 0, 0], [0x8A, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['0'] = [[0x0B, 0, 0, 0], [0x8B, 0, 0, 0]];
|
|
charmapUS[')'] = [[0x2A, 0, 0, 0], [0x0B, 0, 0, 0], [0x8B, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['-'] = [[0x0C, 0, 0, 0], [0x8C, 0, 0, 0]];
|
|
charmapUS['_'] = [[0x2A, 0, 0, 0], [0x0C, 0, 0, 0], [0x8C, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['='] = [[0x0D, 0, 0, 0], [0x8D, 0, 0, 0]];
|
|
charmapUS['+'] = [[0x2A, 0, 0, 0], [0x0D, 0, 0, 0], [0x8D, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['q'] = [[0x10, 0, 0, 0], [0x90, 0, 0, 0]];
|
|
charmapUS['Q'] = [[0x2A, 0, 0, 0], [0x10, 0, 0, 0], [0x90, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['w'] = [[0x11, 0, 0, 0], [0x91, 0, 0, 0]];
|
|
charmapUS['W'] = [[0x2A, 0, 0, 0], [0x11, 0, 0, 0], [0x91, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['e'] = [[0x12, 0, 0, 0], [0x92, 0, 0, 0]];
|
|
charmapUS['E'] = [[0x2A, 0, 0, 0], [0x12, 0, 0, 0], [0x92, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['r'] = [[0x13, 0, 0, 0], [0x93, 0, 0, 0]];
|
|
charmapUS['R'] = [[0x2A, 0, 0, 0], [0x13, 0, 0, 0], [0x93, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['t'] = [[0x14, 0, 0, 0], [0x94, 0, 0, 0]];
|
|
charmapUS['T'] = [[0x2A, 0, 0, 0], [0x14, 0, 0, 0], [0x94, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['y'] = [[0x15, 0, 0, 0], [0x95, 0, 0, 0]];
|
|
charmapUS['Y'] = [[0x2A, 0, 0, 0], [0x15, 0, 0, 0], [0x95, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['u'] = [[0x16, 0, 0, 0], [0x96, 0, 0, 0]];
|
|
charmapUS['U'] = [[0x2A, 0, 0, 0], [0x16, 0, 0, 0], [0x96, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['i'] = [[0x17, 0, 0, 0], [0x97, 0, 0, 0]];
|
|
charmapUS['I'] = [[0x2A, 0, 0, 0], [0x17, 0, 0, 0], [0x97, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['o'] = [[0x18, 0, 0, 0], [0x98, 0, 0, 0]];
|
|
charmapUS['O'] = [[0x2A, 0, 0, 0], [0x18, 0, 0, 0], [0x98, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['p'] = [[0x19, 0, 0, 0], [0x99, 0, 0, 0]];
|
|
charmapUS['P'] = [[0x2A, 0, 0, 0], [0x19, 0, 0, 0], [0x99, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['['] = [[0x1A, 0, 0, 0], [0x9A, 0, 0, 0]];
|
|
charmapUS['{'] = [[0x2A, 0, 0, 0], [0x1A, 0, 0, 0], [0x9A, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS[']'] = [[0x1B, 0, 0, 0], [0x9B, 0, 0, 0]];
|
|
charmapUS['}'] = [[0x2A, 0, 0, 0], [0x1B, 0, 0, 0], [0x9B, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['\\'] = [[0x2B, 0, 0, 0], [0xAB, 0, 0, 0]];
|
|
charmapUS['|'] = [[0x2A, 0, 0, 0], [0x2B, 0, 0, 0], [0xAB, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['a'] = [[0x1E, 0, 0, 0], [0x9E, 0, 0, 0]];
|
|
charmapUS['A'] = [[0x2A, 0, 0, 0], [0x1E, 0, 0, 0], [0x9E, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['s'] = [[0x1F, 0, 0, 0], [0x9F, 0, 0, 0]];
|
|
charmapUS['S'] = [[0x2A, 0, 0, 0], [0x1F, 0, 0, 0], [0x9F, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['d'] = [[0x20, 0, 0, 0], [0xA0, 0, 0, 0]];
|
|
charmapUS['D'] = [[0x2A, 0, 0, 0], [0x20, 0, 0, 0], [0xA0, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['f'] = [[0x21, 0, 0, 0], [0xA1, 0, 0, 0]];
|
|
charmapUS['F'] = [[0x2A, 0, 0, 0], [0x21, 0, 0, 0], [0xA1, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['g'] = [[0x22, 0, 0, 0], [0xA2, 0, 0, 0]];
|
|
charmapUS['G'] = [[0x2A, 0, 0, 0], [0x22, 0, 0, 0], [0xA2, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['h'] = [[0x23, 0, 0, 0], [0xA3, 0, 0, 0]];
|
|
charmapUS['H'] = [[0x2A, 0, 0, 0], [0x23, 0, 0, 0], [0xA3, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['j'] = [[0x24, 0, 0, 0], [0xA4, 0, 0, 0]];
|
|
charmapUS['J'] = [[0x2A, 0, 0, 0], [0x24, 0, 0, 0], [0xA4, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['k'] = [[0x25, 0, 0, 0], [0xA5, 0, 0, 0]];
|
|
charmapUS['K'] = [[0x2A, 0, 0, 0], [0x25, 0, 0, 0], [0xA5, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['l'] = [[0x26, 0, 0, 0], [0xA6, 0, 0, 0]];
|
|
charmapUS['L'] = [[0x2A, 0, 0, 0], [0x26, 0, 0, 0], [0xA6, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS[';'] = [[0x27, 0, 0, 0], [0xA7, 0, 0, 0]];
|
|
charmapUS[':'] = [[0x2A, 0, 0, 0], [0x27, 0, 0, 0], [0xA7, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['\''] = [[0x28, 0, 0, 0], [0xA8, 0, 0, 0]];
|
|
charmapUS['"'] = [[0x2A, 0, 0, 0], [0x28, 0, 0, 0], [0xA8, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['z'] = [[0x2C, 0, 0, 0], [0xAC, 0, 0, 0]];
|
|
charmapUS['Z'] = [[0x2A, 0, 0, 0], [0x2C, 0, 0, 0], [0xAC, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['x'] = [[0x2D, 0, 0, 0], [0xAD, 0, 0, 0]];
|
|
charmapUS['X'] = [[0x2A, 0, 0, 0], [0x2D, 0, 0, 0], [0xAD, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['c'] = [[0x2E, 0, 0, 0], [0xAE, 0, 0, 0]];
|
|
charmapUS['C'] = [[0x2A, 0, 0, 0], [0x2E, 0, 0, 0], [0xAE, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['v'] = [[0x2F, 0, 0, 0], [0xAF, 0, 0, 0]];
|
|
charmapUS['V'] = [[0x2A, 0, 0, 0], [0x2F, 0, 0, 0], [0xAF, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['b'] = [[0x30, 0, 0, 0], [0xB0, 0, 0, 0]];
|
|
charmapUS['B'] = [[0x2A, 0, 0, 0], [0x30, 0, 0, 0], [0xB0, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['n'] = [[0x31, 0, 0, 0], [0xB1, 0, 0, 0]];
|
|
charmapUS['N'] = [[0x2A, 0, 0, 0], [0x31, 0, 0, 0], [0xB1, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['m'] = [[0x32, 0, 0, 0], [0xB2, 0, 0, 0]];
|
|
charmapUS['M'] = [[0x2A, 0, 0, 0], [0x32, 0, 0, 0], [0xB2, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS[','] = [[0x33, 0, 0, 0], [0xB3, 0, 0, 0]];
|
|
charmapUS['<'] = [[0x2A, 0, 0, 0], [0x33, 0, 0, 0], [0xB3, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['.'] = [[0x34, 0, 0, 0], [0xB4, 0, 0, 0]];
|
|
charmapUS['>'] = [[0x2A, 0, 0, 0], [0x34, 0, 0, 0], [0xB4, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS['/'] = [[0x35, 0, 0, 0], [0xB5, 0, 0, 0]];
|
|
charmapUS['?'] = [[0x2A, 0, 0, 0], [0x35, 0, 0, 0], [0xB5, 0, 0, 0], [0xAA, 0, 0, 0]];
|
|
charmapUS[' '] = [[0x39, 0, 0, 0], [0xb9, 0, 0, 0]];
|
|
|
|
var keymapUS = [];
|
|
|
|
keymapUS[27] = 0x1; // ESC
|
|
keymapUS[9] = 0x0F; // TAB
|
|
//keymapUS[20] = 0x3A; // // BLOQ.MAY. => see the charmap, all the capital letters and shift chars send a shift in their sequence
|
|
keymapUS[16] = 0x2A; // LEFT SHIFT and RIGHT SHIFT
|
|
keymapUS[91] = 0x1D; // LEFT GUI (META, COMMAND) BINDED TO CONTROL
|
|
keymapUS[17] = 0x1D; // LEFT CONTROL and RIGHT CONTROL
|
|
keymapUS[32] = 0x39; // SPACE
|
|
keymapUS[8] = 0x0E; // BACKSPACE
|
|
keymapUS[13] = 0x1C; // ENTER
|
|
//keymapUS[0] = 0x38; // RIGHT ALT (ALT GR)
|
|
//keymapUS[92] = 0x5C; // RIGHT GUI (WINDOWS)
|
|
keymapUS[38] = 0x48; // UP ARROW
|
|
keymapUS[37] = 0x4B; // LEFT ARROW
|
|
keymapUS[40] = 0x50; // DOWN ARROW
|
|
keymapUS[39] = 0x4D; // RIGHT ARROW
|
|
keymapUS[45] = 0x52; // INSERT
|
|
keymapUS[46] = 0x53; // DELETE
|
|
keymapUS[36] = 0x47; // HOME
|
|
keymapUS[35] = 0x4F; // FIN
|
|
keymapUS[33] = 0x49; // PAGE UP
|
|
keymapUS[34] = 0x51; // PAGE UP
|
|
keymapUS[144] = 0x45; // BLOQ.NUM.
|
|
keymapUS[145] = 0x46; // SCROLL LOCK
|
|
keymapUS[112] = 0x3B; // F1
|
|
keymapUS[113] = 0x3C; // F2
|
|
keymapUS[114] = 0x3D; // F3
|
|
keymapUS[115] = 0x3E; // F4
|
|
keymapUS[116] = 0x3F; // F5
|
|
keymapUS[117] = 0x40; // F6
|
|
keymapUS[118] = 0x41; // F7
|
|
keymapUS[119] = 0x42; // F8
|
|
keymapUS[120] = 0x43; // F9
|
|
keymapUS[121] = 0x44; // F10
|
|
keymapUS[122] = 0x57; // F11
|
|
keymapUS[123] = 0x58; // F12
|
|
|
|
var ctrlkeymapUS = [];
|
|
|
|
ctrlkeymapUS[65] = 0x1E; // a
|
|
ctrlkeymapUS[81] = 0x10; // q
|
|
ctrlkeymapUS[87] = 0x11; // w
|
|
ctrlkeymapUS[69] = 0x12; // e
|
|
ctrlkeymapUS[82] = 0x13; // r
|
|
ctrlkeymapUS[84] = 0x14; // t
|
|
ctrlkeymapUS[89] = 0x15; // y
|
|
ctrlkeymapUS[85] = 0x16; // u
|
|
ctrlkeymapUS[73] = 0x17; // i
|
|
ctrlkeymapUS[79] = 0x18; // o
|
|
ctrlkeymapUS[80] = 0x19; // p
|
|
ctrlkeymapUS[65] = 0x1E; // a
|
|
ctrlkeymapUS[83] = 0x1F; // s
|
|
ctrlkeymapUS[68] = 0x20; // d
|
|
ctrlkeymapUS[70] = 0x21; // f
|
|
ctrlkeymapUS[71] = 0x22; // g
|
|
ctrlkeymapUS[72] = 0x23; // h
|
|
ctrlkeymapUS[74] = 0x24; // j
|
|
ctrlkeymapUS[75] = 0x25; // k
|
|
ctrlkeymapUS[76] = 0x26; // l
|
|
ctrlkeymapUS[90] = 0x2C; // z
|
|
ctrlkeymapUS[88] = 0x2D; // x
|
|
ctrlkeymapUS[67] = 0x2E; // c
|
|
//ctrlkeymapUS[86] = 0x2F; // v to enable set disableClipboard = true in run.js
|
|
ctrlkeymapUS[66] = 0x30; // b
|
|
ctrlkeymapUS[78] = 0x31; // n
|
|
ctrlkeymapUS[77] = 0x32; // m
|
|
|
|
var reservedCtrlKeymap = [];
|
|
reservedCtrlKeymap[86] = 0x2F; //v
|
|
|
|
|
|
return {
|
|
getKeymap: function() {
|
|
return keymapUS;
|
|
},
|
|
|
|
getCtrlKeymap: function() {
|
|
return ctrlkeymapUS;
|
|
},
|
|
|
|
getReservedCtrlKeymap: function() {
|
|
return reservedCtrlKeymap;
|
|
},
|
|
|
|
getCharmap: function() {
|
|
return charmapUS;
|
|
},
|
|
|
|
setCtrlKey: function (key, val) {
|
|
ctrlkeymapUS[key] = val;
|
|
}
|
|
};
|
|
}( );
|