-
-
Save merqlove/add0394df996f0811f898ac3d936907c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will open up a prompt for text to send to a console session on digital ocean | |
// Useful for long passwords | |
(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 = "!@#$%^&*()_+{}:\"<>?~|".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); | |
} | |
} | |
f(); | |
})(); | |
// Minified version: | |
!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()}(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment