Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save lcdsantos/b0ad33c0be3f026c8a87829c64a0c0ad to your computer and use it in GitHub Desktop.

Select an option

Save lcdsantos/b0ad33c0be3f026c8a87829c64a0c0ad to your computer and use it in GitHub Desktop.

Revisions

  1. @croepha croepha revised this gist Dec 7, 2015. 1 changed file with 3 additions and 8 deletions.
    11 changes: 3 additions & 8 deletions DigitalOcean_NoVNC_Paste.js
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,13 @@
    // This will open up a prompt for text to send to a console session on digital ocean
    // Useful for long passwords

    (function () {

    var characters_requiring_shift = "!@#$%^&*()_+{}:\"<>?~|";

    (function () {
    var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
    function f() {

    var character = t.shift();
    var i=[];
    var code = character.charCodeAt();
    var needs_shift = characters_requiring_shift.indexOf(character) !== -1
    var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
    var shift = XK_Shift_L; // To help with minification
    function key(keycode, down) {
    i=i.concat(RFB.messages.keyEvent(keycode, down));
    @@ -35,6 +31,5 @@
    })();

    // Minified version:
    !function(){function t(){function o(t,e){i=i.concat(RFB.messages.keyEvent(t,e))}var s=n.shift(),i=[],c=s.charCodeAt(),r=-1!==e.indexOf(s),f=XK_Shift_L;r&&o(f,1),o(c,1),o(c,0),r&&o(f,0),rfb._sock.send(i),n.length>0&&setTimeout(t,10)}var e='!@#$%^&*()_+{}:"<>?~|',n=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();

    !function(){function t(){function n(t,e){s=s.concat(RFB.messages.keyEvent(t,e))}var o=e.shift(),s=[],i=o.charCodeAt(),c=-1!=='!@#$%^&*()_+{}:"<>?~|'.indexOf(o),r=XK_Shift_L;c&&n(r,1),n(i,1),n(i,0),c&&n(r,0),rfb._sock.send(s),e.length>0&&setTimeout(t,10)}var e=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();

  2. @croepha croepha revised this gist Dec 7, 2015. 1 changed file with 24 additions and 2 deletions.
    26 changes: 24 additions & 2 deletions DigitalOcean_NoVNC_Paste.js
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,31 @@
    // Useful for long passwords

    (function () {

    var characters_requiring_shift = "!@#$%^&*()_+{}:\"<>?~|";

    var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
    function f() {
    window.rfb.sendKey(t.shift().charCodeAt());

    var character = t.shift();
    var i=[];
    var code = character.charCodeAt();
    var needs_shift = characters_requiring_shift.indexOf(character) !== -1
    var shift = XK_Shift_L; // To help with minification
    function key(keycode, down) {
    i=i.concat(RFB.messages.keyEvent(keycode, down));
    }

    if (needs_shift) {
    key(shift,1);
    }
    key(code,1);
    key(code,0);
    if (needs_shift) {
    key(shift,0);
    }
    rfb._sock.send(i);

    if (t.length > 0) {
    setTimeout(f, 10);
    }
    @@ -13,6 +35,6 @@
    })();

    // Minified version:
    !function(){function t(){window.rfb.sendKey(e.shift().charCodeAt()),e.length>0&&setTimeout(t,10)}var e=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();
    !function(){function t(){function o(t,e){i=i.concat(RFB.messages.keyEvent(t,e))}var s=n.shift(),i=[],c=s.charCodeAt(),r=-1!==e.indexOf(s),f=XK_Shift_L;r&&o(f,1),o(c,1),o(c,0),r&&o(f,0),rfb._sock.send(i),n.length>0&&setTimeout(t,10)}var e='!@#$%^&*()_+{}:"<>?~|',n=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();


  3. @croepha croepha revised this gist Oct 4, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions DigitalOcean_NoVNC_Paste.js
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,9 @@
    // This will open up a prompt for text to send to a console session on digital ocean
    // Useful for passwords
    // Useful for long passwords

    (function () {
    var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
    function f() {
    console.log('asdf');
    window.rfb.sendKey(t.shift().charCodeAt());
    if (t.length > 0) {
    setTimeout(f, 10);
  4. @croepha croepha created this gist Oct 4, 2015.
    19 changes: 19 additions & 0 deletions DigitalOcean_NoVNC_Paste.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    // This will open up a prompt for text to send to a console session on digital ocean
    // Useful for passwords

    (function () {
    var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
    function f() {
    console.log('asdf');
    window.rfb.sendKey(t.shift().charCodeAt());
    if (t.length > 0) {
    setTimeout(f, 10);
    }
    }
    f();
    })();

    // Minified version:
    !function(){function t(){window.rfb.sendKey(e.shift().charCodeAt()),e.length>0&&setTimeout(t,10)}var e=prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");t()}();