Commit 8580b989 authored by Joel Martin's avatar Joel Martin

Got DES encryption of password working and colors corrected.

- DES encryption for VNC bit mirrors every bytes of the password. This
  commit has a hard-coded mirrored password. Need to ask user and bit
  mirror it.

- With image data across the wire it's Blue,Green,Red, so twiddle
  things around a bit.
parent 64ab5c4d
...@@ -123,9 +123,9 @@ init: function (canvas, width, height, keyDown, keyUp, mouseDown, mouseUp) { ...@@ -123,9 +123,9 @@ init: function (canvas, width, height, keyDown, keyUp, mouseDown, mouseUp) {
rfbImage: function(x, y, width, height, arr) { rfbImage: function(x, y, width, height, arr) {
var img = Canvas.ctx.createImageData(width, height); var img = Canvas.ctx.createImageData(width, height);
for (var i=0; i < (width * height); i++) { for (var i=0; i < (width * height); i++) {
img.data[i*4 + 0] = arr[i*4 + 0]; img.data[i*4 + 0] = arr[i*4 + 2];
img.data[i*4 + 1] = arr[i*4 + 1]; img.data[i*4 + 1] = arr[i*4 + 1];
img.data[i*4 + 2] = arr[i*4 + 2]; img.data[i*4 + 2] = arr[i*4 + 0];
img.data[i*4 + 3] = 255; // Set Alpha img.data[i*4 + 3] = 255; // Set Alpha
} }
Canvas.ctx.putImageData(img, x, y); Canvas.ctx.putImageData(img, x, y);
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<script src="include/mootools.js"></script> <script src="include/mootools.js"></script>
<script src="include/mootools-more.js"></script> <script src="include/mootools-more.js"></script>
<script src="include/base64a.js"></script> <script src="include/base64a.js"></script>
<script src="include/des2.js"></script> <script src="include/des3.js"></script>
<script src="canvas.js"></script> <script src="canvas.js"></script>
<script src="vnc.js"></script> <script src="vnc.js"></script>
......
...@@ -105,21 +105,20 @@ init_msg: function (data) { ...@@ -105,21 +105,20 @@ init_msg: function (data) {
RFB.state = "ServerInitialisation"; RFB.state = "ServerInitialisation";
break; break;
case 2: // VNC authentication case 2: // VNC authentication
var challenge = data.shiftStr(16); var challenge = data.shiftBytes(16);
// TODO:
//var crypt = des(challenge, password);
//RFB.send_string(crypt);
RFB.state = "SecurityResult";
debug("challenge: " + challenge + "(" + challenge.length + ")"); debug("challenge: " + challenge + "(" + challenge.length + ")");
//response = Javacrypt.crypt(challenge, "jdm239").toString(); //response = Javacrypt.crypt(challenge, "jdm239").toString();
//response = Javacrypt.crypt("jdm239", challenge).toString(); //response = Javacrypt.crypt("jdm239", challenge).toString();
//response = des("jdm239", challenge, 1) //response = des("jdm239", challenge, 1)
/* COWCOW bit mirrored */ //
passwd = [194, 242, 234, 194, 242, 234, 0, 0].shiftStr(8); //passwd = [67, 79, 87, 67, 79, 87]; // 'COWCOW'
passwd = [194, 242, 234, 194, 242, 234]; // 'COWCOW' bit mirrored
debug("passwd: " + passwd + "(" + passwd.length + ")"); debug("passwd: " + passwd + "(" + passwd.length + ")");
response = des(passwd, challenge, 1) response = des(passwd, challenge, 1)
debug("reponse: " + response + "(" + response.length + ")"); debug("reponse: " + response + "(" + response.length + ")");
RFB.send_string(response);
RFB.send_array(response);
RFB.state = "SecurityResult";
break; break;
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment