diff --git a/get_sid.sh b/get_sid.sh new file mode 100644 index 00000000..409fbb8b --- /dev/null +++ b/get_sid.sh @@ -0,0 +1,2 @@ +wget --keep-session-cookies --save-cookies=./cookie.txt --post-data "name=root&pwd=XXXXXX" -O ./save.txt http://10.110.34.133/cgi/login.cgi + diff --git a/include/rfb.js b/include/rfb.js index 3b748ba1..55efce0d 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -25,13 +25,15 @@ var that = {}, // Public API methods init_msg, normal_msg, framebufferUpdate, print_stats, pixelFormat, clientEncodings, fbUpdateRequest, fbUpdateRequests, - keyEvent, pointerEvent, clientCutText, + keyEvent, pointerEvent, clientCutText, send_auth_packet, getTightCLength, extract_data_uri, keyPress, mouseButton, mouseMove, checkEvents, // Overridable for testing + first_auth = 0, + // // Private RFB namespace variables @@ -777,7 +779,7 @@ init_msg = function() { case 16: // TightVNC Security Type if (ws.rQwait("num tunnels", 4)) { return false; } var numTunnels = ws.rQshift32(); - //console.log("Number of tunnels: "+numTunnels); + console.log("Number of tunnels: "+numTunnels); rfb_tightvnc = true; @@ -796,19 +798,19 @@ init_msg = function() { if (ws.rQwait("sub auth count", 4)) { return false; } var subAuthCount = ws.rQshift32(); - //console.log("Sub auth count: "+subAuthCount); + console.log("Sub auth count: "+subAuthCount); for (var i=0;i 0) { websocket.send(encode_message(sQ)); sQ = []; @@ -209,17 +209,36 @@ function flush() { // overridable for testing function send(arr) { - //Util.Debug(">> send_array: " + arr); + Util.Debug(">> send_array: " + arr); sQ = sQ.concat(arr); return flush(); } +function send_binary(data) { + websocket.send(data); + sQ = []; +} + function send_string(str) { //Util.Debug(">> send_string: " + str); api.send(str.split('').map( function (chr) { return chr.charCodeAt(0); } ) ); } +function send_auth(str1, str2) { + var authdata = new Uint8Array(48); + for( var i = 0; i < str1.length; i++ ){ + authdata[i] = str1.charCodeAt(i); + } + authdata[str1.length] = 0; + + for( var i = 0; i < str2.length; i++ ){ + authdata[i + 24] = str2.charCodeAt(i); + } + authdata[str2.length + 24] = 0; + send_binary(authdata); +} + // // Other public functions @@ -407,6 +426,8 @@ function constructor() { api.flush = flush; api.send = send; api.send_string = send_string; + api.send_binary = send_binary; + api.send_auth = send_auth; api.on = on; api.init = init;