mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-24 07:23:06 +03:00
1450 lines
733 KiB
HTML
1450 lines
733 KiB
HTML
<!DOCTYPE html><html lang="en" style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;} a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}.rb{cursor:pointer;border:none;float:right;font-size:130%;margin-right:4px;}.fileIcon1{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb49Y2Sj9LT2f///yH5BAEAAAMALAAAAAAQABAAAAImnI+py+1vhJwyUYAzHTL4D3qdlJWaIFJqmKod607sDKIiDUP63hQAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon2{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAM2xV/Xur+XPgP///yH5BAEAAAMALAAAAAAQABAAAAJD3ISZIGHWUGihznesYDYATFVM+D2hJ4lgN1olxALAtAlmPCJvuMmJd6PJckDYwicrHhTD5o7plJmg0Uc0asNMkphHAQA7);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.fileIcon3{background:url(data:image/gif;base64,R0lGODlhEAAQAJEDAPb19IGBgbq6uv///yH5BAEAAAMALAAAAAAQABAAAAIy3ISpxgcPH2ouQgFEw1YmxnUXKEaaEZZnVWZk66JwzKpvuwZzwOgwb/C1gIOA8Yg8DgoAOw==);height:16px;width:16px;cursor:pointer;border:none;float:left;margin-top:1px;}.filelist{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;cursor:default;-khtml-user-drag:element;background-color:white;clear:both;}.fsize{float:right;text-align:right;width:180px;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div> <input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false"> <span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go14 class=nav1 onclick=go(14)><a>Remote Desktop</a><p id=go24 class=nav1 onclick=go(24)> <a>Files</a><p id=go13 class=nav1 onclick=go(13)><a>Serial-over-LAN</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=position:relative;height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;z-index:1000><div style=float:right><input id=IDERDiskMapButton type=button value="Disk Map" onclick=iderToggleDiskMap()><input type=button value="Stop IDE-R Session" onclick=iderStop()></div><div style=font-size:16px;padding-top:2px> <span id=10></span></div><div id=iderHeatmap style="z-index:1000;position:absolute;top:31px;right:8px;border:1px solid black;box-shadow:0px 0px 10px;border-radius:5px;padding:8px;width:600px;background-color:#99CC99;display:none"><div id=floppyHeatMap style=display:none><div id=floppyHeatMapText style=margin:2px>Floppy, blocks are 512 bytes.</div><canvas id=floppyHeatMapCanvas width=600 height=0></canvas></div><div id=cdromHeatMap style=display:none><div id=cdromHeatMapText style=margin:2px>CDROM, blocks are 2048 bytes.</div><canvas id=cdromHeatMapCanvas width=600 height=0></canvas></div></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden> <b>Running Script</b><span style=overflow:hidden id=12></span></div></div><div id=13 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(13, false)">✖</div><div style=font-size:14px;padding-top:2px> <b>This computer's firmware should be updated, <a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=14 style=width:100%;height:100%><iframe id=15 style=width:100%;height:100%;border:0></iframe></div><div id=16 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=17></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=18></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=19></span><span id=20></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=21></span><span id=22></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=23></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=24 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=25 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(26, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=26></div></div><div id=p13 style=display:none;min-width:780px><h1>Serial-over-LAN Terminal</h1><br><div id=27 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel® AMT Redirection port or Serial-over-LAN feature is disabled<span id=28>, click here to enable it.</span></div></div><div id=29 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input onkeyup=sendTermInputKeys(event) autocorrect=off autocapitalize=off style=opacity:0;width:0;height:0;font-size:1px onblur="keyInputBlur()"><span id=30></span> <div id=termRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px><input type=button id=c1 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c2 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) style=margin-right:3px><input id=c3 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value="Start Capture" title="Toggle start/stop of terminal capture, when stopping the content of the capture buffer will be saved to a file." onclick=terminalCaptureToggle(event) style=margin-right:3px></div><div> <input type=button id=c4 value=Connect onclick=connectTerminal(event) disabled="disabled"> <span id=31>Disconnected.</span></div><tr><td style=background:#000;text-align:center><pre id=Term></pre><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><input id=32 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value=CR+LF title="Toggle what the return key will send" onclick="termToggleCr();Q(32).blur()"><input id=33 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=80x25 title="Toggle terminal size" onclick="termToggleSize();Q(33).blur()"><input id=34 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx();Q(34).blur()"><input id=35 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class=bottombutton value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType();Q(35).blur()"> </div><div> <input id=36 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-C onclick="termSendKey(3);Q(36).blur()"><input id=37 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Ctl-X onclick="termSendKey(24);Q(37).blur()"><input id=38 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=ESC onclick="termSendKey(27);Q(38).blur()"><input id=39 type=button onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class=bottombutton value=Backspace onclick="termSendKey(8);Q(39).blur()"><input id=40 type=button onkeypress="return false" onkeydown="return false" class=cadbutton value=Paste disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)"></div></table></div><div id=p14 style=display:none;min-width:780px><div id=41><h1>Remote Desktop</h1><br></div><div id=42 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showFeaturesDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Intel® AMT Redirection port or KVM feature is disabled<span id=43>, click here to enable it.</span></div></div><div id=44 style=max-width:100%;display:none;cursor:pointer;margin-bottom:5px onclick=showPowerActionDlg()><div class=icon2 style=float:left;margin:7px></div><div style=width:auto;border-radius:8px;padding:8px;background-color:lightsalmon>Remote computer is not powered on, click here to issue a power command.</div></div><table cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div style=float:right;text-align:right><span id=45></span> <div class=rb title="Rotate Left" onclick=drotate(-1)>↺</div><div class=rb title="Rotate Right" onclick=drotate(1)>↻</div><div id=deskRecordIcon title="Server is recording this session" style=display:none;float:right;background-color:red;width:12px;height:12px;border-radius:6px;margin-top:5px;margin-right:4px></div><input id=c5 type=button title="Toggle full screen mode" onkeypress="return false" onkeydown="return false" value=Full onclick=deskToggleFull() style=margin-right:3px><input id=c6 type=button title="Save a screenshot of the remote desktop" onkeypress="return false" onkeydown="return false" value=Save... onclick=deskSaveImage() style=margin-right:3px><input type=button value=Settings... title="Edit remote desktop settings" onkeypress="return false" onkeydown="return false" onclick=showDesktopSettings() style=margin-right:3px><input type=button id=c7 value=SIDER title="Start server-side remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderServerStart() style=margin-right:3px><input type=button id=c8 value=IDER title="Start remote disk mount operation" onkeypress="return false" onkeydown="return false" onclick=iderStart(event) style=margin-right:3px><input type=button title="Change the power state of the remote machine" onkeypress="return false" onkeydown="return false" value="Power Actions..." onclick=showPowerActionDlg() style=margin-right:3px></div><div><div id=c9 onclick=deskToggleFull() style=float:left;cursor:pointer;font-size:15px;display:none> ✖</div> <input type=button id=c10 value=Connect onclick=connectDesktopButton(event) onkeypress="return false" onkeydown="return false" disabled="disabled"> <span id=46>Disconnected.</span></div><tr><td id=47 style=background:black;text-align:center;position:relative><canvas id=Desk width=640 height=400 style=-ms-touch-action:none;margin-left:0px oncontextmenu="return false" onmousedown=dmousedown(event) onmouseup=dmouseup(event) onmousemove=dmousemove(event) onmousewheel="dmousewheel(event)" moz-opaque=""></canvas><tr><td style=padding-top:2px;padding-bottom:2px;background:#CCC><div id=48 style=float:right></div><div> <span id=deskkeysspan><select style=margin-left:6px id=deskkeys><option value=0>Win<option value=1>Win+Down<option value=2>Win+Up<option value=3>Win+L<option value=4>Win+M<option value=20>Win+R<option value=23>Win+Left<option value=24>Win+Right<option value=5>Shift+Win+M<option value=19>Alt-Tab<option value=21>Alt-F4<option value=22>Ctrl-W<option value=6>F1<option value=7>F2<option value=8>F3<option value=9>F4<option value=10>F5<option value=11>F6<option value=12>F7<option value=13>F8<option value=14>F9<option value=15>F10<option value=16>F11<option value=17>F12</select><input id=DeskWD type=button value=Send onkeypress="return false" onkeydown="return false" onclick=deskSendKeys()> </span><input id=49 type=button value=Ctrl-Alt-Del onkeypress="return false" onkeydown="return false" onclick=sendCAD()> <input id=50 type=button value=Type onkeypress="return false" onkeydown="return false" onclick=deskShowTypeDialog()> <span id=51><input id=52 type=checkbox>Blank Screen </span><span id=53><input id=54 type=checkbox>View only </span></div></table></div><div id=p15 style=display:none><span id=55></span><h1>Audit Log</h1><span id=56></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=57></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=58></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=59></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=60></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=61></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=62></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=63></span></div><div id=p24 style=display:none;position:absolute;top:0px;bottom:0px;left:8px;right:24px><h1>Files</h1><br><table id=p24toolbar style=width:100%;position:absolute;top:35px cellpadding=0 cellspacing=0><tr><td style=width:100%;background-color:#d3d9d6;text-align:left;padding:4px valign="bottom"><div id=p24rightOfButtons style=float:right;margin-top:3px></div><div><input type=button id=p24FolderUp disabled="disabled" onclick=p24folderup() value=Up> <input type=button id=p24SelectAllButton disabled="disabled" onclick=p24selectallfile() value="Select All" onkeypress="return false" onkeydown="return false"> <input type=button id=p24RenameFileButton disabled="disabled" value=Rename onclick=p24renamefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24DeleteFileButton disabled="disabled" value=Delete onclick=p24deletefile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24NewFolderButton disabled="disabled" value="New Folder" onclick=p24createfolder() onkeypress="return false" onkeydown="return false"> <input type=button id=p24UploadButton disabled="disabled" value=Upload onclick=p24uploadFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24CutButton disabled="disabled" value=Cut onclick=p24copyFile(1) onkeypress="return false" onkeydown="return false"> <input type=button id=p24CopyButton disabled="disabled" value=Copy onclick=p24copyFile(0) onkeypress="return false" onkeydown="return false"> <input type=button id=p24PasteButton disabled="disabled" value=Paste onclick=p24pasteFile() onkeypress="return false" onkeydown="return false"> <input type=button id=p24RefreshButton disabled="disabled" value=Refresh onclick=p24folderup(9999) onkeypress="return false" onkeydown="return false"> </div><tr><td style=background-color:#E4E9E7;height:28px><div style=float:right;margin-right:4px><select id=p24sortdropdown onchange=p24updateFiles()><option value=1 selected="selected">Sort by name<option value=2>Sort by size<option value=3>Sort by date<option value=4>Descend by name<option value=5>Descend by size<option value=6>Descend by date</select></div><div> <span id=p24currentpath></span></div></table><div id=p24filetable style=width:100%;overflow:auto;-webkit-user-select:none;position:absolute;top:92px;bottom:30px><div id=p24bigok style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✓</b></div><div id=p24bigfail style=width:256px;overflow:hidden;position:absolute;top:80px;width:100%;text-align:center;font-size:1600%;color:#AAAAAA;display:none><b>✗</b></div><span id=p24files></span></div><table id=p24toolbarBottom style=width:100%;position:absolute;bottom:10px cellpadding=0 cellspacing=0><tr><td style=text-align:left;padding:3px;text-align:center;background-color:#D3D9D6> <span id=p24bottomstatus></span></table></div></div></div></div><div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial, Helvetica, sans-serif;border-radius:5px;position:fixed;overflow:hidden;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=64 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>✖</div><div id=65 style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=66 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=67><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=68 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&*()+-</div></div><div id=dialog3 style=margin:auto;text-align:center;margin:3px><textarea id=d3pastetextarea maxlength="4096" style=width:100%;height:200px;resize:none></textarea></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="if (event.keyCode == 13) return dialogclose(1); else return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog7 style=margin:auto;margin:3px><br><div style=height:26px><select id=c11 style=float:right;width:200px><option id=d7exm1 value=5>RLE4G, Gray (Fast)<option id=d7exm2 value=7>RLE8G, Gray<option value=1>RLE8, Color<option value=3>RLE16, Color<option id=d7exm3 value=13>ZRLE8G, Compressed Gray<option id=d7exm4 value=15>ZRLE16G, Compressed Gray<option id=d7exm5 value=9>ZRLE8, Compressed Color<option id=d7exm6 value=11>ZRLE16, Compressed Color<option value=0>RAW8, Color<option value=2>RAW16, Color (Slow)</select><div>Image Encoding</div></div><div style=height:80px><div style="float:right;border:1px solid #666;width:200px;height:80px;overflow-y:scroll;background-color:white"><label><input type=checkbox id=d7showcursor>Show Local Mouse Cursor</label><br><label><input type=checkbox id=d7showcad>Show Ctrl-Alt-Del</label><br><label><input type=checkbox id=d7limitFrameRate>Limit Frame Rate</label><br><label><input type=checkbox id=d7noMouseRotate>Don't Rotate Mouse</label><br></div><div>Other Settings</div></div><div id=d7softkvmsettings style=display:none><h4 style="width:100%;border-bottom:1px solid gray">Software KVM</h4><div style="margin:3px 0 3px 0"><select id=d7bitmapquality style=float:right;width:200px;height:20px dir="rtl"><option value=50>50%<option value=40>40%<option selected="selected" value=30>30%<option value=20>20%<option value=10>10%<option value=5>5%<option value=1>1%</select><div style=height:20px>Quality</div></div><div style="margin:3px 0 3px 0"><select id=d7bitmapscaling style=float:right;width:200px;height:20px dir="rtl"><option selected="selected" value=1024>100%<option value=896>87.5%<option value=768>75%<option value=640>62.5%<option value=512>50%<option value=384>37.5%<option value=256>25%<option value=128>12.5%</select><div style=height:20px>Scaling</div></div></div></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c12 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c13 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><label style=display:block><input type=checkbox id=c14>Redirection Port</label><label id=c15 style=display:block><input type=checkbox id=c16>KVM Remote Desktop</label><label style=display:block><input type=checkbox id=c17>IDE-Redirection<br></label><label style=display:block><input type=checkbox id=c18>Serial-over-LAN<br></label></div><div id=dialog10 style=margin:auto;margin:3px><label><input type=radio name=d10 id=c19 value=0>Not Required<br></label><label><input type=radio name=d10 id=c20 value=1>Required for KVM only<br></label><label><input type=radio name=d10 id=c21 value=4294967295>Always Required<br></label></div><div id=dialog11 style=margin:auto;margin:3px><div id=69></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c22 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c23 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c24 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c25 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c26 style=float:right;width:200px onclick=updateWifiDialog()><option id=70 value=4>CCMP-AES<option id=71 value=3>TKIP-RC4<option id=72 value=2>WEP<option id=73 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c27 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c28 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel® AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c29 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><div id=74><label><input type=checkbox name=d21 id=d21ipsync onclick=updateIPSetupDlg()>Operating system IP address sync</label><br></div><label><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span></label><br><label><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span></label><br><div id=75><label><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span></label><br><br><div style=margin-left:20px><div style=height:26px><input id=c30 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=76><input id=c31 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c32 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c33 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c34 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c35 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c36 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c37 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c38 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=10>Reset<option value=5>Power cycle<option value=8>Power down<option id=d24p500 value=500>OS Wake from Standby<option id=d24p501 value=501>OS Power Saving<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c39 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><label><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause</label><br></div><div id=d24dBiosSecureBoot><label><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot</label><br></div><div id=d24dBiosSetup><label><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup</label><br></div><div id=d24dForceProgressEvents><label><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events</label><br></div><div id=d24dLockPowerButton><label><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button</label><br></div><div id=d24dLockResetButton><label><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button</label><br></div><div id=d24dLockSleepButton><label><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button</label><br></div><div id=d24dLockKeyboard><label><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard</label><br></div><div id=d24dUserPasswordBypass><label><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass</label><br></div><div id=d24dReflashBios><label><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS</label><br></div><div id=d24dSafeMode><label><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode</label><br></div><div id=d24dUseIDER><label><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER</label><br></div><div id=d24dSerialOverLan><label><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN</label><br></div><div id=d24dSecureErase><label><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel® Remote Secure Erase</label><br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c40 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option id=ForceDVDBootOption value=1>Force CD/DVD Boot<option id=ForcePXEBootOption value=2>Force PXE Boot<option id=ForceHDBootOption value=3>Force Hard Disk Boot<option id=ForceDiagBootOption value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div id=c41 style=height:26px><select id=c42 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c43 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c44 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c45 value=1>Quiet<option id=c46 value=2>Verbose<option id=c47 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c48 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c49 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c50 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>var $jscomp={scope:{},getGlobal:function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b}};$jscomp.global=$jscomp.getGlobal(this);$jscomp.initSymbol=function(){$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol);$jscomp.initSymbol=function(){}};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return"jscomp_symbol_"+b+$jscomp.symbolCounter_++};
|
|
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();$jscomp.global.Symbol.iterator||($jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));$jscomp.initSymbolIterator=function(){}};
|
|
$jscomp.makeIterator=function(b){$jscomp.initSymbolIterator();if(b[$jscomp.global.Symbol.iterator])return b[$jscomp.global.Symbol.iterator]();if(!(b instanceof Array||"string"==typeof b||b instanceof String))throw new TypeError(b+" is not iterable");var c=0;return{next:function(){return c==b.length?{done:!0}:{done:!1,value:b[c++]}}}};$jscomp.arrayFromIterator=function(b){for(var c,a=[];!(c=b.next()).done;)a.push(c.value);return a};
|
|
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$jscomp.arrayFromArguments=function(b){for(var c=[],a=0;a<b.length;a++)c.push(b[a]);return c};
|
|
$jscomp.inherits=function(b,c){function a(){}a.prototype=c.prototype;b.prototype=new a;b.prototype.constructor=b;for(var d in c)if($jscomp.global.Object.defineProperties){var e=$jscomp.global.Object.getOwnPropertyDescriptor(c,d);void 0!==e&&$jscomp.global.Object.defineProperty(b,d,e)}else b[d]=c[d]};String.prototype.startsWith||(String.prototype.startsWith=function(b){return 0===this.lastIndexOf(b,0)});
|
|
String.prototype.endsWith||(String.prototype.endsWith=function(b){return-1!==this.indexOf(b,this.length-b.length)});function Q(b){return document.getElementById(b)}function QS(b){try{return Q(b).style}catch(c){}}function QE(b,c){try{Q(b).disabled=!c}catch(a){}}function QV(b,c){try{QS(b).display=c?"":"none"}catch(a){}}function QA(b,c){Q(b).innerHTML+=c}function QH(b,c){Q(b).innerHTML=c}function inputBoxFocus(b){Q(b).focus();var c=Q(b).value;Q(b).value="";Q(b).value=c}
|
|
function ReadShort(b,c){return(b.charCodeAt(c)<<8)+b.charCodeAt(c+1)}function ReadShortX(b,c){return(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}function ReadInt(b,c){return 16777216*b.charCodeAt(c)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}function ReadSInt(b,c){return(b.charCodeAt(c)<<24)+(b.charCodeAt(c+1)<<16)+(b.charCodeAt(c+2)<<8)+b.charCodeAt(c+3)}function ReadIntX(b,c){return 16777216*b.charCodeAt(c+3)+(b.charCodeAt(c+2)<<16)+(b.charCodeAt(c+1)<<8)+b.charCodeAt(c)}
|
|
function ShortToStr(b){return String.fromCharCode(b>>8&255,b&255)}function ShortToStrX(b){return String.fromCharCode(b&255,b>>8&255)}function IntToStr(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}function IntToStrX(b){return String.fromCharCode(b&255,b>>8&255,b>>16&255,b>>24&255)}function MakeToArray(b){return b&&null!=b&&"object"!=typeof b?[b]:b}function SplitArray(b){return b.split(",")}function Clone(b){return JSON.parse(JSON.stringify(b))}
|
|
function EscapeHtml(b){if("string"==typeof b)return b.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'");if("boolean"==typeof b||"number"==typeof b)return b}function NoBreak(b){return b.split(" ").join(" ")}function ArrayElementMove(b,c,a){b.splice(a,0,b.splice(c,1)[0])}
|
|
function ObjectToStringEx(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="<br />"+gap(c)+"Item #"+d+": "+ObjectToStringEx(b[d],c+1);else if(b instanceof Object)for(d in b)a+="<br />"+gap(c)+d+" = "+ObjectToStringEx(b[d],c+1);else a+=EscapeHtml(b);return a}
|
|
function ObjectToStringEx2(b,c){var a="";if(0!=b&&(!b||null==b))return"(Null)";if(b instanceof Array)for(var d in b)a+="\r\n"+gap2(c)+"Item #"+d+": "+ObjectToStringEx2(b[d],c+1);else if(b instanceof Object)for(d in b)a+="\r\n"+gap2(c)+d+" = "+ObjectToStringEx2(b[d],c+1);else a+=EscapeHtml(b);return a}function gap(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function gap2(b){for(var c="",a=0;a<4*b;a++)c+=" ";return c}function ObjectToString(b){return ObjectToStringEx(b,0)}
|
|
function ObjectToString2(b){return ObjectToStringEx2(b,0)}function hex2rstr(b){if("string"!=typeof b||0==b.length)return"";var c="";b=(""+b).match(/../g);for(var a;a=b.shift();)c+=String.fromCharCode("0x"+a);return c}function char2hex(b){return(b+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(b){var c="",a;for(a=0;a<b.length;a++)c+=char2hex(b.charCodeAt(a));return c}function encode_utf8(b){return unescape(encodeURIComponent(b))}
|
|
function decode_utf8(b){return decodeURIComponent(escape(b))}function data2blob(b){for(var c=Array(b.length),a=0;a<b.length;a++)c[a]=b.charCodeAt(a);return new Blob([new Uint8Array(c)])}function random(b){return Math.floor(Math.random()*b)}function trademarks(b){return b.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}function format(b){var c=Array.prototype.slice.call(arguments,1);return b.replace(/{(\d+)}/g,function(a,b){return"undefined"!=typeof c[b]?c[b]:a})}
|
|
function makeUefiBootParam(b,c,a){"number"==typeof c&&(1==a&&(c=String.fromCharCode(c&255)),2==a&&(c=ShortToStrX(c)),4==a&&(c=IntToStrX(c)));return ShortToStrX(32902)+ShortToStrX(b)+IntToStrX(c.length)+c}
|
|
var CreateAmtRemoteIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log(arguments)}function c(c,d,F,H){switch(d.charCodeAt(0)){case 0:b("SCSI: TEST_UNIT_READY",c);switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.floppyReady)return e.floppyReady=!0,e.SendCommandEndResponse(1,6,c,40,0),-1;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;if(0==e.cdromReady)return e.cdromReady=!0,e.SendCommandEndResponse(1,6,c,40,
|
|
0),-1;break;default:return b("SCSI Internal error 3",c),-1}e.SendCommandEndResponse(1,0,c,0,0);break;case 8:H=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3);d=d.charCodeAt(4);0==d&&(d=256);b("SCSI: READ_6",c,H,d);a(c,H,d,F);break;case 10:return H=((d.charCodeAt(1)&31)<<16)+(d.charCodeAt(2)<<8)+d.charCodeAt(3),d=d.charCodeAt(4),0==d&&(d=256),b("SCSI: WRITE_6",c,H,d),e.SendCommandEndResponse(1,2,c,58,0),-1;case 26:b("SCSI: MODE_SENSE_6",c);if(63==d.charCodeAt(2)&&0==d.charCodeAt(3)){H=
|
|
d=0;switch(c){case 160:if(null==e.floppy)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=0;H=128;break;case 176:if(null==e.cdrom)return e.SendCommandEndResponse(1,2,c,58,0),-1;d=5;H=128;break;default:return b("SCSI Internal error 6",c),-1}e.SendDataToHost(c,!0,String.fromCharCode(0,d,H,0),F&1);return}e.SendCommandEndResponse(1,5,c,36,0);break;case 27:e.SendCommandEndResponse(1,0,c);break;case 30:b("SCSI: ALLOW_MEDIUM_REMOVAL",c);if(160==c&&null==e.floppy||176==c&&null==e.cdrom)return e.SendCommandEndResponse(1,
|
|
2,c,58,0),-1;e.SendCommandEndResponse(1,0,c,0,0);break;case 35:b("SCSI: READ_FORMAT_CAPACITIES",c);H=ReadShort(d,7);switch(c){case 160:if(null==e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,5,c,36,0),-1;break;default:return b("SCSI Internal error 4",c),-1}e.SendDataToHost(c,!0,IntToStr(8)+String.fromCharCode(0,0,11,64,2,0,2,0),F&1);break;case 37:b("SCSI: READ_CAPACITY",c);d=0;switch(c){case 160:if(null==
|
|
e.floppy||0==e.floppy.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.floppy&&(d=(e.floppy.size>>9)-1);b("DEV_FLOPPY",d);break;case 176:if(null==e.cdrom||0==e.cdrom.size)return e.SendCommandEndResponse(0,2,c,58,0),-1;null!=e.cdrom&&(d=(e.cdrom.size>>11)-1);b("DEV_CDDVD",d);break;default:return b("SCSI Internal error 4",c),-1}b("SCSI: READ_CAPACITY2",c,H);e.SendDataToHost(H,!0,IntToStr(d)+String.fromCharCode(0,0,176==c?8:2,0),F&1);break;case 40:H=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: READ_10",
|
|
c,H,d);a(c,H,d,F);break;case 42:case 46:H=ReadInt(d,2);d=ReadShort(d,7);b("SCSI: WRITE_10",c,H,d);e.SendGetDataFromHost(c,512*d);break;case 67:H=ReadShort(d,7);var u=d.charCodeAt(1)&2,M=d.charCodeAt(2)&7;0==M&&(M=d.charCodeAt(9)>>6);b("SCSI: READ_TOC, dev="+c+", buflen="+H+", msf="+u+", format="+M);switch(c){case 160:return e.SendCommandEndResponse(1,5,c,32,0),-1;case 176:break;default:return b("SCSI Internal error 9",c),-1}1==M?e.SendDataToHost(c,!0,String.fromCharCode(0,10,1,1,0,20,1,0,0,0,0,0),
|
|
F&1):0==M&&(u?e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,2,0,0,20,170,0,0,0,52,19),F&1):e.SendDataToHost(c,!0,String.fromCharCode(0,18,1,1,0,20,1,0,0,0,0,0,0,20,170,0,0,0,0,0),F&1));break;case 70:var M=2!=d.charCodeAt(1),G=ReadShort(d,2);H=ReadShort(d,7);b("SCSI: GET_CONFIGURATION",c,M,G,H);if(0==H)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),F&1),-1;u=IntToStr(8);0==G&&(u+=n);if(1==G||M&&1>G)u+=g;if(2==G||M&&2>G)u+=h;if(3==G||M&&3>G)u+=v;if(16==G||M&&16>G)u+=J;if(30==
|
|
G||M&&30>G)u+=D;if(256==G||M&&256>G)u+=y;if(261==G||M&&261>G)u+=C;u=IntToStr(u.length)+u;u.length>H&&(u=u.substring(0,H));e.SendDataToHost(c,!0,u,F&1);return-1;case 74:b("SCSI: GET_EVENT_STATUS_NOTIFICATION",c,d.charCodeAt(1),d.charCodeAt(4),d.charCodeAt(9));if(1!=d.charCodeAt(1)&&16!=d.charCodeAt(4)){b("SCSI ERROR");e.SendCommandEndResponse(1,5,c,38,1);break}d=0;160==c&&null!=e.floppy?d=2:176==c&&null!=e.cdrom&&(d=2);e.SendDataToHost(c,!0,String.fromCharCode(0,d,128,0),F&1);break;case 76:e.SendCommand(81,
|
|
IntToStrX(0)+IntToStrX(0)+IntToStrX(0)+String.fromCharCode(135,80,3,0,0,0,176,81,5,32,0),!0);break;case 81:return b("SCSI READ_DISC_INFO",c),e.SendCommandEndResponse(0,5,c,32,0),-1;case 85:return b("SCSI ERROR: MODE_SELECT_10",c),e.SendCommandEndResponse(1,5,c,32,0),-1;case 90:b("SCSI: MODE_SENSE_10",c,d.charCodeAt(2)&63);H=ReadShort(d,7);u=null;if(0==H)return e.SendDataToHost(c,!0,IntToStr(60)+IntToStr(8),F&1),-1;H=0;160==c?null!=e.floppy&&(H=e.floppy.size>>9):null!=e.cdrom&&(H=e.cdrom.size>>11);
|
|
switch(d.charCodeAt(2)&63){case 1:u=160==c?2880>=H?z:O:A;break;case 5:160==c&&(u=2880>=H?q:p);break;case 63:u=160==c?2880>=H?m:k:B;break;case 26:176==c&&(u=w);break;case 29:176==c&&(u=l);break;case 42:176==c&&(u=x)}null==u?e.SendCommandEndResponse(0,5,c,32,0):e.SendDataToHost(c,!0,u,F&1);break;default:return b("IDER: Unknown SCSI command",d.charCodeAt(0)),e.SendCommandEndResponse(0,5,c,32,0),-1}return 0}function a(a,b,c,z){var q=null,A=0;160==a&&(q=e.floppy,null!=e.floppy&&(A=e.floppy.size>>9));176==
|
|
a&&(q=e.cdrom,null!=e.cdrom&&(A=e.cdrom.size>>11));if(0>c||b+c>A)return e.SendCommandEndResponse(1,5,a,33,0),0;if(0==c)return e.SendCommandEndResponse(1,0,a,0,0),0;null!=q&&(e.sectorStats&&e.sectorStats(1,160==a?0:1,A,b,c),160==a?(b<<=9,c<<=9):(b<<=11,c<<=11),null!==M?F.push({media:q,dev:a,lba:b,len:c,fr:z}):(M=q,G=a,u=b,R=c,d(z)))}function d(a){var b=R,c=u;R>e.iderinfo.readbfr&&(b=e.iderinfo.readbfr);R-=b;u+=b;var z=new FileReader;z.onload=function(){var b=this.result;"object"==typeof b&&(b=new Uint8Array(b),
|
|
b=String.fromCharCode.apply(null,b));e.SendDataToHost(G,0==R,b,a&1);0<R&&0==H?d(a):(M=null,H?(e.SendCommand(71),F=[],H=!1):0<F.length&&(b=F.shift(),M=b.media,G=b.dev,u=b.lba,R=b.len,d(b.fr)))};z.readAsBinaryString?z.readAsBinaryString(M.slice(c,c+b)):z.readAsArrayBuffer(M.slice(c,c+b))}var e={protocol:3,bytesToAmt:0,bytesFromAmt:0,rx_timeout:3E4,tx_timeout:0,heartbeat:2E4,version:1,acc:"",inSequence:0,outSequence:0,iderinfo:null,enabled:!1,iderStart:0,floppy:null,cdrom:null,floppyReady:!1,cdromReady:!1,
|
|
sectorStats:null},r=null;urlvars&&urlvars.iderlog&&(r=require("fs").createWriteStream(urlvars.iderlog,{flags:"w"}));var p=String.fromCharCode(0,38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),k=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),q=String.fromCharCode(0,38,
|
|
36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),m=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),w=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),l=String.fromCharCode(0,18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),x=String.fromCharCode(0,32,1,128,0,0,0,0,42,
|
|
24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),B=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0);String.fromCharCode(0,0,0,40,0,0,0,8);var n=String.fromCharCode(0,0,3,4,0,8,1,0),g=String.fromCharCode(0,1,3,4,0,0,0,2),h=String.fromCharCode(0,2,3,4,0,0,0,0),v=String.fromCharCode(0,3,3,4,41,0,0,2),J=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),D=String.fromCharCode(0,30,3,0),y=String.fromCharCode(1,0,3,0),C=String.fromCharCode(1,
|
|
5,3,0),z=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),O=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),A=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,0,0,0);e.xxStateChange=function(a){b("IDER-StateChange",a);0==a&&e.Stop();3==a&&e.Start()};e.Start=function(){b("IDER-Start");b(e.floppy,e.cdrom);e.bytesToAmt=0;e.bytesFromAmt=0;e.inSequence=0;e.outSequence=0;F=[];e.SendCommand(64,ShortToStrX(e.rx_timeout)+ShortToStrX(e.tx_timeout)+ShortToStrX(e.heartbeat)+
|
|
IntToStrX(e.version));e.sectorStats&&(e.sectorStats(0,0,e.floppy?e.floppy.size>>9:0),e.sectorStats(0,1,e.cdrom?e.cdrom.size>>11:0))};e.Stop=function(){b("IDER-Stop");e.parent.Stop()};e.ProcessData=function(a){e.bytesFromAmt+=a.length;e.acc+=a;null!=r&&r.write("IDERRECV: "+rstr2hex(a)+"\r\n");for(b("IDER-ProcessData",e.acc.length,rstr2hex(e.acc));;){a=e.ProcessDataEx();if(0==a)break;if(e.inSequence!=ReadIntX(e.acc,4)){b("ERROR: Out of sequence",e.inSequence,ReadIntX(e.acc,4));e.Stop();break}e.inSequence++;
|
|
e.acc=e.acc.substring(a)}};e.SendCommand=function(a,c,z,d){null==c&&(c="");z=50<a&&1==z?2:0;d&&(z+=1);c=String.fromCharCode(a,0,0,z)+IntToStrX(e.outSequence++)+c;e.parent.xxSend(c);e.bytesToAmt+=c.length;null!=r&&r.write("IDERSEND: "+rstr2hex(c)+"\r\n");75!=a&&b("IDER-SendData",c.length,rstr2hex(c))};e.SendCommandEndResponse=function(a,b,c,z,d){a?e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,c,80,0,0,0),!0):e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,
|
|
135,b<<4,3,0,0,0,c,81,b,z,d),!0)};e.SendDataToHost=function(a,b,c,z){var d=z?0:c.length;1==b?e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,z?180:181,0,2,0,d&255,d>>8,a,88,133,0,3,0,0,0,a,80,0,0,0,0,0,0)+c,b,z):e.SendCommand(84,String.fromCharCode(0,c.length&255,c.length>>8,0,z?180:181,0,2,0,d&255,d>>8,a,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0)+c,b,z)};e.SendGetDataFromHost=function(a,b){e.SendCommand(82,String.fromCharCode(0,b&255,b>>8,0,181,0,0,0,b&255,b>>8,a,88,0,0,0,0,0,0,0,0,0,0,0),
|
|
!1)};e.SendDisableEnableFeatures=function(a,b){null==b&&(b="");e.SendCommand(72,String.fromCharCode(a)+b)};e.ProcessDataEx=function(){if(8>e.acc.length)return 0;switch(e.acc.charCodeAt(0)){case 65:if(30>e.acc.length)break;var a=e.acc.charCodeAt(29);if(e.acc.length<30+a)break;e.iderinfo={};e.iderinfo.major=e.acc.charCodeAt(8);e.iderinfo.minor=e.acc.charCodeAt(9);e.iderinfo.fwmajor=e.acc.charCodeAt(10);e.iderinfo.fwminor=e.acc.charCodeAt(11);e.iderinfo.readbfr=ReadShortX(e.acc,16);e.iderinfo.writebfr=
|
|
ReadShortX(e.acc,18);e.iderinfo.proto=e.acc.charCodeAt(21);e.iderinfo.iana=ReadIntX(e.acc,25);b(e.iderinfo);0!=e.iderinfo.proto&&(b("Unknown proto",e.iderinfo.proto),e.Stop());8192<e.iderinfo.readbfr&&(b("Illegal read buffer size",e.iderinfo.readbfr),e.Stop());8192<e.iderinfo.writebfr&&(b("Illegal write buffer size",e.iderinfo.writebfr),e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,
|
|
IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===M?(e.SendCommand(71),b("RESETOCCURED1",a)):(H=!0,b("RESETOCCURED2",a));return 9;case 73:if(13>e.acc.length)break;var a=e.acc.charCodeAt(8),z=ReadIntX(e.acc,9);b("STATUS_DATA",a,z);switch(a){case 1:z&1&&(0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):
|
|
2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:e.enabled=z&2?!0:!1;b("IDER Status: "+e.enabled);break;case 3:1!=z&&b("Register toggle failure")}return 13;case 74:if(11>e.acc.length)break;b("IDER: ABORT",e.acc.charCodeAt(8));return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=e.acc.charCodeAt(14)&16?176:160,z=e.acc.charCodeAt(14),d=e.acc.substring(16,28),q=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(d),q,z);c(a,d,q,z);return 28;case 83:if(14>e.acc.length)break;
|
|
a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};var F=[],H=!1,M=null,G,u,R;return e},CreateAmtRemoteServerIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,iderStart:0,floppy:null,cdrom:null,state:0,
|
|
onStateChanged:null,m:{sectorStats:null,onDialogPrompt:null,dialogPrompt:function(a){c.socket.send(JSON.stringify({action:"dialogResponse",args:a}))},bytesToAmt:0,bytesFromAmt:0,server:!0,Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c,c.state)},Start:function(a,d,e,r,p){b("SIDER-Start",a,d,e,r,p);c.host=a;c.port=d;c.user=e;c.pass=r;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http",
|
|
"ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+p+("*"==e?"&serverauth=1":"")+("undefined"===typeof r?"&serverauth=1&user="+e:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)},Stop:function(){b("SIDER-Stop");null!=c.socket&&(c.socket.close(),c.socket=null);c.xxStateChange(0)},xxOnSocketConnected:function(){c.xxStateChange(2);
|
|
c.socket.send(JSON.stringify({action:"start"}))},xxOnMessage:function(a){var b=null;try{b=JSON.parse(a.data)}catch(e){}if(null!=b&&"string"==typeof b.action)switch(b.action){case "dialog":if(null!=c.m.onDialogPrompt)c.m.onDialogPrompt(c,b.args,b.buttons);break;case "state":2==b.state&&c.xxStateChange(3);break;case "stats":c.m.bytesToAmt=b.toAmt;c.m.bytesFromAmt=b.fromAmt;c.m.sectorStats&&c.m.sectorStats(b.mode,b.dev,b.total,b.start,b.len);break;case "error":console.log("IDER Error: "+";Floppy disk image does not exist;Invalid floppy disk image;Unable to open floppy disk image;CDROM disk image does not exist;Invalid CDROM disk image;Unable to open CDROM disk image;Can't perform IDER with no disk images".split(";")[b.code]);
|
|
break;default:console.log("Unknown Server IDER action: "+b.action),breal}},xxOnSocketClosed:function(){c.Stop()}};return c},CreateWsmanComm=function(b,c,a,d,e){function r(a){return a.split(",").reduce(function(a,b){a.ic?a.st[a.st.length-1]+=","+b:a.st.push(b);0==b.split('"').length%2&&(a.ic=!a.ic);return a},{st:[],ic:!1}).st}function p(){m.socketState=2;m.socketParseState=0;m.socketAccumulator="";m.socketHeader=null;m.socketData="";for(i in m.pendingAjaxCall)m.sendRequest(m.pendingAjaxCall[i][0],
|
|
m.pendingAjaxCall[i][3],m.pendingAjaxCall[i][4])}function k(a){var b=m.socketAccumulator;a=new Uint8Array(a.data);a=String.fromCharCode.apply(null,a);for(m.socketAccumulator=b+a;;){if(0==m.socketParseState){b=m.socketAccumulator.indexOf("\r\n\r\n");if(0>b)break;m.socketHeader=m.socketAccumulator.substring(0,b).split("\r\n");if(null==m.amtVersion)for(var c in m.socketHeader)0==m.socketHeader[c].indexOf("Server: Intel(R) Active Management Technology ")&&(m.amtVersion=m.socketHeader[c].substring(46));
|
|
m.socketAccumulator=m.socketAccumulator.substring(b+4);m.socketParseState=1;m.socketData="";m.socketXHeader={Directive:m.socketHeader[0].split(" ")};for(c in m.socketHeader)0!=c&&(b=m.socketHeader[c].indexOf(":"),m.socketXHeader[m.socketHeader[c].substring(0,b).toLowerCase()]=m.socketHeader[c].substring(b+2))}if(1==m.socketParseState){b=-1;if(void 0==m.socketXHeader.connection||"close"!=m.socketXHeader.connection.toLowerCase()||void 0!=m.socketXHeader["transfer-encoding"]&&"chunked"==m.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=
|
|
m.socketXHeader["content-length"]){b=parseInt(m.socketXHeader["content-length"]);if(m.socketAccumulator.length<b)break;a=m.socketAccumulator.substring(0,b);m.socketAccumulator=m.socketAccumulator.substring(b);m.socketData=a;b=0}else{var d=m.socketAccumulator.indexOf("\r\n");if(0>d)break;b=parseInt(m.socketAccumulator.substring(0,d),16);if(isNaN(b)){m.websocket&&m.websocket.close();break}if(m.socketAccumulator.length<d+2+b+2)break;a=m.socketAccumulator.substring(d+2,d+2+b);m.socketAccumulator=m.socketAccumulator.substring(d+
|
|
2+b+2);m.socketData+=a}else b=0;if(0==b){d=m.socketXHeader;b=m.socketData;urlvars&&urlvars.wsmantrace&&console.log("WSMAN-RECV("+b.length+"): "+b);a=parseInt(d.Directive[1]);isNaN(a)&&(a=602);if(401==a&&3>++m.authcounter){if(m.challengeParams=m.parseDigest(d["www-authenticate"]),null!=m.challengeParams.qop){b=m.challengeParams.qop.split(",");a=void 0;for(a in b)b[a]=b[a].trim();0<=b.indexOf("auth-int")?m.challengeParams.qop="auth-int":m.challengeParams.qop="auth"}}else d=m.pendingAjaxCall.shift(),
|
|
m.authcounter=0,m.ActiveAjaxCount--,m.gotNextMessages(b,"success",{status:a},d),m.PerformNextAjax();m.socketParseState=0;m.socketHeader=null}}}}function q(a){0==m.inDataCount&&(m.tlsv1only=1-m.tlsv1only);m.socketState=0;null!=m.socket&&(m.socket.close(),m.socket=null);if(0<m.pendingAjaxCall.length){a=m.pendingAjaxCall.shift();var b=a[5];m.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var m={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,
|
|
authcounter:0,socket:null,socketState:0};m.host=b;m.port=c;m.user=a;m.pass=d;m.tls=e;m.tlsv1only=0;m.cnonce=Math.random().toString(36).substring(7);m.inDataCount=0;m.amtVersion=null;m.digestRealmMatch=null;m.digestRealm=null;m.PerformAjax=function(a,b,c,d,q,g){m.ActiveAjaxCount<m.MaxActiveAjaxCount&&0==m.PendingAjax.length?m.PerformAjaxEx(a,b,c,q,g):1==d?m.PendingAjax.unshift([a,b,c,q,g]):m.PendingAjax.push([a,b,c,q,g])};m.PerformNextAjax=function(){if(!(m.ActiveAjaxCount>=m.MaxActiveAjaxCount||0==
|
|
m.PendingAjax.length)){var a=m.PendingAjax.shift();m.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);m.PerformNextAjax()}};m.PerformAjaxEx=function(a,b,c,d,q){if(0!=m.FailAllError)m.gotNextMessagesError({status:m.FailAllError},"error",null,[a,b,c,d,q]);else return a||(a=""),urlvars&&urlvars.wsmantrace&&console.log("WSMAN-SEND("+a.length+"): "+a),m.ActiveAjaxCount++,m.PerformAjaxExNodeJS(a,b,c,d,q)};m.pendingAjaxCall=[];m.PerformAjaxExNodeJS=function(a,b,c,d,q){m.PerformAjaxExNodeJS2(a,b,c,d,q,5)};m.PerformAjaxExNodeJS2=
|
|
function(a,b,c,d,q,g){0>=g||0!=m.FailAllError?(m.ActiveAjaxCount--,999!=m.FailAllError&&m.gotNextMessages(null,"error",{status:0==m.FailAllError?408:m.FailAllError},[a,b,c,d,q]),m.PerformNextAjax()):(m.pendingAjaxCall.push([a,b,c,d,q,g]),0==m.socketState?m.xxConnectHttpSocket():2==m.socketState&&m.sendRequest(a,d,q))};m.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var d=c+" "+b+" HTTP/1.1\r\n";if(null!=m.challengeParams){m.digestRealm=m.challengeParams.realm;if(m.digestRealmMatch&&m.digestRealm!=
|
|
m.digestRealmMatch){m.FailAllError=997;m.CancelAllQueries(997);return}c=hex_md5(hex_md5(m.user+":"+m.challengeParams.realm+":"+m.pass)+":"+m.challengeParams.nonce+":"+m.noncecounter+":"+m.cnonce+":"+m.challengeParams.qop+":"+hex_md5(c+":"+b+("auth-int"==m.challengeParams.qop?":"+hex_md5(a):"")));d+="Authorization: "+m.renderDigest({username:m.user,realm:m.challengeParams.realm,nonce:m.challengeParams.nonce,uri:b,qop:m.challengeParams.qop,response:c,nc:m.noncecounter++,cnonce:m.cnonce})+"\r\n"}a=d+=
|
|
"Host: "+m.host+":"+m.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==m.socketState&&null!=m.socket&&m.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(d=0;d<a.length;++d)b[d]=a.charCodeAt(d);try{m.socket.send(b.buffer)}catch(q){}}};m.parseDigest=function(a){return r(a.substring(7)).reduce(function(a,b){var c=b.trim().split("=");a[c[0]]=c[1].replace(RegExp('"',"g"),"");return a},{})};m.renderDigest=function(a){var b=[];for(i in a)b.push(i);return"Digest "+b.reduce(function(b,
|
|
c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};m.xxConnectHttpSocket=function(){m.inDataCount=0;m.socketState=1;m.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+m.host+"&port="+m.port+"&tls="+m.tls+"&tls1only="+m.tlsv1only+("*"==a?"&serverauth=1":"")+("undefined"===typeof d?"&serverauth=1&user="+a:""));m.socket.binaryType="arraybuffer";m.socket.onopen=
|
|
p;m.socket.onmessage=k;m.socket.onclose=q};m.gotNextMessages=function(a,b,c,d){if(999!=m.FailAllError)if(0!=m.FailAllError)d[1](null,m.FailAllError,d[2]);else d[1](a,c.status,d[2])};m.gotNextMessagesError=function(a,b,c,d){if(999!=m.FailAllError)if(0!=m.FailAllError)d[1](null,m.FailAllError,d[2]);else d[1](m,null,{Header:{HttpError:a.status}},a.status,d[2])};m.CancelAllQueries=function(a){for(;0<m.PendingAjax.length;){var b=m.PendingAjax.shift();b[1](null,a,b[2])}null!=m.websocket&&(m.websocket.close(),
|
|
m.websocket=null,m.socketState=0)};return m},CreateAmtRedirect=function(b,c){function a(a){return String.fromCharCode.apply(null,a)}var d={};d.m=b;b.parent=d;d.authCookie=c;d.State=0;d.socket=null;d.host=null;d.port=0;d.user=null;d.pass=null;d.authuri="/RedirectionService";d.tlsv1only=0;d.inDataCount=0;d.connectstate=0;d.protocol=b.protocol;d.acc=null;d.amtsequence=1;d.amtkeepalivetimer=null;d.onStateChanged=null;d.Start=function(a,b,p,k,q){d.host=a;d.port=b;d.user=p;d.pass=k;d.connectstate=0;d.inDataCount=
|
|
0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+q+("*"==p?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+p:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};
|
|
d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=
|
|
b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var p=new Uint8Array(d.acc);switch(p[0]){case 17:if(4>p.byteLength)return;switch(p[1]){case 0:if(13>p.byteLength)return;b=p[12];if(p.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>p.byteLength)return;b=(new DataView(d.acc)).getUint32(5,
|
|
!0);if(p.byteLength<9+b)return;var k=p[1],c=p[4],q=[];for(i=0;i<b;i++)q.push(p[9+i]);p=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=q.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):0<=q.indexOf(3)?d.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(d.user.length+d.authuri.length+7)+String.fromCharCode(d.user.length)+
|
|
d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0)):0<=q.indexOf(1)?d.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(d.user.length+d.pass.length+2)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(d.pass.length)+d.pass):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+
|
|
ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var m=0,q=p[m],k=a(new Uint8Array(p.buffer.slice(m+1,m+1+q))),m=m+(q+1),w=p[m],q=a(new Uint8Array(p.buffer.slice(m+1,m+1+w))),m=m+(w+1),w=0,w=null,l;l="";for(var x=0;32>x;x++)l+="abcdef0123456789".charAt(Math.floor(16*Math.random()));x="";4==c&&(w=p[m],w=a(new Uint8Array(p.buffer.slice(m+1,m+1+w))),x="00000002:"+l+":"+w+":");p=hex_md5(hex_md5(d.user+
|
|
":"+k+":"+d.pass)+":"+q+":"+x+hex_md5("POST:"+d.authuri));m=d.user.length+k.length+q.length+d.authuri.length+l.length+8+p.length+7;4==c&&(m+=w.length+1);p=String.fromCharCode(19,0,0,0,c)+IntToStrX(m)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(q.length)+q+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(l.length)+l+String.fromCharCode(8)+"00000002"+String.fromCharCode(p.length)+p;4==c&&(p+=String.fromCharCode(w.length)+w);d.xxSend(p)}break;
|
|
case 33:if(23>p.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>p.byteLength)break;b=10;break;case 42:if(10>p.byteLength)break;c=10+(p[9]<<8)+p[8];if(p.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(p.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(p.buffer.slice(10,
|
|
c))));b=c;break;case 43:if(8>p.byteLength)break;b=8;break;case 65:if(8>p.byteLength)break;d.connectstate=1;d.m.Start();8<p.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(p.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(p.buffer.slice(8)))));b=p.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+p[0]+" acclen="+p.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=
|
|
function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,
|
|
0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=
|
|
d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,e,r){function p(a){for(var b,
|
|
c={},d=0;d<a.childNodes.length;d++){var q=a.childNodes[d];b=null==q.childElementCount||0==q.childElementCount?q.textContent:p(q);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var g=b;if(null!=q.attributes&&0<q.attributes.length)for(g={Value:b},b=0;b<q.attributes.length;b++)g["@"+q.attributes[b].name]=q.attributes[b].value;c[q.localName]instanceof Array?c[q.localName].push(g):c[q.localName]=null==c[q.localName]?g:[c[q.localName],g]}return c}function k(a){if(!a)return"";var b=
|
|
"",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function q(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var b="<w:SelectorSet>",c;for(c in a)if(a.hasOwnProperty(c)){b+='<w:Selector Name="'+c+'">';if(a[c].ReferenceParameters){var b=b+"<a:EndpointReference>",b=b+("<a:Address>"+a[c].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+
|
|
a[c].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),d=a[c].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(d))for(var q=0;q<d.length;q++)b+="<w:Selector"+k(d[q])+">"+d[q].Value+"</w:Selector>";else b+="<w:Selector"+k(d)+">"+d.Value+"</w:Selector>";b+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else b+=a[c];b+="</w:Selector>"}return b+"</w:SelectorSet>"}var m={NextMessageId:1,Address:"/wsman"};m.comm=CreateWsmanComm(b,c,a,d,e,r);m.PerformAjax=function(a,
|
|
b,c,d,q){null==q&&(q="");m.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+q+"><Header><a:Action>"+a,function(a,c,d){var q=m.ParseWsman(a);if(null==a||q&&null!=q){if(200!=c){null==q&&(q={Header:{}});q.Header.HttpError=
|
|
c;try{q.Header.WsmanError=q.Body.Reason.Text.Value}catch(n){}}b(m,q.Header.ResourceURI,q,c,d)}else b(m,null,{Header:{HttpError:c}},601,d)},c,d)};m.CancelAllQueries=function(a){m.comm.CancelAllQueries(a)};m.GetNameFromUrl=function(a){var b=a.lastIndexOf("/");return-1==b?a:a.substring(b+1)};m.ExecSubscribe=function(a,b,c,d,n,g,h,e,k,D){var y="",C="";e="";null!=k&&null!=D&&(y='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
|
|
k+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+D+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",C='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=e&&(e="<a:ReferenceParameters><m:arg>"+e+"</m:arg></a:ReferenceParameters>");"PushWithAck"==b?b="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==b&&(b="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
|
|
a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+q(h)+y+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+b+'"><e:NotifyTo><a:Address>'+c+"</a:Address>"+e+"</e:NotifyTo>"+C+"</e:Delivery></e:Subscribe>";m.PerformAjax(a+"</Body></Envelope>",d,n,
|
|
g,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};m.ExecUnSubscribe=function(a,b,c,d,n){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+q(n)+"</Header><Body><e:Unsubscribe/>";m.PerformAjax(a+"</Body></Envelope>",b,c,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
|
|
m.ExecPut=function(a,b,c,d,n,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+q(g)+"</Header><Body>";if(a&&null!=b){var h=m.GetNameFromUrl(a);a="<r:"+h+' xmlns:r="'+a+'">';for(var e in b)if(b.hasOwnProperty(e)&&
|
|
0!==e.indexOf("__")&&0!==e.indexOf("@")&&null!=b[e]&&"function"!==typeof b[e])if("object"===typeof b[e]&&b[e].ReferenceParameters){a+="<r:"+e+"><a:Address>"+b[e].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+b[e].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var J=b[e].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(J))for(var D=0;D<J.length;D++)a+="<w:Selector"+k(J[D])+">"+J[D].Value+"</w:Selector>";else a+="<w:Selector"+k(J)+">"+J.Value+"</w:Selector>";
|
|
a+="</w:SelectorSet></a:ReferenceParameters></r:"+e+">"}else if(Array.isArray(b[e]))for(D=0;D<b[e].length;D++)a+="<r:"+e+">"+b[e][D].toString()+"</r:"+e+">";else a+="<r:"+e+">"+b[e].toString()+"</r:"+e+">";b=a+("</r:"+h+">")}else b="";m.PerformAjax(g+b+"</Body></Envelope>",c,d,n)};m.ExecCreate=function(a,b,c,d,n,g){var h=m.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
|
|
"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+q(g)+"</Header><Body><g:"+h+' xmlns:g="'+a+'">';for(var e in b)a+="<g:"+e+">"+b[e]+"</g:"+e+">";m.PerformAjax(a+"</g:"+h+"></Body></Envelope>",c,d,n)};m.ExecDelete=function(a,b,c,d,n){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +
|
|
"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+q(b)+"</Header><Body /></Envelope>";m.PerformAjax(a,c,d,n)};m.ExecGet=function(a,b,c,d){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",
|
|
b,c,d)};m.ExecMethod=function(a,b,c,d,q,g,h){var e="",k;for(k in c)if(null!=c[k])if(Array.isArray(c[k]))for(var D in c[k])e+="<r:"+k+">"+c[k][D]+"</r:"+k+">";else e+="<r:"+k+">"+c[k]+"</r:"+k+">";m.ExecMethodXml(a,b,e,d,q,g,h)};m.ExecMethodXml=function(a,b,c,d,n,g,h){m.PerformAjax(a+"/"+b+"</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
|
|
q(h)+"</Header><Body><r:"+b+'_INPUT xmlns:r="'+a+'">'+c+"</r:"+b+"_INPUT></Body></Envelope>",d,n,g)};m.ExecEnum=function(a,b,c,d){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
|
|
b,c,d)};m.ExecPull=function(a,b,c,d,q){m.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+m.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+m.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+b+"</EnumerationContext></Pull></Body></Envelope>",
|
|
c,d,q)};m.ParseWsman=function(a){if(null==a)return null;var b={Header:{}};try{if(!a.childNodes){var c=a;if(window.DOMParser)a=(new DOMParser).parseFromString(c,"text/xml");else{var d=new ActiveXObject("Microsoft.XMLDOM");d.async=!1;d.loadXML(c);a=d}}var q=a.getElementsByTagName("Header")[0],g;q||(q=a.getElementsByTagName("a:Header")[0]);if(!q)return null;for(c=0;c<q.childNodes.length;c++){var h=q.childNodes[c];b.Header[h.localName]=h.textContent}var e=a.getElementsByTagName("Body")[0];e||(e=a.getElementsByTagName("a:Body")[0]);
|
|
if(!e)return null;if(0<e.childNodes.length){g=e.childNodes[0].localName;var m=g.indexOf("_OUTPUT");-1!=m&&m==g.length-7&&(g=g.substring(0,g.length-7));b.Header.Method=g;try{b.Body=p(e.childNodes[0])}catch(k){return console.log("_ParseWsmanRec failed",e,k),null}}}catch(k){return console.log("Unable to parse XML: "+a+", "+k),null}return b};return m};
|
|
function AmtStackCreateService(b){function c(){var a=l.GetPendingActions();x<a&&(x=a);null!=l.onProcessChanged&&B!=a&&(B=a,l.onProcessChanged(a,x));0==a&&(x=0)}function a(a,b,c,q,y,h,g){200!=y?(c(l,a,null,y,h),e(1)):null!=b&&"EnumerateResponse"==b.Header.Method&&b.Body.EnumerationContext?l.wsman.ExecPull(q,b.Body.EnumerationContext,function(b,z,q,A){d(a,q,c,z,[],A,h,g)}):(c(l,a,null,603,h),e(1))}function d(a,b,q,A,y,h,g,n){if(200!=h)q(l,a,null,h,g),e(1);else if(null==b||"PullResponse"!=b.Header.Method)q(l,
|
|
a,null,604,g),e(1);else{for(var m in b.Body.Items)if(b.Body.Items[m]instanceof Array)for(var w in b.Body.Items[m])"function"!=typeof b.Body.Items[m][w]&&y.push(b.Body.Items[m][w]);else"function"!=typeof b.Body.Items[m]&&y.push(b.Body.Items[m]);b.Body.EnumerationContext?l.wsman.ExecPull(A,b.Body.EnumerationContext,function(b,c,z,A){d(a,z,q,c,y,A,g,1)}):(e(1),q(l,a,y,h,g),c())}}function e(a){l.ActiveEnumsCount-=a;l.ActiveEnumsCount>=l.MaxActiveEnumsCount||0==l.PendingEnums.length?c():(a=l.PendingEnums.shift(),
|
|
l.Enum(a[0],a[1],a[2]),e(0))}function r(a,b,d,q,y,h,g){l.PendingBatchOperations-=2;var e=b.shift(),n=l.Enum;"*"==e[0]&&(n=l.Get,e=e.substring(1));n(e,function(y,F,e,n,m){m[2][F]={response:null==e?null:e.Body,responses:e,status:n};0==m[1].length||401==n||1!=h&&200!=n&&400!=n?(l.PendingBatchOperations-=2*b.length,c(),d(l,a,m[2],n,q)):(c(),r(a,b,d,q,m[2],g))},[a,b,y],g);c()}function p(a){a.names.length<=a.current?a.callback(l,a.name,a.responses,200,a.tag):(l.wsman.ExecGet(l.CompleteName(a.names[a.current]),
|
|
function(b,c,d,q){null==d||200!=q?a.callback(l,a.name,null,q,a.tag):(a.responses[d.Header.Method]=d,p(a))},a.pri),a.current++);c()}function k(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](l,null,y[2]);else l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,q,y)}function q(a,b,c,d,y){if(200!=d||"0"!=c.Body.ReturnValue)y[0](l,null,y[2]);else{var g,e,n;b=y[2];d=new Date;var w=c.Body.RecordArray;"string"===typeof w&&(c.Body.RecordArray=[c.Body.RecordArray]);for(g in w){a=null;try{a=window.atob(w[g])}catch(v){}if(null!=
|
|
a&&(e=ReadIntX(a,0),0<e&&4294967295>e)){n={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(e+60*d.getTimezoneOffset()))};for(e=13;21>e;e++)n.EventData.push(a.charCodeAt(e));n.EntityStr=h[n.Entity];n.Desc=m(n.EventSensorType,n.EventOffset,n.EventData,n.Entity);
|
|
n.EntityStr||(n.EntityStr="Unknown");b.push(n)}}if(1!=c.Body.NoMoreRecords)l.AMT_MessageLog_GetRecords(c.Body.IterationIdentifier,390,q,[y[0],b,y[2]]);else y[0](l,b,y[2])}}function m(a,b,c,d){if(15==a)return 235==c[0]?"Invalid Data":0==b?n[c[1]]:3==b?170==c[0]&&48==c[1]?format("AMT One Click Recovery: {0}",J[c[2]]):"OEM Specific Firmware Error event":5==b?170==c[0]&&48==c[1]?1==c[2]?format("AMT One Click Recovery: CSME Boot Option {0}:{1} added successfully",c[3],D[c[3]]):7>c[2]?format("AMT One Click Recovery: {0}",
|
|
v[c[2]]):format("AMT One Click Recovery: Unknown progress event {0}",c[2]):"OEM Specific Firmware Progress event":g[c[1]];if(18==a&&170==c[0])return"Agent watchdog "+char2hex(c[4])+char2hex(c[3])+char2hex(c[2])+char2hex(c[1])+"-"+char2hex(c[6])+char2hex(c[5])+"-... changed to "+l.WatchdogCurrentStates[c[7]];if(5==a&&0==b)return"Case intrusion";if(192==a&&0==b&&170==c[0]&&48==c[1]){if(0==c[2])return"A remote Serial Over LAN session was established.";if(1==c[2])return"Remote Serial Over LAN session finished. User control was restored.";
|
|
if(2==c[2])return"A remote IDE-Redirection session was established.";if(3==c[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(c[1]<<24)+(c[2]<<16)+(c[3]<<8)+c[4],b="#"+c[0],170==c[0]&&(b="wired"),4294967293==a?"All received packet filter was matched on "+b+" interface.":4294967292==a?"All outbound packet filter was matched on "+b+" interface.":4294967290==a?"Spoofed packet filter was matched on "+b+" interface.":"Filter "+a+" was matched on "+b+" interface.";
|
|
if(192==a)return 0==c[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==c[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==c[0]&&48==c[1]&&0==c[2]&&0==c[3])return"User request for remote connection.";if(170==c[0]&&32==c[1]&&3==c[2]&&1==c[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";if(170==c[0]&&32==c[1]&&4==c[2]&&0==c[3])return"HWA Error: general error"}return 6==
|
|
a?"Authentication failed "+(c[1]+(c[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function w(a,b,c,d,q){if(200!=d)q[0](l,[],d);else{var h,g,e=q[1],n=new Date,m;if(0<c.Body.RecordsReturned)for(g in c.Body.EventRecords=MakeToArray(c.Body.EventRecords),c.Body.EventRecords){a=null;try{a=window.atob(c.Body.EventRecords[g])}catch(v){console.log(v+
|
|
" "+c.Body.EventRecords[g])}b={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};b.AuditApp=y[b.AuditAppID];b.Event=y[100*b.AuditAppID+b.EventID];b.Event||(b.Event="#"+b.EventID);0==b.InitiatorType&&(h=a.charCodeAt(5),b.Initiator=a.substring(6,6+h),h=6+h);1==b.InitiatorType&&(b.KerberosUserInDomain=ReadInt(a,5),h=a.charCodeAt(9),b.Initiator=GetSidString(a.substring(10,10+h)),h=10+h);2==b.InitiatorType&&(b.Initiator="<i>Local</i>",h=5);3==b.InitiatorType&&(b.Initiator=
|
|
"<i>KVM Default Port</i>",h=5);m=ReadInt(a,h);b.Time=new Date(1E3*(m+60*n.getTimezoneOffset()));h+=4;b.MCLocationType=a.charCodeAt(h++);m=a.charCodeAt(h++);b.NetAddress=a.substring(h,h+m);h+=m;m=a.charCodeAt(h++);b.Ex=a.substring(h,h+m);b.ExStr=l.GetAuditLogExtendedDataStr(100*b.AuditAppID+b.EventID,b.Ex);e.push(b)}if(c.Body.TotalRecordCount>e.length)l.AMT_AuditLog_ReadRecords(e.length+1,w,[q[0],e]);else q[0](l,e,d)}}var l={};l.wsman=b;l.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/",
|
|
"http://intel.com/wbem/wscim/1/ips-schema/1/"];l.PendingEnums=[];l.PendingBatchOperations=0;l.ActiveEnumsCount=0;l.MaxActiveEnumsCount=1;l.onProcessChanged=null;var x=0,B=0;l.GetPendingActions=function(){return 2*l.PendingEnums.length+l.ActiveEnumsCount+l.wsman.comm.PendingAjax.length+l.wsman.comm.ActiveAjaxCount+l.PendingBatchOperations};l.Subscribe=function(a,b,d,q,y,h,g,e,n,m){l.wsman.ExecSubscribe(l.CompleteName(a),b,d,function(b,d,z,h){c();q(l,a,z,h,y)},0,h,g,e,n,m);c()};l.UnSubscribe=function(a,
|
|
b,d,q,y){l.wsman.ExecUnSubscribe(l.CompleteName(a),function(q,A,y,h){c();b(l,a,y,h,d)},0,q,y);c()};l.Get=function(a,b,d,q){l.wsman.ExecGet(l.CompleteName(a),function(q,A,y,h){c();b(l,a,y,h,d)},0,q);c()};l.Put=function(a,b,d,q,y,h){l.wsman.ExecPut(l.CompleteName(a),b,function(b,z,y,h){c();d(l,a,y,h,q)},0,y,h);c()};l.Create=function(a,b,d,q,y){l.wsman.ExecCreate(l.CompleteName(a),b,function(b,z,y,h){c();d(l,a,y,h,q)},0,y);c()};l.Delete=function(a,b,d,q,y){l.wsman.ExecDelete(l.CompleteName(a),b,function(b,
|
|
z,y,h){c();d(l,a,y,h,q)},0,y);c()};l.Exec=function(a,b,d,q,y,h,g){l.wsman.ExecMethod(l.CompleteName(a),b,d,function(b,d,z,h){c();q(l,a,l.CompleteExecResponse(z),h,y)},0,h,g);c()};l.ExecWithXml=function(a,b,d,q,y,h,g){l.wsman.ExecMethodXml(l.CompleteName(a),b,execArgumentsToXml(d),function(b,d,z,h){c();q(l,a,l.CompleteExecResponse(z),h,y)},0,h,g);c()};l.Enum=function(b,d,q,A){l.ActiveEnumsCount<l.MaxActiveEnumsCount?(l.ActiveEnumsCount++,l.wsman.ExecEnum(l.CompleteName(b),function(q,A,y,h,g){c();a(b,
|
|
y,d,A,h,g)},q,A)):l.PendingEnums.push([b,d,q,A]);c()};l.BatchEnum=function(a,b,d,q,y,h){l.PendingBatchOperations+=2*b.length;r(a,Clone(b),d,q,{},y,h);c()};l.BatchGet=function(a,b,d,q,y){p({name:a,names:b,callback:d,current:0,responses:{},tag:q,pri:y});c()};l.CompleteName=function(a){if(0==a.indexOf("AMT_"))return l.pfx[0]+a;if(0==a.indexOf("CIM_"))return l.pfx[1]+a;if(0==a.indexOf("IPS_"))return l.pfx[2]+a};l.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=
|
|
l.AmtStatusToStr(a.Body.ReturnValue));return a};l.RequestPowerStateChange=function(a,b){l.CIM_PowerManagementService_RequestPowerStateChange(a,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',
|
|
null,null,b)};l.RequestOSPowerStateChange=function(a,b){l.IPS_PowerManagementService_RequestOSPowerSavingStateChange(a,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',
|
|
null,null,b)};l.SetBootConfigRole=function(a,b){l.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',
|
|
a,b)};l.CancelAllQueries=function(a){l.wsman.CancelAllQueries(a)};l.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdog_AssertPresence=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdog_AddAction=function(a,b,c,d,q,y,
|
|
h,g,e){l.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:d,ActionEac:q},y,h,g,e)};l.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,b,c,d){l.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,b,c,d)};l.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){l.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};l.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){l.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};l.AMT_AgentPresenceWatchdogVA_AssertPresence=
|
|
function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},b)};l.AMT_AgentPresenceWatchdogVA_AddAction=function(a,b,c,d,q,y){l.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:b,EventOnTransition:c,ActionSd:d,ActionEac:q},y)};l.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,b){l.Exec("AMT_AgentPresenceWatchdogVA",
|
|
"DeleteAllActions",{_method_dummy:a},b)};l.AMT_AuditLog_ClearLog=function(a){l.Exec("AMT_AuditLog","ClearLog",{},a)};l.AMT_AuditLog_RequestStateChange=function(a,b,c){l.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_AuditLog_ReadRecords=function(a,b,c){l.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},b,c)};l.AMT_AuditLog_SetAuditLock=function(a,b,c,d){l.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:b,Handle:c},d)};l.AMT_AuditLog_ExportAuditLogSignature=
|
|
function(a,b){l.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},b)};l.AMT_AuditLog_SetSigningKeyMaterial=function(a,b,c,d,q){l.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:b,LengthOfCertificates:c,Certificates:d},q)};l.AMT_AuditPolicyRule_SetAuditPolicy=function(a,b,c,d,q){l.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:d},q)};l.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,b,c,d,q){l.Exec("AMT_AuditPolicyRule",
|
|
"SetAuditPolicyBulk",{Enable:a,AuditedAppID:b,EventID:c,PolicyType:d},q)};l.AMT_AuthorizationService_AddUserAclEntryEx=function(a,b,c,d,q,y){l.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:b,KerberosUserSid:c,AccessPermission:d,Realms:q},y)};l.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,b){l.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},b)};l.AMT_AuthorizationService_GetUserAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService",
|
|
"GetUserAclEntryEx",{Handle:a},b,c)};l.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,b,c,d,q,y,h){l.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:b,DigestPassword:c,KerberosUserSid:d,AccessPermission:q,Realms:y},h)};l.AMT_AuthorizationService_RemoveUserAclEntry=function(a,b){l.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},b)};l.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,b,c){l.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
|
|
{Username:a,DigestPassword:b},c)};l.AMT_AuthorizationService_GetAdminAclEntry=function(a){l.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};l.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){l.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};l.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){l.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};l.AMT_AuthorizationService_SetAclEnabledState=function(a,b,c,d){l.Exec("AMT_AuthorizationService",
|
|
"SetAclEnabledState",{Handle:a,Enabled:b},c,d)};l.AMT_AuthorizationService_GetAclEnabledState=function(a,b,c){l.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},b,c)};l.AMT_EndpointAccessControlService_RequestStateChange=function(a,b,c){l.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_EndpointAccessControlService_GetPosture=function(a,b){l.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},b)};l.AMT_EndpointAccessControlService_GetPostureHash=
|
|
function(a,b){l.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},b)};l.AMT_EndpointAccessControlService_UpdatePostureState=function(a,b){l.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},b)};l.AMT_EndpointAccessControlService_GetEacOptions=function(a){l.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};l.AMT_EndpointAccessControlService_SetEacOptions=function(a,b,c){l.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a,
|
|
PostureHashAlgorithm:b},c)};l.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(a,b){l.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:a},b)};l.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(a,b){l.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:a},b)};l.AMT_EthernetPortSettings_SetLinkPreference=function(a,b,c){l.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:a,Timeout:b},c)};l.AMT_GeneralSettings_AMTAuthenticate=
|
|
function(a,b){l.Exec("AMT_GeneralSettings","AMTAuthenticate",{MC_Nonce:a},b)};l.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=function(a,b){l.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:a},b)};l.AMT_KerberosSettingData_GetCredentialCacheState=function(a){l.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},a)};l.AMT_KerberosSettingData_SetCredentialCacheState=function(a,b){l.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:a},
|
|
b)};l.AMT_MessageLog_CancelIteration=function(a,b){l.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:a},b)};l.AMT_MessageLog_RequestStateChange=function(a,b,c){l.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_MessageLog_ClearLog=function(a){l.Exec("AMT_MessageLog","ClearLog",{},a)};l.AMT_MessageLog_GetRecords=function(a,b,c,d){l.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:a,MaxReadRecords:b},c,d)};l.AMT_MessageLog_GetRecord=function(a,
|
|
b,c){l.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:b},c)};l.AMT_MessageLog_PositionAtRecord=function(a,b,c,d){l.Exec("AMT_MessageLog","PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:b,RecordNumber:c},d)};l.AMT_MessageLog_PositionToFirstRecord=function(a,b){l.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,b)};l.AMT_MessageLog_FreezeLog=function(a,b){l.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},b)};l.AMT_PublicKeyManagementService_AddCRL=function(a,b,c){l.Exec("AMT_PublicKeyManagementService",
|
|
"AddCRL",{Url:a,SerialNumbers:b},c)};l.AMT_PublicKeyManagementService_ResetCRLList=function(a,b){l.Exec("AMT_PublicKeyManagementService","ResetCRLList",{_method_dummy:a},b)};l.AMT_PublicKeyManagementService_AddCertificate=function(a,b){l.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},b)};l.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,b){l.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},b)};l.AMT_PublicKeyManagementService_AddKey=
|
|
function(a,b){l.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},b)};l.AMT_PublicKeyManagementService_GeneratePKCS10Request=function(a,b,c,d){l.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:b,Usage:c},d)};l.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,b,c,d){l.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:b,NullSignedCertificateRequest:c},d)};l.AMT_PublicKeyManagementService_GenerateKeyPair=
|
|
function(a,b,c){l.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:b},c)};l.AMT_RedirectionService_RequestStateChange=function(a,b){l.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},b)};l.AMT_RedirectionService_TerminateSession=function(a,b){l.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},b)};l.AMT_RemoteAccessService_AddMpServer=function(a,b,c,d,q,y,h,g,e){l.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:b,
|
|
Port:c,AuthMethod:d,Certificate:q,Username:y,Password:h,CN:g},e)};l.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,b,c,d,q,y){l.Exec("AMT_RemoteAccessService","AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:b,ExtendedData:c,MpServer:d,InternalMpServer:q},y)};l.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,b){l.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_CommitChanges=function(a,b){l.Exec("AMT_SetupAndConfigurationService",
|
|
"CommitChanges",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_Unprovision=function(a,b){l.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},b)};l.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,b){l.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},b)};l.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,b){l.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},b)};
|
|
l.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){l.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},b)};l.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,b){l.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},b)};l.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,b,c){l.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:b},c)};l.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){l.Exec("AMT_SetupAndConfigurationService",
|
|
"GetProvisioningAuditRecord",{},a)};l.AMT_SetupAndConfigurationService_GetUuid=function(a){l.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};l.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){l.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};l.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){l.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};l.AMT_SystemDefensePolicy_GetTimeout=
|
|
function(a){l.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};l.AMT_SystemDefensePolicy_SetTimeout=function(a,b){l.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:a},b)};l.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,d,q,y){l.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,d,q,y)};l.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){l.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};l.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=
|
|
function(a,b){l.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};l.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(a,b,c,d,q){l.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},d,q)};l.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){l.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WebUIService_RequestStateChange=function(a,b,c){l.Exec("AMT_WebUIService",
|
|
"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,d,q,y){l.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:d,CACredential:q},y)};l.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,d,q,y){l.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,
|
|
IEEE8021xSettingsInput:c,ClientCredential:d,CACredential:q},y)};l.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){l.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:a},b)};l.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){l.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},b)};l.CIM_Account_RequestStateChange=function(a,b,c){l.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},
|
|
c)};l.CIM_AccountManagementService_CreateAccount=function(a,b,c){l.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};l.CIM_BootConfigSetting_ChangeBootOrder=function(a,b){l.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};l.CIM_BootService_SetBootConfigRole=function(a,b,c){l.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:b},c,0,1)};l.CIM_Card_ConnectorPower=function(a,b,c){l.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},
|
|
c)};l.CIM_Card_IsCompatible=function(a,b){l.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};l.CIM_Chassis_IsCompatible=function(a,b){l.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};l.CIM_Fan_SetSpeed=function(a,b){l.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},b)};l.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){l.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},c)};l.CIM_MediaAccessDevice_LockMedia=function(a,b){l.Exec("CIM_MediaAccessDevice","LockMedia",
|
|
{Lock:a},b)};l.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){l.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_MediaAccessDevice_Reset=function(a){l.Exec("CIM_MediaAccessDevice","Reset",{},a)};l.CIM_MediaAccessDevice_EnableDevice=function(a,b){l.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},b)};l.CIM_MediaAccessDevice_OnlineDevice=function(a,b){l.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},b)};l.CIM_MediaAccessDevice_QuiesceDevice=function(a,
|
|
b){l.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},b)};l.CIM_MediaAccessDevice_SaveProperties=function(a){l.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};l.CIM_MediaAccessDevice_RestoreProperties=function(a){l.Exec("CIM_MediaAccessDevice","RestoreProperties",{},a)};l.CIM_MediaAccessDevice_RequestStateChange=function(a,b,c){l.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_PhysicalFrame_IsCompatible=function(a,b){l.Exec("CIM_PhysicalFrame",
|
|
"IsCompatible",{ElementToCheck:a},b)};l.CIM_PhysicalPackage_IsCompatible=function(a,b){l.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},b)};l.CIM_PowerManagementService_RequestPowerStateChange=function(a,b,c,d,q){l.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:d},q,0,1)};l.CIM_PowerSupply_SetPowerState=function(a,b,c){l.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_PowerSupply_Reset=function(a){l.Exec("CIM_PowerSupply",
|
|
"Reset",{},a)};l.CIM_PowerSupply_EnableDevice=function(a,b){l.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};l.CIM_PowerSupply_OnlineDevice=function(a,b){l.Exec("CIM_PowerSupply","OnlineDevice",{Online:a},b)};l.CIM_PowerSupply_QuiesceDevice=function(a,b){l.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:a},b)};l.CIM_PowerSupply_SaveProperties=function(a){l.Exec("CIM_PowerSupply","SaveProperties",{},a)};l.CIM_PowerSupply_RestoreProperties=function(a){l.Exec("CIM_PowerSupply","RestoreProperties",
|
|
{},a)};l.CIM_PowerSupply_RequestStateChange=function(a,b,c){l.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_Processor_SetPowerState=function(a,b,c){l.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_Processor_Reset=function(a){l.Exec("CIM_Processor","Reset",{},a)};l.CIM_Processor_EnableDevice=function(a,b){l.Exec("CIM_Processor","EnableDevice",{Enabled:a},b)};l.CIM_Processor_OnlineDevice=function(a,b){l.Exec("CIM_Processor","OnlineDevice",
|
|
{Online:a},b)};l.CIM_Processor_QuiesceDevice=function(a,b){l.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},b)};l.CIM_Processor_SaveProperties=function(a){l.Exec("CIM_Processor","SaveProperties",{},a)};l.CIM_Processor_RestoreProperties=function(a){l.Exec("CIM_Processor","RestoreProperties",{},a)};l.CIM_Processor_RequestStateChange=function(a,b,c){l.Exec("CIM_Processor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_RecordLog_ClearLog=function(a){l.Exec("CIM_RecordLog","ClearLog",
|
|
{},a)};l.CIM_RecordLog_RequestStateChange=function(a,b,c){l.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_RedirectionService_RequestStateChange=function(a,b,c){l.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.CIM_Sensor_SetPowerState=function(a,b,c){l.Exec("CIM_Sensor","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_Sensor_Reset=function(a){l.Exec("CIM_Sensor","Reset",{},a)};l.CIM_Sensor_EnableDevice=function(a,
|
|
b){l.Exec("CIM_Sensor","EnableDevice",{Enabled:a},b)};l.CIM_Sensor_OnlineDevice=function(a,b){l.Exec("CIM_Sensor","OnlineDevice",{Online:a},b)};l.CIM_Sensor_QuiesceDevice=function(a,b){l.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:a},b)};l.CIM_Sensor_SaveProperties=function(a){l.Exec("CIM_Sensor","SaveProperties",{},a)};l.CIM_Sensor_RestoreProperties=function(a){l.Exec("CIM_Sensor","RestoreProperties",{},a)};l.CIM_Sensor_RequestStateChange=function(a,b,c){l.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,
|
|
TimeoutPeriod:b},c)};l.CIM_StatisticalData_ResetSelectedStats=function(a,b){l.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};l.CIM_Watchdog_KeepAlive=function(a){l.Exec("CIM_Watchdog","KeepAlive",{},a)};l.CIM_Watchdog_SetPowerState=function(a,b,c){l.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_Watchdog_Reset=function(a){l.Exec("CIM_Watchdog","Reset",{},a)};l.CIM_Watchdog_EnableDevice=function(a,b){l.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},
|
|
b)};l.CIM_Watchdog_OnlineDevice=function(a,b){l.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};l.CIM_Watchdog_QuiesceDevice=function(a,b){l.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};l.CIM_Watchdog_SaveProperties=function(a){l.Exec("CIM_Watchdog","SaveProperties",{},a)};l.CIM_Watchdog_RestoreProperties=function(a){l.Exec("CIM_Watchdog","RestoreProperties",{},a)};l.CIM_Watchdog_RequestStateChange=function(a,b,c){l.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},
|
|
c)};l.CIM_WiFiPort_SetPowerState=function(a,b,c){l.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};l.CIM_WiFiPort_Reset=function(a){l.Exec("CIM_WiFiPort","Reset",{},a)};l.CIM_WiFiPort_EnableDevice=function(a,b){l.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};l.CIM_WiFiPort_OnlineDevice=function(a,b){l.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};l.CIM_WiFiPort_QuiesceDevice=function(a,b){l.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};l.CIM_WiFiPort_SaveProperties=function(a){l.Exec("CIM_WiFiPort",
|
|
"SaveProperties",{},a)};l.CIM_WiFiPort_RestoreProperties=function(a){l.Exec("CIM_WiFiPort","RestoreProperties",{},a)};l.CIM_WiFiPort_RequestStateChange=function(a,b,c){l.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_HostBasedSetupService_Setup=function(a,b,c,d,q,y,h){l.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:d,SigningAlgorithm:q,DigitalSignature:y},h)};l.IPS_HostBasedSetupService_AddNextCertInChain=
|
|
function(a,b,c,d){l.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},d)};l.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,d,q,y){l.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:d,DigitalSignature:q},y)};l.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,d){l.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,
|
|
DigitalSignature:c},d)};l.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){l.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};l.IPS_KVMRedirectionSettingData_TerminateSession=function(a){l.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};l.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){l.Exec("IPS_KVMRedirectionSettingData","DataChannelRead",{},a)};l.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){l.Exec("IPS_KVMRedirectionSettingData",
|
|
"DataChannelWrite",{DataMessage:a},b)};l.IPS_OptInService_StartOptIn=function(a){l.Exec("IPS_OptInService","StartOptIn",{},a)};l.IPS_OptInService_CancelOptIn=function(a){l.Exec("IPS_OptInService","CancelOptIn",{},a)};l.IPS_OptInService_SendOptInCode=function(a,b){l.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};l.IPS_OptInService_StartService=function(a){l.Exec("IPS_OptInService","StartService",{},a)};l.IPS_OptInService_StopService=function(a){l.Exec("IPS_OptInService","StopService",{},
|
|
a)};l.IPS_OptInService_RequestStateChange=function(a,b,c){l.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,d,q){l.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:d},q,0,1)};l.IPS_ProvisioningRecordLog_RequestStateChange=function(a,b,c){l.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,
|
|
TimeoutPeriod:b},c)};l.IPS_ProvisioningRecordLog_ClearLog=function(a,b){l.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};l.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){l.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};l.IPS_SecIOService_RequestStateChange=function(a,b,c){l.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};l.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,
|
|
b,c,d,q){l.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:d},q)};l.AmtStatusToStr=function(a){return l.AmtStatusCodes[a]?l.AmtStatusCodes[a]:"UNKNOWN_ERROR"};l.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",
|
|
11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",
|
|
32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",
|
|
2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",
|
|
2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};l.GetMessageLog=function(a,b){l.AMT_MessageLog_PositionToFirstRecord(k,[a,b,[]])};var n="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
|
|
g="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;User-initiated system setup;USB resource configuration;PCI resource configuration;Option ROM initialization;Video initialization;Cache initialization;SM Bus initialization;Keyboard controller initialization;Embedded controller/management controller initialization;Docking station attachment;Enabling docking station;Docking station ejection;Disabling docking station;Calling operating system wake-up vector;Starting operating system boot process;Baseboard or motherboard initialization;reserved;Floppy initialization;Keyboard test;Pointing device test;Primary processor initialization".split(";"),
|
|
h="Unspecified;Other;Unknown;Processor;Disk;Peripheral;System management module;System board;Memory module;Processor module;Power supply;Add in card;Front panel board;Back panel board;Power system board;Drive backplane;System internal expansion board;Other system board;Processor board;Power unit;Power module;Power management board;Chassis back panel board;System chassis;Sub chassis;Other chassis board;Disk drive bay;Peripheral bay;Device bay;Fan cooling;Cooling unit;Cable interconnect;Memory device;System management software;BIOS;Intel(r) ME;System bus;Group;Intel(r) ME;External environment;Battery;Processing blade;Connectivity switch;Processor/memory module;I/O module;Processor I/O module;Management controller firmware;IPMI channel;PCI bus;PCI express bus;SCSI bus;SATA/SAS bus;Processor front side bus".split(";");
|
|
l.RealmNames=";;Redirection;;Hardware Asset;Remote Control;Storage;Event Manager;Storage Admin;Agent Presence Local;Agent Presence Remote;Circuit Breaker;Network Time;General Information;Firmware Update;EIT;LocalUN;Endpoint Access Control;Endpoint Access Control Admin;Event Log Reader;Audit Log;ACL Realm;;;Local System".split(";");l.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var v="Boot parameters received from CSME;CSME Boot Option % added successfully;HTTPS URI name resolved;HTTPS connected successfully;HTTPSBoot download is completed;Attempt to boot;Exit boot services".split(";"),
|
|
J=";No network connection available;Name resolution of URI failed;Connect to URI failed;OEM app not found at local URI;HTTPS TLS Auth failed;HTTPS Digest Auth failed;Verified boot failed (bad image);HTTPS Boot File not found".split(";"),D={1:"",2:"HTTPS",4:"Local PBA",8:"WinRE"},y={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",20:"Security Audit Log",21:"Network Time",22:"Network Administration",23:"Storage Administration",24:"Event Manager",25:"Circuit Breaker Manager",
|
|
26:"Agent Presence Manager",27:"Wireless Configuration",28:"EAC",29:"KVM",30:"User Opt-In Events",32:"Screen Blanking",33:"Watchdog Events",1600:"Provisioning Started",1601:"Provisioning Completed",1602:"ACL Entry Added",1603:"ACL Entry Modified",1604:"ACL Entry Removed",1605:"ACL Access with Invalid Credentials",1606:"ACL Entry State",1607:"TLS State Changed",1608:"TLS Server Certificate Set",1609:"TLS Server Certificate Remove",1610:"TLS Trusted Root Certificate Added",1611:"TLS Trusted Root Certificate Removed",
|
|
1612:"TLS Preshared Key Set",1613:"Kerberos Settings Modified",1614:"Kerberos Main Key Modified",1615:"Flash Wear out Counters Reset",1616:"Power Package Modified",1617:"Set Realm Authentication Mode",1618:"Upgrade Client to Admin Control Mode",1619:"Unprovisioning Started",1700:"Performed Power Up",1701:"Performed Power Down",1702:"Performed Power Cycle",1703:"Performed Reset",1704:"Set Boot Options",1800:"IDER Session Opened",1801:"IDER Session Closed",1802:"IDER Enabled",1803:"IDER Disabled",1804:"SoL Session Opened",
|
|
1805:"SoL Session Closed",1806:"SoL Enabled",1807:"SoL Disabled",1808:"KVM Session Started",1809:"KVM Session Ended",1810:"KVM Enabled",1811:"KVM Disabled",1812:"VNC Password Failed 3 Times",1900:"Firmware Updated",1901:"Firmware Update Failed",2E3:"Security Audit Log Cleared",2001:"Security Audit Policy Modified",2002:"Security Audit Log Disabled",2003:"Security Audit Log Enabled",2004:"Security Audit Log Exported",2005:"Security Audit Log Recovered",2100:"Intel® ME Time Set",2200:"TCPIP Parameters Set",
|
|
2201:"Host Name Set",2202:"Domain Name Set",2203:"VLAN Parameters Set",2204:"Link Policy Set",2205:"IPv6 Parameters Set",2300:"Global Storage Attributes Set",2301:"Storage EACL Modified",2302:"Storage FPACL Modified",2303:"Storage Write Operation",2400:"Alert Subscribed",2401:"Alert Unsubscribed",2402:"Event Log Cleared",2403:"Event Log Frozen",2500:"CB Filter Added",2501:"CB Filter Removed",2502:"CB Policy Added",2503:"CB Policy Removed",2504:"CB Default Policy Set",2505:"CB Heuristics Option Set",
|
|
2506:"CB Heuristics State Cleared",2600:"Agent Watchdog Added",2601:"Agent Watchdog Removed",2602:"Agent Watchdog Action Set",2700:"Wireless Profile Added",2701:"Wireless Profile Removed",2702:"Wireless Profile Updated",2800:"EAC Posture Signer SET",2801:"EAC Enabled",2802:"EAC Disabled",2803:"EAC Posture State",2804:"EAC Set Options",2900:"KVM Opt-in Enabled",2901:"KVM Opt-in Disabled",2902:"KVM Password Changed",2903:"KVM Consent Succeeded",2904:"KVM Consent Failed",3E3:"Opt-In Policy Change",3001:"Send Consent Code Event",
|
|
3002:"Start Opt-In Blocked Event"};l.GetAuditLogExtendedDataStr=function(a,b){if((1602==a||1604==a)&&0==b.charCodeAt(0))return b.substring(2,2+b.charCodeAt(1));if(1603==a)return 0==b.charCodeAt(1)?b.substring(3):null;if(1605==a)return["Invalid ME access","Invalid MEBx access"][b.charCodeAt(0)];if(1606==a){var c=["Disabled","Enabled"][b.charCodeAt(0)];0==b.charCodeAt(1)&&(c+=", "+b.substring(3));return c}return 1607==a?"Remote "+["NoAuth","ServerAuth","MutualAuth"][b.charCodeAt(0)]+", Local "+["NoAuth",
|
|
"ServerAuth","MutualAuth"][b.charCodeAt(1)]:1617==a?l.RealmNames[ReadInt(b,0)]+", "+["NoAuth","Auth","Disabled"][b.charCodeAt(4)]:1619==a?["BIOS","MEBx","Local MEI","Local WSMAN","Remote WSAMN"][b.charCodeAt(0)]:1900==a?"From "+ReadShort(b,0)+"."+ReadShort(b,2)+"."+ReadShort(b,4)+"."+ReadShort(b,6)+" to "+ReadShort(b,8)+"."+ReadShort(b,10)+"."+ReadShort(b,12)+"."+ReadShort(b,14):2100==a?(c=new Date,c.setTime(1E3*ReadInt(b,0)+6E4*(new Date).getTimezoneOffset()),c.toLocaleString()):3E3==a?"From "+["None",
|
|
"KVM","All"][b.charCodeAt(0)]+" to "+["None","KVM","All"][b.charCodeAt(1)]:3001==a?["Success","Failed 3 times"][b.charCodeAt(0)]:null};l.GetAuditLog=function(a){l.AMT_AuditLog_ReadRecords(1,w,[a,[]])};return l}function hex_md5(b){null==b&&(b="");return forge.md.md5.create().update(b).digest().toHex()}function rstr_md5(b){return hex2rstr(hex_md5(b))}
|
|
function execArgumentsToXml(b){if(void 0===b||null===b)return null;var c="",a;for(a in b){var d=b[a];d&&(c="reference"===d.__parameterType?c+referenceToXml(a,d):c+instanceToXml(a,d))}return c}
|
|
function instanceToXml(b,c){if(void 0===c||null===c)return null;var a=!!c.__namespace,d=a?"<q:":"<",e=a?"</q:":"</",a="<r:"+b+(a?' xmlns:q="'+c.__namespace+'"':"")+">",r;for(r in c)c.hasOwnProperty(r)&&0!==r.indexOf("__")&&("function"===typeof c[r]||Array.isArray(c[r])||("object"===typeof c[r]?console.error("only convert one level down..."):a+=d+r+">"+c[r].toString()+e+r+">"));return a+("</r:"+b+">")}
|
|
function referenceToXml(b,c){if(void 0===c||null===c)return null;var a="<r:"+b+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+c.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in c)c.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof c[d]||"object"===typeof c[d]||Array.isArray(c[d])||(a+='<w:Selector Name="'+d+'">'+c[d].toString()+"</w:Selector>"));return a+("</w:SelectorSet></a:ReferenceParameters></r:"+b+">")}
|
|
function GetSidString(b){for(var c="S-"+b.charCodeAt(0)+"-"+b.charCodeAt(7),a=2;a<b.length/4;a++)c+="-"+ReadIntX(b,4*a);return c}
|
|
function GetSidByteArray(b){if(!b||null==b)return null;b=b.split("-");if(4>b.length||"s"!=b[0]&&"S"!=b[0])return null;for(var c=1;c<b.length;c++){var a=parseInt(b[c]);if(a!=b[c])return null;b[c]=a}a=String.fromCharCode(b[1])+String.fromCharCode(b.length-3)+ShortToStr(Math.floor(b[2]/Math.pow(2,32)))+IntToStr(b[2]&65535);for(c=3;c<b.length;c++)a+=IntToStrX(b[c]);return a}
|
|
(function(b,c){"function"===typeof define&&define.amd?define([],c):b.forge=c()})(this,function(){var b,c,a;(function(d){function e(a,b){var c,d,q,y,h,g,e,n,m,l=b&&b.split("/"),w=v.map,x=w&&w["*"]||{};if(a&&"."===a.charAt(0))if(b){l=l.slice(0,l.length-1);a=a.split("/");h=a.length-1;v.nodeIdCompat&&C.test(a[h])&&(a[h]=a[h].replace(C,""));a=l.concat(a);for(h=0;h<a.length;h+=1)if(c=a[h],"."===c)a.splice(h,1),--h;else if(".."===c)if(1!==h||".."!==a[2]&&".."!==a[0])0<h&&(a.splice(h-1,2),h-=2);else break;
|
|
a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((l||x)&&w){c=a.split("/");for(h=c.length;0<h;--h){d=c.slice(0,h).join("/");if(l)for(m=l.length;0<m;--m)if(q=w[l.slice(0,m).join("/")])if(q=q[d]){y=q;g=h;break}if(y)break;!e&&x&&x[d]&&(e=x[d],n=h)}!y&&e&&(y=e,g=n);y&&(c.splice(0,g,y),a=c.join("/"))}return a}function r(a,b){return function(){return x.apply(d,y.call(arguments,0).concat([a,b]))}}function p(a){return function(b){return e(b,a)}}function k(a){return function(b){g[a]=b}}function q(a){if(D.call(h,
|
|
a)){var b=h[a];delete h[a];J[a]=!0;l.apply(d,b)}if(!D.call(g,a)&&!D.call(J,a))throw Error("No "+a);return g[a]}function m(a){var b,c=a?a.indexOf("!"):-1;-1<c&&(b=a.substring(0,c),a=a.substring(c+1,a.length));return[b,a]}function w(a){return function(){return v&&v.config&&v.config[a]||{}}}var l,x,B,n,g={},h={},v={},J={},D=Object.prototype.hasOwnProperty,y=[].slice,C=/\.js$/;B=function(a,b){var c,d=m(a),y=d[0];a=d[1];y&&(y=e(y,b),c=q(y));y?a=c&&c.normalize?c.normalize(a,p(b)):e(a,b):(a=e(a,b),d=m(a),
|
|
y=d[0],a=d[1],y&&(c=q(y)));return{f:y?y+"!"+a:a,n:a,pr:y,p:c}};n={require:function(a){return r(a)},exports:function(a){var b=g[a];return"undefined"!==typeof b?b:g[a]={}},module:function(a){return{id:a,uri:"",exports:g[a],config:w(a)}}};l=function(a,b,c,y){var e,m,l,C,w=[];m=typeof c;var v;y=y||a;if("undefined"===m||"function"===m){b=!b.length&&c.length?["require","exports","module"]:b;for(C=0;C<b.length;C+=1)if(l=B(b[C],y),m=l.f,"require"===m)w[C]=n.require(a);else if("exports"===m)w[C]=n.exports(a),
|
|
v=!0;else if("module"===m)e=w[C]=n.module(a);else if(D.call(g,m)||D.call(h,m)||D.call(J,m))w[C]=q(m);else if(l.p)l.p.load(l.n,r(y,!0),k(m),{}),w[C]=g[m];else throw Error(a+" missing "+m);b=c?c.apply(g[a],w):void 0;a&&(e&&e.exports!==d&&e.exports!==g[a]?g[a]=e.exports:b===d&&v||(g[a]=b))}else a&&(g[a]=c)};b=c=x=function(a,b,c,y,h){if("string"===typeof a)return n[a]?n[a](b):q(B(a,b).f);if(!a.splice){v=a;v.deps&&x(v.deps,v.callback);if(!b)return;b.splice?(a=b,b=c,c=null):a=d}b=b||function(){};"function"===
|
|
typeof c&&(c=y,y=h);y?l(d,a,b,c):setTimeout(function(){l(d,a,b,c)},4);return x};x.config=function(a){return x(a)};b._defined=g;a=function(a,b,c){b.splice||(c=b,b=[]);D.call(g,a)||D.call(h,a)||(h[a]=[a,b,c])};a.amd={jQuery:!0}})();a("node_modules/almond/almond",function(){});(function(){function b(a){function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(b){for(var q=
|
|
0;q<a.length;++q)this.putByte(a[q])}}else if(a instanceof c||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=a.util=a.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===typeof setImmediate)d.setImmediate=setImmediate,d.nextTick=function(a){return setImmediate(a)};
|
|
else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(b){a.push(b);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(b){b.source===window&&"forge.setImmediate"===b.data&&(b.stopPropagation(),b=a.slice(),a.length=0,b.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var b=Date.now(),c=!0,q=document.createElement("div"),a=[];
|
|
(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(q,{attributes:!0});var A=d.setImmediate;d.setImmediate=function(d){15<Date.now()-b?(b=Date.now(),A(d)):(a.push(d),1===a.length&&q.setAttribute("a",c=!c))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&
|
|
d.isArrayBuffer(a.buffer)&&void 0!==a.byteLength};d.ByteBuffer=c;d.ByteStringBuffer=c;d.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a;4096<this._constructedStringLength&&(this.data.substr(0,1),this._constructedStringLength=0)};d.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};d.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))};
|
|
d.ByteStringBuffer.prototype.fillWithByte=function(a,b){a=String.fromCharCode(a);for(var c=this.data;0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);this.data=c;this._optimizeConstructedString(b);return this};d.ByteStringBuffer.prototype.putBytes=function(a){this.data+=a;this._optimizeConstructedString(a.length);return this};d.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(d.encodeUtf8(a))};d.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&
|
|
255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>
|
|
8&255))};d.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))};d.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))};d.ByteStringBuffer.prototype.putInt=function(a,b){var c="";do b-=8,c+=String.fromCharCode(a>>b&255);while(0<b);return this.putBytes(c)};
|
|
d.ByteStringBuffer.prototype.putSignedInt=function(a,b){0>a&&(a+=2<<b-1);return this.putInt(a,b)};d.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())};d.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};d.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<
|
|
16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);this.read+=4;return a};d.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24Le=
|
|
function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;this.read+=4;return a};d.ByteStringBuffer.prototype.getInt=function(a){var b=0;do b=(b<<8)+this.data.charCodeAt(this.read++),a-=8;while(0<a);return b};d.ByteStringBuffer.prototype.getSignedInt=
|
|
function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};d.ByteStringBuffer.prototype.getBytes=function(a){var b;a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear());return b};d.ByteStringBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+
|
|
a)};d.ByteStringBuffer.prototype.setAt=function(a,b){this.data=this.data.substr(0,this.read+a)+String.fromCharCode(b)+this.data.substr(this.read+a+1);return this};d.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};d.ByteStringBuffer.prototype.copy=function(){var a=d.createBuffer(this.data);a.read=this.read;return a};d.ByteStringBuffer.prototype.compact=function(){0<this.read&&(this.data=this.data.slice(this.read),this.read=0);return this};d.ByteStringBuffer.prototype.clear=
|
|
function(){this.data="";this.read=0;return this};d.ByteStringBuffer.prototype.truncate=function(a){a=Math.max(0,this.length()-a);this.data=this.data.substr(this.read,a);this.read=0;return this};d.ByteStringBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.length;++b){var c=this.data.charCodeAt(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.ByteStringBuffer.prototype.toString=function(){return d.decodeUtf8(this.bytes())};d.DataBuffer=function(a,b){b=b||{};this.read=b.readOffset||
|
|
0;this.growSize=b.growSize||1024;var c=d.isArrayBuffer(a),q=d.isArrayBufferView(a);c||q?(this.data=c?new DataView(a):new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in b?b.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==a&&void 0!==a&&this.putBytes(a),"writeOffset"in b&&(this.write=b.writeOffset))};d.DataBuffer.prototype.length=function(){return this.write-this.read};d.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};
|
|
d.DataBuffer.prototype.accommodate=function(a,b){if(this.length()>=a)return this;b=Math.max(b||this.growSize,a);var c=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),d=new Uint8Array(this.length()+b);d.set(c);this.data=new DataView(d.buffer);return this};d.DataBuffer.prototype.putByte=function(a){this.accommodate(1);this.data.setUint8(this.write++,a);return this};d.DataBuffer.prototype.fillWithByte=function(a,b){this.accommodate(b);for(var c=0;c<b;++c)this.data.setUint8(a);
|
|
return this};d.DataBuffer.prototype.putBytes=function(a,b){if(d.isArrayBufferView(a)){var c=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),q=c.byteLength-c.byteOffset;this.accommodate(q);var A=new Uint8Array(this.data.buffer,this.write);A.set(c);this.write+=q;return this}if(d.isArrayBuffer(a))return c=new Uint8Array(a),this.accommodate(c.byteLength),A=new Uint8Array(this.data.buffer),A.set(c,this.write),this.write+=c.byteLength,this;if(a instanceof d.DataBuffer||"object"===typeof a&&"number"===
|
|
typeof a.read&&"number"===typeof a.write&&d.isArrayBufferView(a.data))return c=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(c.byteLength),A=new Uint8Array(a.data.byteLength,this.write),A.set(c),this.write+=c.byteLength,this;a instanceof d.ByteStringBuffer&&(a=a.data,b="binary");b=b||"binary";if("string"===typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.hex.decode(a,c,this.write),this;if("base64"===
|
|
b)return this.accommodate(3*Math.ceil(a.length/4)),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.base64.decode(a,c,this.write),this;"utf8"===b&&(a=d.encodeUtf8(a),b="binary");if("binary"===b||"raw"===b)return this.accommodate(a.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.raw.decode(c),this;if("utf16"===b)return this.accommodate(2*a.length),c=new Uint16Array(this.data.buffer,this.write),this.write+=d.text.utf16.encode(c),this;throw Error("Invalid encoding: "+
|
|
b);}throw Error("Invalid parameter: "+a);};d.DataBuffer.prototype.putBuffer=function(a){this.putBytes(a);a.clear();return this};d.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")};d.DataBuffer.prototype.putInt16=function(a){this.accommodate(2);this.data.setInt16(this.write,a);this.write+=2;return this};d.DataBuffer.prototype.putInt24=function(a){this.accommodate(3);this.data.setInt16(this.write,a>>8&65535);this.data.setInt8(this.write,a>>16&255);this.write+=3;return this};
|
|
d.DataBuffer.prototype.putInt32=function(a){this.accommodate(4);this.data.setInt32(this.write,a);this.write+=4;return this};d.DataBuffer.prototype.putInt16Le=function(a){this.accommodate(2);this.data.setInt16(this.write,a,!0);this.write+=2;return this};d.DataBuffer.prototype.putInt24Le=function(a){this.accommodate(3);this.data.setInt8(this.write,a>>16&255);this.data.setInt16(this.write,a>>8&65535,!0);this.write+=3;return this};d.DataBuffer.prototype.putInt32Le=function(a){this.accommodate(4);this.data.setInt32(this.write,
|
|
a,!0);this.write+=4;return this};d.DataBuffer.prototype.putInt=function(a,b){this.accommodate(b/8);do b-=8,this.data.setInt8(this.write++,a>>b&255);while(0<b);return this};d.DataBuffer.prototype.putSignedInt=function(a,b){this.accommodate(b/8);0>a&&(a+=2<<b-1);return this.putInt(a,b)};d.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};d.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);this.read+=2;return a};d.DataBuffer.prototype.getInt24=
|
|
function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);this.read+=3;return a};d.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);this.read+=4;return a};d.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,!0);this.read+=2;return a};d.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;this.read+=3;return a};d.DataBuffer.prototype.getInt32Le=function(){var a=
|
|
this.data.getInt32(this.read,!0);this.read+=4;return a};d.DataBuffer.prototype.getInt=function(a){var b=0;do b=(b<<8)+this.data.getInt8(this.read++),a-=8;while(0<a);return b};d.DataBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};d.DataBuffer.prototype.getBytes=function(a){var b;a?(a=Math.min(this.length(),a),b=this.data.slice(this.read,this.read+a),this.read+=a):0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear());return b};
|
|
d.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};d.DataBuffer.prototype.setAt=function(a,b){this.data.setUint8(a,b);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0<this.read){var a=
|
|
new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a);this.data=new DataView(b);this.write-=this.read;this.read=0}return this};d.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};d.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};d.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=
|
|
this.data.getUint8(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return d.binary.raw.encode(b);if("hex"===a)return d.binary.hex.encode(b);if("base64"===a)return d.binary.base64.encode(b);if("utf8"===a)return d.text.utf8.decode(b);if("utf16"===a)return d.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};d.createBuffer=function(a,b){void 0!==a&&"utf8"===
|
|
(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var d="",q="",h="",e=0,g=0;0<c;--c,++e)q=a.charCodeAt(e)^b.charCodeAt(e),10<=g&&(d+=h,h="",g=0),h+=String.fromCharCode(q),++g;return d+h};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=
|
|
function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",d="",q,h,e,g=0;g<a.length;)q=
|
|
a.charCodeAt(g++),h=a.charCodeAt(g++),e=a.charCodeAt(g++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((q&3)<<4|h>>4),isNaN(h)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((h&15)<<2|e>>6),c+=isNaN(e)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e&63)),b&&c.length>b&&(d+=c.substr(0,b)+"\r\n",c=c.substr(b));return d+
|
|
c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var b="",c,d,q,h,g=0;g<a.length;)c=e[a.charCodeAt(g++)-43],d=e[a.charCodeAt(g++)-43],q=e[a.charCodeAt(g++)-43],h=e[a.charCodeAt(g++)-43],b+=String.fromCharCode(c<<2|d>>4),64!==q&&(b+=String.fromCharCode((d&15)<<4|q>>2),64!==h&&(b+=String.fromCharCode((q&3)<<6|h)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
|
|
d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(a.length));for(var q=c=c||0,h=0;h<a.length;++h)d[q++]=a.charCodeAt(h);return b?q-c:d};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var q=0,h=c;a.length&1&&(q=1,d[h++]=parseInt(a[0],16));for(;q<a.length;q+=2)d[h++]=parseInt(a.substr(q,2),16);return b?h-c:d};d.binary.base64.encode=
|
|
function(a,b){for(var c="",d="",q,h,g,e=0;e<a.byteLength;)q=a[e++],h=a[e++],g=a[e++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((q&3)<<4|h>>4),isNaN(h)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((h&15)<<2|g>>6),c+=isNaN(g)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g&63)),b&&c.length>b&&(d+=c.substr(0,
|
|
b)+"\r\n",c=c.substr(b));return d+c};d.binary.base64.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var q,h,g,n,m=0,v=c;m<a.length;)q=e[a.charCodeAt(m++)-43],h=e[a.charCodeAt(m++)-43],g=e[a.charCodeAt(m++)-43],n=e[a.charCodeAt(m++)-43],d[v++]=q<<2|h>>4,64!==g&&(d[v++]=(h&15)<<4|g>>2,64!==n&&(d[v++]=(g&3)<<6|n));return b?v-c:d.subarray(0,v)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);
|
|
var q=b;q||(q=new Uint8Array(a.length));for(var A=c=c||0,h=0;h<a.length;++h)q[A++]=a.charCodeAt(h);return b?A-c:q};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var d=b;d||(d=new Uint8Array(2*a.length));for(var q=new Uint16Array(d.buffer),h=c=c||0,g=c,e=0;e<a.length;++e)q[g++]=a.charCodeAt(e),h+=2;return b?h-c:d};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
|
|
b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var x=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},k=function(a,b){if(!a)throw Error("WebStorage not available.");
|
|
var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var q=Error(c.error.message);q.id=c.error.id;q.name=c.error.name;throw q;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(d.decode64(c)));return c},n=function(a,b,c,d){var q=k(a,b);null===q&&(q={});q[c]=d;x(a,b,q)},g=function(a,b,c){a=k(a,b);null!==a&&(a=c in a?a[c]:null);return a},h=function(a,b,c){var d=k(a,b);if(null!==d&&c in d){delete d[c];c=!0;for(var q in d){c=!1;break}c&&(d=null);x(a,b,d)}},v=function(a,b){x(a,b,null)},J=function(a,b,
|
|
c){var d=null;"undefined"===typeof c&&(c=["web","flash"]);var q,h=!1,g=null,e;for(e in c){q=c[e];try{if("flash"===q||"both"===q){if(null===b[0])throw Error("Flash local storage not available.");d=a.apply(this,b);h="flash"===q}if("web"===q||"both"===q)b[0]=localStorage,d=a.apply(this,b),h=!0}catch(n){g=n}if(h)break}if(!h)throw g;return d};d.setItem=function(a,b,c,d,q){J(n,arguments,q)};d.getItem=function(a,b,c,d){return J(g,arguments,d)};d.removeItem=function(a,b,c,d){J(h,arguments,d)};d.clearItems=
|
|
function(a,b,c){J(v,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var D=null;d.getQueryVariables=function(a){var b=function(a){var b=
|
|
{};a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("="),q;0<d?(q=a[c].substring(0,d),d=a[c].substring(d+1)):(q=a[c],d=null);q in b||(b[q]=[]);q in Object.prototype||null===d||b[q].push(unescape(d))}return b};"undefined"===typeof a?(null===D&&(D="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=D):a=b(a);return a};d.parseFragment=function(a){var b=a,c="",q=a.indexOf("?");0<q&&(b=a.substring(0,q),c=a.substring(q+1));a=b.split("/");
|
|
0<a.length&&""===a[0]&&a.shift();q=""===c?{}:d.getQueryVariables(c);return{pathString:b,queryString:c,path:a,query:q}};d.makeRequest=function(a){var b=d.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){var d;"undefined"===typeof a?d=b.query:(d=b.query[a])&&"undefined"!==typeof c&&(d=d[c]);return d},getQueryLast:function(a,b){var d=c.getQuery(a);return d?d[d.length-1]:b}};return c};d.makeLink=function(a,
|
|
b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};d.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var d=0,q=b.length;d<q;){var h=b[d++];if(d==q)a[h]=c;else{var g=h in a;if(!g||g&&"object"!==typeof a[h]||g&&null===a[h])a[h]={};a=a[h]}}};d.getPath=function(a,b,c){for(var d=0,q=b.length,h=!0;h&&d<q&&"object"===typeof a&&null!==a;){var g=b[d++];(h=g in a)&&(a=a[g])}return h?a:c};d.deletePath=function(a,b){if("object"===
|
|
typeof a&&null!==a)for(var c=0,d=b.length;c<d;){var q=b[c++];if(c==d)delete a[q];else{if(!(q in a)||"object"!==typeof a[q]||null===a[q])break;a=a[q]}}};d.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};d.format=function(a){var b=/%./g,c,d,q=0,h=[];for(d=0;c=b.exec(a);)switch(d=a.substring(d,b.lastIndex-2),0<d.length&&h.push(d),d=b.lastIndex,c=c[0][1],c){case "s":case "o":q<arguments.length?h.push(arguments[q++ +1]):h.push("<?>");break;case "%":h.push("%");break;default:h.push("<#"+
|
|
c+"?>")}h.push(a.substring(d));return h.join("")};d.formatNumber=function(a,b,c,d){var q=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;d=void 0===d?".":d;c=0>a?"-":"";var h=parseInt(a=Math.abs(+a||0).toFixed(q),10)+"",g=3<h.length?h.length%3:0;return c+(g?h.substr(0,g)+d:"")+h.substr(g).replace(/(\d{3})(?=\d)/g,"$1"+d)+(q?b+Math.abs(a-h).toFixed(q).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+
|
|
" MiB":1024<=a?d.formatNumber(a/1024,0)+" KiB":d.formatNumber(a,0)+" bytes"};d.bytesFromIP=function(a){return-1!==a.indexOf(".")?d.bytesFromIPv4(a):-1!==a.indexOf(":")?d.bytesFromIPv6(a):null};d.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=d.createBuffer(),c=0;c<a.length;++c){var q=parseInt(a[c],10);if(isNaN(q))return null;b.putByte(q)}return b.getBytes()};d.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=
|
|
2*(8-a.length+b),q=d.createBuffer(),h=0;8>h;++h)if(a[h]&&0!==a[h].length){var g=d.hexToBytes(a[h]);2>g.length&&q.putByte(0);q.putBytes(g)}else q.fillWithByte(0,c),c=0;return q.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],q=0,h=0;h<a.length;h+=
|
|
2){for(var g=d.bytesToHex(a[h]+a[h+1]);"0"===g[0]&&"0"!==g;)g=g.substr(1);if("0"===g){var e=c[c.length-1],n=b.length;e&&n===e.end+1?(e.end=n,e.end-e.start>c[q].end-c[q].start&&(q=c.length-1)):c.push({start:n,end:n})}b.push(g)}0<c.length&&(a=c[q],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,e,n){if(0===e){var m=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=
|
|
Math.max(1,m);URL.revokeObjectURL(g);return b(null,d.cores)}q(n,function(b,d){a.push(h(n,d));c(a,e-1,n)})}function q(a,b){for(var c=[],d=[],h=0;h<a;++h){var A=new Worker(g);A.addEventListener("message",function(q){d.push(q.data);if(d.length===a){for(q=0;q<a;++q)c[q].terminate();b(null,d)}});c.push(A)}for(h=0;h<a;++h)c[h].postMessage(h)}function h(a,b){for(var c=[],d=0;d<a;++d)for(var q=b[d],A=c[d]=[],g=0;g<a;++g)if(d!==g){var e=b[g];(q.st>e.st&&q.st<e.et||e.st>q.st&&e.st<q.et)&&A.push(g)}return c.reduce(function(a,
|
|
b){return Math.max(a,b.length)},0)}"function"===typeof a&&(b=a,a={});a=a||{};if("cores"in d&&!a.update)return b(null,d.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return d.cores=navigator.hardwareConcurrency,b(null,d.cores);if("undefined"===typeof Worker)return d.cores=1,b(null,d.cores);if("undefined"===typeof Blob)return d.cores=2,b(null,d.cores);var g=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=
|
|
Date.now();for(var b=a+4;Date.now()<b;);self.postMessage({st:a,et:b})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.util)return c.util;c.defined.util=!0;for(var m=0;m<e.length;++m)e[m](c);
|
|
return c.util}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/util",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.cipher=a.cipher||{};a.cipher.algorithms=a.cipher.algorithms||{};a.cipher.createCipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&
|
|
(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!1})};a.cipher.createDecipher=function(b,c){var d=b;"string"===typeof d&&(d=a.cipher.getAlgorithm(d))&&(d=d());if(!d)throw Error("Unsupported algorithm: "+b);return new a.cipher.BlockCipher({algorithm:d,key:c,decrypt:!0})};a.cipher.registerAlgorithm=function(b,c){b=b.toUpperCase();a.cipher.algorithms[b]=c};a.cipher.getAlgorithm=function(b){b=b.toUpperCase();return b in a.cipher.algorithms?
|
|
a.cipher.algorithms[b]:null};var c=a.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};c.prototype.start=function(b){b=b||{};var c={},d;for(d in b)c[d]=b[d];c.decrypt=this._decrypt;this._finish=!1;this._input=a.util.createBuffer();this.output=b.output||a.util.createBuffer();
|
|
this.mode.start(c)};c.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};c.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,b,!0)});var b={};b.decrypt=this._decrypt;b.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&
|
|
!this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipher)return c.cipher;
|
|
c.defined.cipher=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipher}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipher",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){"string"===typeof b&&(b=a.util.createBuffer(b));if(a.util.isArray(b)&&
|
|
4<b.length){var d=b;b=a.util.createBuffer();for(var g=0;g<d.length;++g)b.putByte(d[g])}a.util.isArray(b)||(b=[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);return b}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function e(a){return[a/4294967296|0,a&4294967295]}a.cipher=a.cipher||{};var x=a.cipher.modes=a.cipher.modes||{};x.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
|
|
Array(this._ints)};x.ecb.prototype.start=function(a){};x.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};x.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
|
|
this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};x.ecb.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};x.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};x.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
|
|
this._outBlock=Array(this._ints)};x.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=c(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};x.cbc.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c]);
|
|
this._prev=this._outBlock};x.cbc.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)};x.cbc.prototype.pad=function(a,b){var c=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(c,c);return!0};x.cbc.prototype.unpad=function(a,
|
|
b){if(0<b.overflow)return!1;var c=a.length(),c=a.at(c-1);if(c>this.blockSize<<2)return!1;a.truncate(c);return!0};x.cfb=function(b){b=b||{};this.name="CFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=
|
|
this._iv.slice(0);this._partialBytes=0};x.cfb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var q=0;q<this._ints;++q)this._inBlock[q]=a.getInt32()^this._outBlock[q],b.putInt32(this._inBlock[q]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(q=0;q<this._ints;++q)this._partialBlock[q]=a.getInt32()^this._outBlock[q],this._partialOutput.putInt32(this._partialBlock[q]);
|
|
if(0<e)a.read-=this.blockSize;else for(q=0;q<this._ints;++q)this._inBlock[q]=this._partialBlock[q];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.cfb.prototype.decrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&
|
|
d>=this.blockSize)for(var q=0;q<this._ints;++q)this._inBlock[q]=a.getInt32(),b.putInt32(this._inBlock[q]^this._outBlock[q]);else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(q=0;q<this._ints;++q)this._partialBlock[q]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[q]^this._outBlock[q]);if(0<e)a.read-=this.blockSize;else for(q=0;q<this._ints;++q)this._inBlock[q]=this._partialBlock[q];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);
|
|
if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.ofb=function(b){b=b||{};this.name="OFB";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
|
|
this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};x.ofb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var q=0;q<this._ints;++q)b.putInt32(a.getInt32()^this._outBlock[q]),this._inBlock[q]=this._outBlock[q];else{var e=(this.blockSize-d)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(q=0;q<this._ints;++q)this._partialOutput.putInt32(a.getInt32()^
|
|
this._outBlock[q]);if(0<e)a.read-=this.blockSize;else for(q=0;q<this._ints;++q)this._inBlock[q]=this._outBlock[q];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!c)return b.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};x.ofb.prototype.decrypt=x.ofb.prototype.encrypt;x.ctr=function(b){b=b||{};this.name="CTR";this.cipher=b.cipher;this.blockSize=
|
|
b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0};x.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=c(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};x.ctr.prototype.encrypt=function(a,b,c){var q=a.length();if(0===q)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&q>=this.blockSize)for(var e=0;e<
|
|
this._ints;++e)b.putInt32(a.getInt32()^this._outBlock[e]);else{var m=(this.blockSize-q)%this.blockSize;0<m&&(m=this.blockSize-m);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);0<m&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<m&&!c)return b.putBytes(this._partialOutput.getBytes(m-this._partialBytes)),this._partialBytes=m,!0;b.putBytes(this._partialOutput.getBytes(q-this._partialBytes));
|
|
this._partialBytes=0}d(this._inBlock)};x.ctr.prototype.decrypt=x.ctr.prototype.encrypt;x.gcm=function(b){b=b||{};this.name="GCM";this.cipher=b.cipher;this.blockSize=b.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=a.util.createBuffer();this._partialBytes=0;this._R=3774873600};x.gcm.prototype.start=function(b){if(!("iv"in b))throw Error("Invalid IV parameter.");var c=a.util.createBuffer(b.iv);this._cipherLength=0;var g;
|
|
g="additionalData"in b?a.util.createBuffer(b.additionalData):a.util.createBuffer();this._tagLength="tagLength"in b?b.tagLength:128;this._tag=null;if(b.decrypt&&(this._tag=a.util.createBuffer(b.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints);this.tag=null;this._hashSubkey=Array(this._ints);this.cipher.encrypt([0,0,0,0],this._hashSubkey);this.componentBits=4;this._m=this.generateHashTable(this._hashSubkey,
|
|
this.componentBits);b=c.length();if(12===b)this._j0=[c.getInt32(),c.getInt32(),c.getInt32(),1];else{for(this._j0=[0,0,0,0];0<c.length();)this._j0=this.ghash(this._hashSubkey,this._j0,[c.getInt32(),c.getInt32(),c.getInt32(),c.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(e(8*b)))}this._inBlock=this._j0.slice(0);d(this._inBlock);this._partialBytes=0;g=a.util.createBuffer(g);this._aDataLength=e(8*g.length());(c=g.length()%this.blockSize)&&g.fillWithByte(0,this.blockSize-c);
|
|
for(this._s=[0,0,0,0];0<g.length();)this._s=this.ghash(this._hashSubkey,this._s,[g.getInt32(),g.getInt32(),g.getInt32(),g.getInt32()])};x.gcm.prototype.encrypt=function(a,b,c){var q=a.length();if(0===q)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&q>=this.blockSize){for(var e=0;e<this._ints;++e)b.putInt32(this._outBlock[e]^=a.getInt32());this._cipherLength+=this.blockSize}else{var m=(this.blockSize-q)%this.blockSize;0<m&&(m=this.blockSize-m);this._partialOutput.clear();
|
|
for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);if(0===m||c){c?(e=q%this.blockSize,this._cipherLength+=e,this._partialOutput.truncate(this.blockSize-e)):this._cipherLength+=this.blockSize;for(e=0;e<this._ints;++e)this._outBlock[e]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<m&&!c)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(m-this._partialBytes)),
|
|
this._partialBytes=m,!0;b.putBytes(this._partialOutput.getBytes(q-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};x.gcm.prototype.decrypt=function(a,b,c){var q=a.length();if(q<this.blockSize&&!(c&&0<q))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
|
|
this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=q<this.blockSize?this._cipherLength+q%this.blockSize:this._cipherLength+this.blockSize};x.gcm.prototype.afterFinish=function(b,c){var d=!0;c.decrypt&&c.overflow&&b.truncate(this.blockSize-c.overflow);this.tag=a.util.createBuffer();var h=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,h);h=[];this.cipher.encrypt(this._j0,h);for(var m=0;m<
|
|
this._ints;++m)this.tag.putInt32(this._s[m]^h[m]);this.tag.truncate(this.tag.length()%(this._tagLength/8));c.decrypt&&this.tag.bytes()!==this._tag&&(d=!1);return d};x.gcm.prototype.multiply=function(a,b){for(var c=[0,0,0,0],d=b.slice(0),q=0;128>q;++q)a[q/32|0]&1<<31-q%32&&(c[0]^=d[0],c[1]^=d[1],c[2]^=d[2],c[3]^=d[3]),this.pow(d,d);return c};x.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,d=3;0<d;--d)b[d]=a[d]>>>1|(a[d-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};x.gcm.prototype.tableMultiply=function(a){for(var b=
|
|
[0,0,0,0],c=0;32>c;++c){var d=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=d[0];b[1]^=d[1];b[2]^=d[2];b[3]^=d[3]}return b};x.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};x.gcm.prototype.generateHashTable=function(a,b){for(var c=8/b,d=4*c,c=16*c,q=Array(c),e=0;e<c;++e){var m=[0,0,0,0];m[e/d|0]=1<<b-1<<(d-1-e%d)*b;q[e]=this.generateSubHashTable(this.multiply(m,a),b)}return q};x.gcm.prototype.generateSubHashTable=function(a,b){var c=1<<b,
|
|
d=c>>>1,q=Array(c);q[d]=a.slice(0);for(var e=d>>>1;0<e;)this.pow(q[2*e],q[e]=[]),e>>=1;for(e=2;e<d;){for(var m=1;m<e;++m){var l=q[e],x=q[m];q[e+m]=[l[0]^x[0],l[1]^x[1],l[2]^x[2],l[3]^x[3]]}e*=2}q[0]=[0,0,0,0];for(e=d+1;e<c;++e)m=q[e^d],q[e]=[a[0]^m[0],a[1]^m[1],a[2]^m[2],a[3]^m[3]];return q}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=
|
|
r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var m=0;m<e.length;++m)e[m](c);return c.cipherModes}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,d)})}function d(){n=!0;p=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);v=Array(256);D=Array(4);y=Array(4);for(b=0;4>b;++b)D[b]=Array(256),y[b]=Array(256);for(var c=0,q=0,e,g,m,l,u,b=0;256>b;++b){l=q^q<<1^q<<2^q<<3^q<<4;l=l>>8^l&255^99;h[c]=l;v[l]=c;u=a[l];e=a[c];g=a[e];m=a[g];u^=u<<24^l<<16^l<<8^l;g=(e^g^m)<<24^(c^
|
|
m)<<16^(c^g^m)<<8^c^e^m;for(var x=0;4>x;++x)D[x][c]=u,y[x][l]=g,u=u<<24|u>>>8,g=g<<24|g>>>8;0===c?c=q=1:(c=e^a[a[a[e^m]]],q^=a[a[q]])}}function e(a,b){for(var c=a.slice(0),d,q=1,m=c.length,n=g*(m+6+1),l=m;l<n;++l)d=c[l-1],0===l%m?(d=h[d>>>16&255]<<24^h[d>>>8&255]<<16^h[d&255]<<8^h[d>>>24]^p[q]<<24,q++):6<m&&4===l%m&&(d=h[d>>>24]<<24^h[d>>>16&255]<<16^h[d>>>8&255]<<8^h[d&255]),c[l]=c[l-m]^d;if(b){for(var q=y[0],m=y[1],v=y[2],x=y[3],k=c.slice(0),n=c.length,l=0,w=n-g;l<n;l+=g,w-=g)if(0===l||l===n-g)k[l]=
|
|
c[w],k[l+1]=c[w+3],k[l+2]=c[w+2],k[l+3]=c[w+1];else for(var D=0;D<g;++D)d=c[w+D],k[l+(3&-D)]=q[h[d>>>24]]^m[h[d>>>16&255]]^v[h[d>>>8&255]]^x[h[d&255]];c=k}return c}function x(a,b,c,d){var q=a.length/4-1,e,m,g,n,l;d?(e=y[0],m=y[1],g=y[2],n=y[3],l=v):(e=D[0],m=D[1],g=D[2],n=D[3],l=h);var x,k,w,L,B,p;x=b[0]^a[0];k=b[d?3:1]^a[1];w=b[2]^a[2];b=b[d?1:3]^a[3];for(var J=3,r=1;r<q;++r)L=e[x>>>24]^m[k>>>16&255]^g[w>>>8&255]^n[b&255]^a[++J],B=e[k>>>24]^m[w>>>16&255]^g[b>>>8&255]^n[x&255]^a[++J],p=e[w>>>24]^
|
|
m[b>>>16&255]^g[x>>>8&255]^n[k&255]^a[++J],b=e[b>>>24]^m[x>>>16&255]^g[k>>>8&255]^n[w&255]^a[++J],x=L,k=B,w=p;c[0]=l[x>>>24]<<24^l[k>>>16&255]<<16^l[w>>>8&255]<<8^l[b&255]^a[++J];c[d?3:1]=l[k>>>24]<<24^l[w>>>16&255]<<16^l[b>>>8&255]<<8^l[x&255]^a[++J];c[2]=l[w>>>24]<<24^l[b>>>16&255]<<16^l[x>>>8&255]<<8^l[k&255]^a[++J];c[d?1:3]=l[b>>>24]<<24^l[x>>>16&255]<<16^l[k>>>8&255]<<8^l[w&255]^a[++J]}function k(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
|
|
a.cipher.createCipher(c,b.key);var e=d.start;d.start=function(b,c){var h=null;c instanceof a.util.ByteBuffer&&(h=c,c={});c=c||{};c.output=h;c.iv=b;e.call(d,c)};return d}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,d){a=k({key:a,output:c,decrypt:!1,mode:d});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return k({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,d){a=k({key:a,output:c,decrypt:!0,mode:d});a.start(b);return a};a.aes.createDecryptionCipher=
|
|
function(a,b){return k({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){n||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return x(c._w,a,b,!1)},decrypt:function(a,b){return x(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,d;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){d=
|
|
c;for(var c=a.util.createBuffer(),h=0;h<d.length;++h)c.putByte(d[h])}if(!a.util.isArray(c)){d=c;var c=[],m=d.length();if(16===m||24===m||32===m)for(m>>>=2,h=0;h<m;++h)c.push(d.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(c,b.decrypt&&!d);this._init=!0}};a.aes._expandKey=function(a,b){n||d();return e(a,b)};a.aes._updateBlock=x;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
|
|
a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var n=!1,g=4,h,v,p,D,y}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
|
|
!0;for(var m=0;m<e.length;++m)e[m](c);return c.aes}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.pki=a.pki||{};a=a.pki.oids=a.oids=a.oids||{};a["1.2.840.113549.1.1.1"]="rsaEncryption";
|
|
a.rsaEncryption="1.2.840.113549.1.1.1";a["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";a.md5WithRSAEncryption="1.2.840.113549.1.1.4";a["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";a.sha1WithRSAEncryption="1.2.840.113549.1.1.5";a["1.2.840.113549.1.1.7"]="RSAES-OAEP";a["RSAES-OAEP"]="1.2.840.113549.1.1.7";a["1.2.840.113549.1.1.8"]="mgf1";a.mgf1="1.2.840.113549.1.1.8";a["1.2.840.113549.1.1.9"]="pSpecified";a.pSpecified="1.2.840.113549.1.1.9";a["1.2.840.113549.1.1.10"]="RSASSA-PSS";a["RSASSA-PSS"]=
|
|
"1.2.840.113549.1.1.10";a["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";a.sha256WithRSAEncryption="1.2.840.113549.1.1.11";a["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";a.sha384WithRSAEncryption="1.2.840.113549.1.1.12";a["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";a.sha512WithRSAEncryption="1.2.840.113549.1.1.13";a["1.3.14.3.2.7"]="desCBC";a.desCBC="1.3.14.3.2.7";a["1.3.14.3.2.26"]="sha1";a.sha1="1.3.14.3.2.26";a["2.16.840.1.101.3.4.2.1"]="sha256";a.sha256="2.16.840.1.101.3.4.2.1";
|
|
a["2.16.840.1.101.3.4.2.2"]="sha384";a.sha384="2.16.840.1.101.3.4.2.2";a["2.16.840.1.101.3.4.2.3"]="sha512";a.sha512="2.16.840.1.101.3.4.2.3";a["1.2.840.113549.2.5"]="md5";a.md5="1.2.840.113549.2.5";a["1.2.840.113549.1.7.1"]="data";a.data="1.2.840.113549.1.7.1";a["1.2.840.113549.1.7.2"]="signedData";a.signedData="1.2.840.113549.1.7.2";a["1.2.840.113549.1.7.3"]="envelopedData";a.envelopedData="1.2.840.113549.1.7.3";a["1.2.840.113549.1.7.4"]="signedAndEnvelopedData";a.signedAndEnvelopedData="1.2.840.113549.1.7.4";
|
|
a["1.2.840.113549.1.7.5"]="digestedData";a.digestedData="1.2.840.113549.1.7.5";a["1.2.840.113549.1.7.6"]="encryptedData";a.encryptedData="1.2.840.113549.1.7.6";a["1.2.840.113549.1.9.1"]="emailAddress";a.emailAddress="1.2.840.113549.1.9.1";a["1.2.840.113549.1.9.2"]="unstructuredName";a.unstructuredName="1.2.840.113549.1.9.2";a["1.2.840.113549.1.9.3"]="contentType";a.contentType="1.2.840.113549.1.9.3";a["1.2.840.113549.1.9.4"]="messageDigest";a.messageDigest="1.2.840.113549.1.9.4";a["1.2.840.113549.1.9.5"]=
|
|
"signingTime";a.signingTime="1.2.840.113549.1.9.5";a["1.2.840.113549.1.9.6"]="counterSignature";a.counterSignature="1.2.840.113549.1.9.6";a["1.2.840.113549.1.9.7"]="challengePassword";a.challengePassword="1.2.840.113549.1.9.7";a["1.2.840.113549.1.9.8"]="unstructuredAddress";a.unstructuredAddress="1.2.840.113549.1.9.8";a["1.2.840.113549.1.9.14"]="extensionRequest";a.extensionRequest="1.2.840.113549.1.9.14";a["1.2.840.113549.1.9.20"]="friendlyName";a.friendlyName="1.2.840.113549.1.9.20";a["1.2.840.113549.1.9.21"]=
|
|
"localKeyId";a.localKeyId="1.2.840.113549.1.9.21";a["1.2.840.113549.1.9.22.1"]="x509Certificate";a.x509Certificate="1.2.840.113549.1.9.22.1";a["1.2.840.113549.1.12.10.1.1"]="keyBag";a.keyBag="1.2.840.113549.1.12.10.1.1";a["1.2.840.113549.1.12.10.1.2"]="pkcs8ShroudedKeyBag";a.pkcs8ShroudedKeyBag="1.2.840.113549.1.12.10.1.2";a["1.2.840.113549.1.12.10.1.3"]="certBag";a.certBag="1.2.840.113549.1.12.10.1.3";a["1.2.840.113549.1.12.10.1.4"]="crlBag";a.crlBag="1.2.840.113549.1.12.10.1.4";a["1.2.840.113549.1.12.10.1.5"]=
|
|
"secretBag";a.secretBag="1.2.840.113549.1.12.10.1.5";a["1.2.840.113549.1.12.10.1.6"]="safeContentsBag";a.safeContentsBag="1.2.840.113549.1.12.10.1.6";a["1.2.840.113549.1.5.13"]="pkcs5PBES2";a.pkcs5PBES2="1.2.840.113549.1.5.13";a["1.2.840.113549.1.5.12"]="pkcs5PBKDF2";a.pkcs5PBKDF2="1.2.840.113549.1.5.12";a["1.2.840.113549.1.12.1.1"]="pbeWithSHAAnd128BitRC4";a.pbeWithSHAAnd128BitRC4="1.2.840.113549.1.12.1.1";a["1.2.840.113549.1.12.1.2"]="pbeWithSHAAnd40BitRC4";a.pbeWithSHAAnd40BitRC4="1.2.840.113549.1.12.1.2";
|
|
a["1.2.840.113549.1.12.1.3"]="pbeWithSHAAnd3-KeyTripleDES-CBC";a["pbeWithSHAAnd3-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.3";a["1.2.840.113549.1.12.1.4"]="pbeWithSHAAnd2-KeyTripleDES-CBC";a["pbeWithSHAAnd2-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.4";a["1.2.840.113549.1.12.1.5"]="pbeWithSHAAnd128BitRC2-CBC";a["pbeWithSHAAnd128BitRC2-CBC"]="1.2.840.113549.1.12.1.5";a["1.2.840.113549.1.12.1.6"]="pbewithSHAAnd40BitRC2-CBC";a["pbewithSHAAnd40BitRC2-CBC"]="1.2.840.113549.1.12.1.6";a["1.2.840.113549.3.7"]=
|
|
"des-EDE3-CBC";a["des-EDE3-CBC"]="1.2.840.113549.3.7";a["2.16.840.1.101.3.4.1.2"]="aes128-CBC";a["aes128-CBC"]="2.16.840.1.101.3.4.1.2";a["2.16.840.1.101.3.4.1.22"]="aes192-CBC";a["aes192-CBC"]="2.16.840.1.101.3.4.1.22";a["2.16.840.1.101.3.4.1.42"]="aes256-CBC";a["aes256-CBC"]="2.16.840.1.101.3.4.1.42";a["2.5.4.3"]="commonName";a.commonName="2.5.4.3";a["2.5.4.5"]="serialName";a.serialName="2.5.4.5";a["2.5.4.6"]="countryName";a.countryName="2.5.4.6";a["2.5.4.7"]="localityName";a.localityName="2.5.4.7";
|
|
a["2.5.4.8"]="stateOrProvinceName";a.stateOrProvinceName="2.5.4.8";a["2.5.4.10"]="organizationName";a.organizationName="2.5.4.10";a["2.5.4.11"]="organizationalUnitName";a.organizationalUnitName="2.5.4.11";a["2.16.840.1.113730.1.1"]="nsCertType";a.nsCertType="2.16.840.1.113730.1.1";a["2.5.29.1"]="authorityKeyIdentifier";a["2.5.29.2"]="keyAttributes";a["2.5.29.3"]="certificatePolicies";a["2.5.29.4"]="keyUsageRestriction";a["2.5.29.5"]="policyMapping";a["2.5.29.6"]="subtreesConstraint";a["2.5.29.7"]=
|
|
"subjectAltName";a["2.5.29.8"]="issuerAltName";a["2.5.29.9"]="subjectDirectoryAttributes";a["2.5.29.10"]="basicConstraints";a["2.5.29.11"]="nameConstraints";a["2.5.29.12"]="policyConstraints";a["2.5.29.13"]="basicConstraints";a["2.5.29.14"]="subjectKeyIdentifier";a.subjectKeyIdentifier="2.5.29.14";a["2.5.29.15"]="keyUsage";a.keyUsage="2.5.29.15";a["2.5.29.16"]="privateKeyUsagePeriod";a["2.5.29.17"]="subjectAltName";a.subjectAltName="2.5.29.17";a["2.5.29.18"]="issuerAltName";a.issuerAltName="2.5.29.18";
|
|
a["2.5.29.19"]="basicConstraints";a.basicConstraints="2.5.29.19";a["2.5.29.20"]="cRLNumber";a["2.5.29.21"]="cRLReason";a["2.5.29.22"]="expirationDate";a["2.5.29.23"]="instructionCode";a["2.5.29.24"]="invalidityDate";a["2.5.29.25"]="cRLDistributionPoints";a["2.5.29.26"]="issuingDistributionPoint";a["2.5.29.27"]="deltaCRLIndicator";a["2.5.29.28"]="issuingDistributionPoint";a["2.5.29.29"]="certificateIssuer";a["2.5.29.30"]="nameConstraints";a["2.5.29.31"]="cRLDistributionPoints";a["2.5.29.32"]="certificatePolicies";
|
|
a["2.5.29.33"]="policyMappings";a["2.5.29.34"]="policyConstraints";a["2.5.29.35"]="authorityKeyIdentifier";a["2.5.29.36"]="policyConstraints";a["2.5.29.37"]="extKeyUsage";a.extKeyUsage="2.5.29.37";a["2.5.29.46"]="freshestCRL";a["2.5.29.54"]="inhibitAnyPolicy";a["1.3.6.1.5.5.7.3.1"]="serverAuth";a.serverAuth="1.3.6.1.5.5.7.3.1";a["1.3.6.1.5.5.7.3.2"]="clientAuth";a.clientAuth="1.3.6.1.5.5.7.3.2";a["1.3.6.1.5.5.7.3.3"]="codeSigning";a.codeSigning="1.3.6.1.5.5.7.3.3";a["1.3.6.1.5.5.7.3.4"]="emailProtection";
|
|
a.emailProtection="1.3.6.1.5.5.7.3.4";a["1.3.6.1.5.5.7.3.8"]="timeStamping";a.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.oids)return c.oids;c.defined.oids=!0;for(var m=0;m<e.length;++m)e[m](c);return c.oids}},
|
|
k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/oids",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1=a.asn1||{};c.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};c.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
|
|
ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};c.create=function(b,c,d,e){if(a.util.isArray(e)){for(var h=[],l=0;l<e.length;++l)void 0!==e[l]&&h.push(e[l]);e=h}return{tagClass:b,type:c,constructed:d,composed:d||a.util.isArray(e),value:e}};var d=c.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return b&128?a.getInt((b&127)<<3):b};c.fromDer=function(b,e){void 0===e&&(e=!0);
|
|
"string"===typeof b&&(b=a.util.createBuffer(b));if(2>b.length()){var l=Error("Too few bytes to parse DER.");l.bytes=b.length();throw l;}var g=b.getByte(),l=g&192,h=g&31,v=d(b);if(b.length()<v){if(e)throw l=Error("Too few bytes to read ASN.1 value."),l.detail=b.length()+" < "+v,l;v=b.length()}var k,D=32===(g&32);k=D;if(!k&&l===c.Class.UNIVERSAL&&h===c.Type.BITSTRING&&1<v){var y=b.read;if(0===b.getByte()&&(g=b.getByte(),g&=192,g===c.Class.UNIVERSAL||g===c.Class.CONTEXT_SPECIFIC))try{if(k=d(b)===v-(b.read-
|
|
y))++y,--v}catch(C){}b.read=y}if(k)if(k=[],void 0===v)for(;;){if(b.bytes(2)===String.fromCharCode(0,0)){b.getBytes(2);break}k.push(c.fromDer(b,e))}else for(y=b.length();0<v;)k.push(c.fromDer(b,e)),v-=y-b.length(),y=b.length();else{if(void 0===v){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");v=b.length()}if(h===c.Type.BMPSTRING)for(k="",y=0;y<v;y+=2)k+=String.fromCharCode(b.getInt16());else k=b.getBytes(v)}return c.create(l,h,D,k)};c.toDer=function(b){var d=a.util.createBuffer(),
|
|
e=b.tagClass|b.type,g=a.util.createBuffer();if(b.composed){b.constructed?e|=32:g.putByte(0);for(var h=0;h<b.value.length;++h)void 0!==b.value[h]&&g.putBuffer(c.toDer(b.value[h]))}else if(b.type===c.Type.BMPSTRING)for(h=0;h<b.value.length;++h)g.putInt16(b.value.charCodeAt(h));else g.putBytes(b.value);d.putByte(e);if(127>=g.length())d.putByte(g.length()&127);else{h=g.length();b="";do b+=String.fromCharCode(h&255),h>>>=8;while(0<h);d.putByte(b.length|128);for(h=b.length-1;0<=h;--h)d.putByte(b.charCodeAt(h))}d.putBuffer(g);
|
|
return d};c.oidToDer=function(b){b=b.split(".");var c=a.util.createBuffer();c.putByte(40*parseInt(b[0],10)+parseInt(b[1],10));for(var d,e,h,l,m=2;m<b.length;++m){d=!0;e=[];h=parseInt(b[m],10);do l=h&127,h>>>=7,d||(l|=128),e.push(l),d=!1;while(0<h);for(d=e.length-1;0<=d;--d)c.putByte(e[d])}return c};c.derToOid=function(b){var c;"string"===typeof b&&(b=a.util.createBuffer(b));var d=b.getByte();c=Math.floor(d/40)+"."+d%40;for(var e=0;0<b.length();)d=b.getByte(),e<<=7,d&128?e+=d&127:(c+="."+(e+d),e=0);
|
|
return c};c.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10),c=50<=c?1900+c:2E3+c,d=parseInt(a.substr(2,2),10)-1,q=parseInt(a.substr(4,2),10),e=parseInt(a.substr(6,2),10),l=parseInt(a.substr(8,2),10),m=0;if(11<a.length){var y=a.charAt(10),k=10;"+"!==y&&"-"!==y&&(m=parseInt(a.substr(10,2),10),k+=2)}b.setUTCFullYear(c,d,q);b.setUTCHours(e,l,m,0);k&&(y=a.charAt(k),"+"===y||"-"===y)&&(c=parseInt(a.substr(k+1,2),10),a=parseInt(a.substr(k+4,2),10),a=6E4*(60*c+a),"+"===y?b.setTime(+b-
|
|
a):b.setTime(+b+a));return b};c.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,q=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),l=parseInt(a.substr(10,2),10),m=parseInt(a.substr(12,2),10),y=0,k=0,z=!1;"Z"===a.charAt(a.length-1)&&(z=!0);var w=a.length-5,A=a.charAt(w);if("+"===A||"-"===A)k=parseInt(a.substr(w+1,2),10),w=parseInt(a.substr(w+4,2),10),k=6E4*(60*k+w),"+"===A&&(k*=-1),z=!0;"."===a.charAt(14)&&(y=1E3*parseFloat(a.substr(14),
|
|
10));z?(b.setUTCFullYear(c,d,q),b.setUTCHours(e,l,m,y),b.setTime(+b+k)):(b.setFullYear(c,d,q),b.setHours(e,l,m,y));return b};c.dateToUtcTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.dateToGeneralizedTime=function(a){if("string"===
|
|
typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear());c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};c.integerToDer=function(b){var c=a.util.createBuffer();if(-128<=b&&128>b)return c.putSignedInt(b,8);if(-32768<=b&&32768>b)return c.putSignedInt(b,16);if(-8388608<=b&&8388608>b)return c.putSignedInt(b,24);if(-2147483648<=b&&2147483648>
|
|
b)return c.putSignedInt(b,32);c=Error("Integer too large; max is 32-bits.");c.integer=b;throw c;};c.derToInteger=function(b){"string"===typeof b&&(b=a.util.createBuffer(b));var c=8*b.length();if(32<c)throw Error("Integer too large; max is 32-bits.");return b.getSignedInt(c)};c.validate=function(b,d,e,g){var h=!1;if(b.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||b.type!==d.type&&"undefined"!==typeof d.type)g&&(b.tagClass!==d.tagClass&&g.push("["+d.name+'] Expected tag class "'+d.tagClass+
|
|
'", got "'+b.tagClass+'"'),b.type!==d.type&&g.push("["+d.name+'] Expected type "'+d.type+'", got "'+b.type+'"'));else if(b.constructed===d.constructed||"undefined"===typeof d.constructed){h=!0;if(d.value&&a.util.isArray(d.value))for(var l=0,k=0;h&&k<d.value.length;++k)h=d.value[k].optional||!1,b.value[l]&&((h=c.validate(b.value[l],d.value[k],e,g))?++l:d.value[k].optional&&(h=!0)),!h&&g&&g.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
|
|
b.value.length+'"');h&&e&&(d.capture&&(e[d.capture]=b.value),d.captureAsn1&&(e[d.captureAsn1]=b))}else g&&g.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+b.constructed+'"');return h};var e=/[^\\u0000-\\u00ff]/;c.prettyPrint=function(b,d,n){var g="";d=d||0;n=n||2;0<d&&(g+="\n");for(var h="",k=0;k<d*n;++k)h+=" ";g+=h+"Tag: ";switch(b.tagClass){case c.Class.UNIVERSAL:g+="Universal:";break;case c.Class.APPLICATION:g+="Application:";break;case c.Class.CONTEXT_SPECIFIC:g+="Context-Specific:";
|
|
break;case c.Class.PRIVATE:g+="Private:"}if(b.tagClass===c.Class.UNIVERSAL)switch(g+=b.type,b.type){case c.Type.NONE:g+=" (None)";break;case c.Type.BOOLEAN:g+=" (Boolean)";break;case c.Type.BITSTRING:g+=" (Bit string)";break;case c.Type.INTEGER:g+=" (Integer)";break;case c.Type.OCTETSTRING:g+=" (Octet string)";break;case c.Type.NULL:g+=" (Null)";break;case c.Type.OID:g+=" (Object Identifier)";break;case c.Type.ODESC:g+=" (Object Descriptor)";break;case c.Type.EXTERNAL:g+=" (External or Instance of)";
|
|
break;case c.Type.REAL:g+=" (Real)";break;case c.Type.ENUMERATED:g+=" (Enumerated)";break;case c.Type.EMBEDDED:g+=" (Embedded PDV)";break;case c.Type.UTF8:g+=" (UTF8)";break;case c.Type.ROID:g+=" (Relative Object Identifier)";break;case c.Type.SEQUENCE:g+=" (Sequence)";break;case c.Type.SET:g+=" (Set)";break;case c.Type.PRINTABLESTRING:g+=" (Printable String)";break;case c.Type.IA5String:g+=" (IA5String (ASCII))";break;case c.Type.UTCTIME:g+=" (UTC time)";break;case c.Type.GENERALIZEDTIME:g+=" (Generalized time)";
|
|
break;case c.Type.BMPSTRING:g+=" (BMP String)"}else g+=b.type;g=g+"\n"+(h+"Constructed: "+b.constructed+"\n");if(b.composed){for(var w=0,D="",k=0;k<b.value.length;++k)void 0!==b.value[k]&&(w+=1,D+=c.prettyPrint(b.value[k],d+1,n),k+1<b.value.length&&(D+=","));g+=h+"Sub values: "+w+D}else if(g+=h+"Value: ",b.type===c.Type.OID&&(d=c.derToOid(b.value),g+=d,a.pki&&a.pki.oids&&d in a.pki.oids&&(g+=" ("+a.pki.oids[d]+") ")),b.type===c.Type.INTEGER)try{g+=c.derToInteger(b.value)}catch(y){g+="0x"+a.util.bytesToHex(b.value)}else b.type===
|
|
c.Type.OCTETSTRING?(e.test(b.value)||(g+="("+b.value+") "),g+="0x"+a.util.bytesToHex(b.value)):g=b.type===c.Type.UTF8?g+a.util.decodeUtf8(b.value):b.type===c.Type.PRINTABLESTRING||b.type===c.Type.IA5String?g+b.value:e.test(b.value)?g+("0x"+a.util.bytesToHex(b.value)):0===b.value.length?g+"[null]":g+b.value;return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,
|
|
c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.asn1)return c.asn1;c.defined.asn1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.asn1}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/asn1",["require","module","./util","./oids"],function(){p.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function b(a){function c(){k=String.fromCharCode(128);k+=a.util.fillString(String.fromCharCode(0),64);p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];n=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];g=Array(64);for(var b=0;64>b;++b)g[b]=Math.floor(4294967296*
|
|
Math.abs(Math.sin(b+1)));h=!0}function d(a,b,c){for(var q,e,h,l,A,m,k,w=c.length();64<=w;){e=a.h0;h=a.h1;l=a.h2;A=a.h3;for(k=0;16>k;++k)b[k]=c.getInt32Le(),q=A^h&(l^A),q=e+q+g[k]+b[k],m=n[k],e=A,A=l,l=h,h+=q<<m|q>>>32-m;for(;32>k;++k)q=l^A&(h^l),q=e+q+g[k]+b[p[k]],m=n[k],e=A,A=l,l=h,h+=q<<m|q>>>32-m;for(;48>k;++k)q=h^l^A,q=e+q+g[k]+b[p[k]],m=n[k],e=A,A=l,l=h,h+=q<<m|q>>>32-m;for(;64>k;++k)q=l^(h|~A),q=e+q+g[k]+b[p[k]],m=n[k],e=A,A=l,l=h,h+=q<<m|q>>>32-m;a.h0=a.h0+e|0;a.h1=a.h1+h|0;a.h2=a.h2+l|0;a.h3=
|
|
a.h3+A|0;w-=64}}var e=a.md5=a.md5||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.md5=a.md.algorithms.md5=e;e.create=function(){h||c();var b=null,e=a.util.createBuffer(),l=Array(16),g={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){g.messageLength=0;g.fullMessageLength=g.messageLength64=[];for(var c=g.messageLengthSize/4,d=0;d<c;++d)g.fullMessageLength.push(0);e=a.util.createBuffer();b={h0:1732584193,h1:4023233417,
|
|
h2:2562383102,h3:271733878};return g}};g.start();g.update=function(c,h){"utf8"===h&&(c=a.util.encodeUtf8(c));var m=c.length;g.messageLength+=m;for(var m=[m/4294967296>>>0,m>>>0],A=g.fullMessageLength.length-1;0<=A;--A)g.fullMessageLength[A]+=m[1],m[1]=m[0]+(g.fullMessageLength[A]/4294967296>>>0),g.fullMessageLength[A]>>>=0,m[0]=m[1]/4294967296>>>0;e.putBytes(c);d(b,l,e);(2048<e.read||0===e.length())&&e.compact();return g};g.digest=function(){var c=a.util.createBuffer();c.putBytes(e.bytes());c.putBytes(k.substr(0,
|
|
g.blockLength-(g.fullMessageLength[g.fullMessageLength.length-1]+g.messageLengthSize&g.blockLength-1)));for(var h,m=0,A=g.fullMessageLength.length-1;0<=A;--A)h=8*g.fullMessageLength[A]+m,m=h/4294967296>>>0,c.putInt32Le(h>>>0);h={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3};d(h,l,c);c=a.util.createBuffer();c.putInt32Le(h.h0);c.putInt32Le(h.h1);c.putInt32Le(h.h2);c.putInt32Le(h.h3);return c};return g};var k=null,p=null,n=null,g=null,h=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=
|
|
!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md5)return c.md5;c.defined.md5=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md5}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,
|
|
0))};a("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var q,e,l,m,k,w,z,x,A=d.length();64<=A;){e=a.h0;l=a.h1;m=a.h2;k=a.h3;w=a.h4;for(x=0;16>x;++x)q=d.getInt32(),b[x]=q,z=k^l&(m^k),q=(e<<5|e>>>27)+z+w+1518500249+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;for(;20>x;++x)q=b[x-3]^b[x-8]^b[x-14]^b[x-16],q=q<<1|q>>>31,b[x]=q,z=k^l&(m^k),q=(e<<5|e>>>27)+z+w+1518500249+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;for(;32>
|
|
x;++x)q=b[x-3]^b[x-8]^b[x-14]^b[x-16],q=q<<1|q>>>31,b[x]=q,z=l^m^k,q=(e<<5|e>>>27)+z+w+1859775393+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;for(;40>x;++x)q=b[x-6]^b[x-16]^b[x-28]^b[x-32],q=q<<2|q>>>30,b[x]=q,z=l^m^k,q=(e<<5|e>>>27)+z+w+1859775393+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;for(;60>x;++x)q=b[x-6]^b[x-16]^b[x-28]^b[x-32],q=q<<2|q>>>30,b[x]=q,z=l&m|k&(l^m),q=(e<<5|e>>>27)+z+w+2400959708+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;for(;80>x;++x)q=b[x-6]^b[x-16]^b[x-28]^b[x-32],q=q<<2|q>>>30,b[x]=q,z=l^m^k,q=(e<<5|e>>>
|
|
27)+z+w+3395469782+q,w=k,k=m,m=l<<30|l>>>2,l=e,e=q;a.h0=a.h0+e|0;a.h1=a.h1+l|0;a.h2=a.h2+m|0;a.h3=a.h3+k|0;a.h4=a.h4+w|0;A-=64}}var d=a.sha1=a.sha1||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha1=a.md.algorithms.sha1=d;d.create=function(){k||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),k=!0);var b=null,d=a.util.createBuffer(),g=Array(80),h={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){h.messageLength=
|
|
0;h.fullMessageLength=h.messageLength64=[];for(var c=h.messageLengthSize/4,e=0;e<c;++e)h.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return h}};h.start();h.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var k=e.length;h.messageLength+=k;for(var k=[k/4294967296>>>0,k>>>0],y=h.fullMessageLength.length-1;0<=y;--y)h.fullMessageLength[y]+=k[1],k[1]=k[0]+(h.fullMessageLength[y]/4294967296>>>0),h.fullMessageLength[y]>>>=
|
|
0,k[0]=k[1]/4294967296>>>0;d.putBytes(e);c(b,g,d);(2048<d.read||0===d.length())&&d.compact();return h};h.digest=function(){var k=a.util.createBuffer();k.putBytes(d.bytes());k.putBytes(e.substr(0,h.blockLength-(h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1)));a.util.createBuffer();for(var w,x,y=8*h.fullMessageLength[0],C=0;C<h.fullMessageLength.length;++C)w=8*h.fullMessageLength[C+1],x=w/4294967296>>>0,y+=x,k.putInt32(y>>>0),y=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,
|
|
h4:b.h4};c(w,g,k);k=a.util.createBuffer();k.putInt32(w.h0);k.putInt32(w.h1);k.putInt32(w.h2);k.putInt32(w.h3);k.putInt32(w.h4);return k};return h};var e=null,k=!1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha1)return c.sha1;c.defined.sha1=
|
|
!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha1}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var q,e,l,m,k,z,w,A,F,H,x,G,u,r=d.length();64<=r;){for(k=0;16>k;++k)b[k]=d.getInt32();
|
|
for(;64>k;++k)q=b[k-2],q=(q>>>17|q<<15)^(q>>>19|q<<13)^q>>>10,e=b[k-15],e=(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,b[k]=q+b[k-7]+e+b[k-16]|0;z=a.h0;w=a.h1;A=a.h2;F=a.h3;H=a.h4;x=a.h5;G=a.h6;u=a.h7;for(k=0;64>k;++k)q=(H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7),l=G^H&(x^G),e=(z>>>2|z<<30)^(z>>>13|z<<19)^(z>>>22|z<<10),m=z&w|A&(z^w),q=u+q+l+p[k]+b[k],e+=m,u=G,G=x,x=H,H=F+q|0,F=A,A=w,w=z,z=q+e|0;a.h0=a.h0+z|0;a.h1=a.h1+w|0;a.h2=a.h2+A|0;a.h3=a.h3+F|0;a.h4=a.h4+H|0;a.h5=a.h5+x|0;a.h6=a.h6+G|0;a.h7=a.h7+u|0;r-=
|
|
64}}var d=a.sha256=a.sha256||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha256=a.md.algorithms.sha256=d;d.create=function(){k||(e=String.fromCharCode(128),e+=a.util.fillString(String.fromCharCode(0),64),p=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
|
|
2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],k=!0);var b=null,d=a.util.createBuffer(),h=Array(64),v={algorithm:"sha256",blockLength:64,digestLength:32,
|
|
messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){v.messageLength=0;v.fullMessageLength=v.messageLength64=[];for(var c=v.messageLengthSize/4,e=0;e<c;++e)v.fullMessageLength.push(0);d=a.util.createBuffer();b={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return v}};v.start();v.update=function(e,l){"utf8"===l&&(e=a.util.encodeUtf8(e));var k=e.length;v.messageLength+=k;for(var k=[k/4294967296>>>0,k>>>0],w=v.fullMessageLength.length-
|
|
1;0<=w;--w)v.fullMessageLength[w]+=k[1],k[1]=k[0]+(v.fullMessageLength[w]/4294967296>>>0),v.fullMessageLength[w]>>>=0,k[0]=k[1]/4294967296>>>0;d.putBytes(e);c(b,h,d);(2048<d.read||0===d.length())&&d.compact();return v};v.digest=function(){var k=a.util.createBuffer();k.putBytes(d.bytes());k.putBytes(e.substr(0,v.blockLength-(v.fullMessageLength[v.fullMessageLength.length-1]+v.messageLengthSize&v.blockLength-1)));a.util.createBuffer();for(var w,y,x=8*v.fullMessageLength[0],z=0;z<v.fullMessageLength.length;++z)w=
|
|
8*v.fullMessageLength[z+1],y=w/4294967296>>>0,x+=y,k.putInt32(x>>>0),x=w;w={h0:b.h0,h1:b.h1,h2:b.h2,h3:b.h3,h4:b.h4,h5:b.h5,h6:b.h6,h7:b.h7};c(w,h,k);k=a.util.createBuffer();k.putInt32(w.h0);k.putInt32(w.h1);k.putInt32(w.h2);k.putInt32(w.h3);k.putInt32(w.h4);k.putInt32(w.h5);k.putInt32(w.h6);k.putInt32(w.h7);return k};return v};var e=null,k=!1,p=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge=
|
|
{}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.sha256)return c.sha256;c.defined.sha256=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha256}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha256",["require","module","./util"],function(){p.apply(null,
|
|
Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){for(var q,e,l,m,g,A,k,w,x,p,u,r,B,P,Z,L,W,V,K,ba,ca,X,I,E,T,aa=d.length();128<=aa;){for(T=0;16>T;++T)b[T][0]=d.getInt32()>>>0,b[T][1]=d.getInt32()>>>0;for(;80>T;++T)g=b[T-2],x=g[0],g=g[1],q=((x>>>19|g<<13)^(g>>>29|x<<3)^x>>>6)>>>0,e=((x<<13|g>>>19)^(g<<3|x>>>29)^(x<<26|g>>>6))>>>0,g=b[T-15],x=g[0],g=g[1],l=((x>>>1|g<<31)^(x>>>8|g<<24)^x>>>7)>>>0,m=((x<<31|g>>>1)^(x<<24|g>>>8)^(x<<25|g>>>7))>>>0,x=b[T-7],p=b[T-
|
|
16],g=e+x[1]+m+p[1],b[T][0]=q+x[0]+l+p[0]+(g/4294967296>>>0)>>>0,b[T][1]=g>>>0;x=a[0][0];p=a[0][1];u=a[1][0];r=a[1][1];B=a[2][0];P=a[2][1];Z=a[3][0];L=a[3][1];W=a[4][0];V=a[4][1];K=a[5][0];ba=a[5][1];ca=a[6][0];X=a[6][1];I=a[7][0];E=a[7][1];for(T=0;80>T;++T)q=((W>>>14|V<<18)^(W>>>18|V<<14)^(V>>>9|W<<23))>>>0,g=((W<<18|V>>>14)^(W<<14|V>>>18)^(V<<23|W>>>9))>>>0,e=(ca^W&(K^ca))>>>0,A=(X^V&(ba^X))>>>0,l=((x>>>28|p<<4)^(p>>>2|x<<30)^(p>>>7|x<<25))>>>0,m=((x<<4|p>>>28)^(p<<30|x>>>2)^(p<<25|x>>>7))>>>0,
|
|
k=(x&u|B&(x^u))>>>0,w=(p&r|P&(p^r))>>>0,g=E+g+A+n[T][1]+b[T][1],q=I+q+e+n[T][0]+b[T][0]+(g/4294967296>>>0)>>>0,e=g>>>0,g=m+w,l=l+k+(g/4294967296>>>0)>>>0,m=g>>>0,I=ca,E=X,ca=K,X=ba,K=W,ba=V,g=L+e,W=Z+q+(g/4294967296>>>0)>>>0,V=g>>>0,Z=B,L=P,B=u,P=r,u=x,r=p,g=e+m,x=q+l+(g/4294967296>>>0)>>>0,p=g>>>0;g=a[0][1]+p;a[0][0]=a[0][0]+x+(g/4294967296>>>0)>>>0;a[0][1]=g>>>0;g=a[1][1]+r;a[1][0]=a[1][0]+u+(g/4294967296>>>0)>>>0;a[1][1]=g>>>0;g=a[2][1]+P;a[2][0]=a[2][0]+B+(g/4294967296>>>0)>>>0;a[2][1]=g>>>0;
|
|
g=a[3][1]+L;a[3][0]=a[3][0]+Z+(g/4294967296>>>0)>>>0;a[3][1]=g>>>0;g=a[4][1]+V;a[4][0]=a[4][0]+W+(g/4294967296>>>0)>>>0;a[4][1]=g>>>0;g=a[5][1]+ba;a[5][0]=a[5][0]+K+(g/4294967296>>>0)>>>0;a[5][1]=g>>>0;g=a[6][1]+X;a[6][0]=a[6][0]+ca+(g/4294967296>>>0)>>>0;a[6][1]=g>>>0;g=a[7][1]+E;a[7][0]=a[7][0]+I+(g/4294967296>>>0)>>>0;a[7][1]=g>>>0;aa-=128}}var d=a.sha512=a.sha512||{};a.md=a.md||{};a.md.algorithms=a.md.algorithms||{};a.md.sha512=a.md.algorithms.sha512=d;var e=a.sha384=a.sha512.sha384=a.sha512.sha384||
|
|
{};e.create=function(){return d.create("SHA-384")};a.md.sha384=a.md.algorithms.sha384=e;a.sha512.sha256=a.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256;a.sha512.sha224=a.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224;d.create=function(b){p||(k=String.fromCharCode(128),k+=a.util.fillString(String.fromCharCode(0),128),n=[[1116352408,
|
|
3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],
|
|
[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,
|
|
106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],
|
|
[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],g={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],
|
|
[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,
|
|
2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},p=!0);"undefined"===typeof b&&(b="SHA-512");if(!(b in g))throw Error("Invalid SHA-512 algorithm: "+b);for(var d=g[b],e=null,l=a.util.createBuffer(),y=Array(80),w=0;80>w;++w)y[w]=Array(2);var z={algorithm:b.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){z.messageLength=
|
|
0;z.fullMessageLength=z.messageLength128=[];for(var b=z.messageLengthSize/4,c=0;c<b;++c)z.fullMessageLength.push(0);l=a.util.createBuffer();e=Array(d.length);for(c=0;c<d.length;++c)e[c]=d[c].slice(0);return z}};z.start();z.update=function(b,d){"utf8"===d&&(b=a.util.encodeUtf8(b));var h=b.length;z.messageLength+=h;for(var h=[h/4294967296>>>0,h>>>0],g=z.fullMessageLength.length-1;0<=g;--g)z.fullMessageLength[g]+=h[1],h[1]=h[0]+(z.fullMessageLength[g]/4294967296>>>0),z.fullMessageLength[g]>>>=0,h[0]=
|
|
h[1]/4294967296>>>0;l.putBytes(b);c(e,y,l);(2048<l.read||0===l.length())&&l.compact();return z};z.digest=function(){var d=a.util.createBuffer();d.putBytes(l.bytes());d.putBytes(k.substr(0,z.blockLength-(z.fullMessageLength[z.fullMessageLength.length-1]+z.messageLengthSize&z.blockLength-1)));a.util.createBuffer();for(var A,g,n=8*z.fullMessageLength[0],w=0;w<z.fullMessageLength.length;++w)A=8*z.fullMessageLength[w+1],g=A/4294967296>>>0,n+=g,d.putInt32(n>>>0),n=A;A=Array(e.length);for(w=0;w<e.length;++w)A[w]=
|
|
e[w].slice(0);c(A,y,d);d=a.util.createBuffer();g="SHA-512"===b?A.length:"SHA-384"===b?A.length-2:A.length-4;for(w=0;w<g;++w)d.putInt32(A[w][0]),w===g-1&&"SHA-512/224"===b||d.putInt32(A[w][1]);return d};return z};var k=null,p=!1,n=null,g=null}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);
|
|
c=c||{};c.defined=c.defined||{};if(c.defined.sha512)return c.sha512;c.defined.sha512=!0;for(var m=0;m<e.length;++m)e[m](c);return c.sha512}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/sha512",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.md=a.md||{};
|
|
a.md.algorithms={md5:a.md5,sha1:a.sha1,sha256:a.sha256};a.md.md5=a.md5;a.md.sha1=a.sha1;a.md.sha256=a.sha256}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.md)return c.md;c.defined.md=!0;for(var m=0;m<e.length;++m)e[m](c);return c.md}},k=a;a=function(b,
|
|
c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.hmac=a.hmac||{}).create=function(){var b=null,c=null,d=null,e={start:function(e,n){if(null!==e)if("string"===typeof e)if(e=e.toLowerCase(),e in a.md.algorithms)b=
|
|
a.md.algorithms[e].create();else throw Error('Unknown hash algorithm "'+e+'"');else b=e;if(null!==n){if("string"===typeof n)n=a.util.createBuffer(n);else if(a.util.isArray(n)){var g=n;n=a.util.createBuffer();for(var h=0;h<g.length;++h)n.putByte(g[h])}var k=n.length();k>b.blockLength&&(b.start(),b.update(n.bytes()),n=b.digest());c=a.util.createBuffer();d=a.util.createBuffer();k=n.length();for(h=0;h<k;++h)g=n.at(h),c.putByte(54^g),d.putByte(92^g);if(k<b.blockLength)for(g=b.blockLength-k,h=0;h<g;++h)c.putByte(54),
|
|
d.putByte(92);c=c.bytes();d=d.bytes()}b.start();b.update(c)},update:function(a){b.update(a)},getMac:function(){var a=b.digest().bytes();b.start();b.update(d);b.update(a);return b.digest()}};e.digest=e.getMac;return e}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
|
|
{};if(c.defined.hmac)return c.hmac;c.defined.hmac=!0;for(var m=0;m<e.length;++m)e[m](c);return c.hmac}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/hmac",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a){for(var b=a.name+": ",d=[],q=function(a,
|
|
b){return" "+b},e=0;e<a.values.length;++e)d.push(a.values[e].replace(/^(\S+\r\n)/,q));b+=d.join(",")+"\r\n";d=0;a=-1;for(e=0;e<b.length;++e,++d)if(65<d&&-1!==a)d=b[a],","===d?(++a,b=b.substr(0,a)+"\r\n "+b.substr(a)):b=b.substr(0,a)+"\r\n"+d+b.substr(a+1),d=e-a-1,a=-1,++e;else if(" "===b[e]||"\t"===b[e]||","===b[e])a=e;return b}var d=a.pem=a.pem||{};d.encode=function(b,d){d=d||{};var e="-----BEGIN "+b.type+"-----\r\n",k;b.procType&&(k={name:"Proc-Type",values:[String(b.procType.version),b.procType.type]},
|
|
e+=c(k));b.contentDomain&&(k={name:"Content-Domain",values:[b.contentDomain]},e+=c(k));b.dekInfo&&(k={name:"DEK-Info",values:[b.dekInfo.algorithm]},b.dekInfo.parameters&&k.values.push(b.dekInfo.parameters),e+=c(k));if(b.headers)for(k=0;k<b.headers.length;++k)e+=c(b.headers[k]);b.procType&&(e+="\r\n");e+=a.util.encode64(b.body,d.maxline||64)+"\r\n";return e+="-----END "+b.type+"-----\r\n"};d.decode=function(b){for(var c=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,
|
|
e=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,g=/\r?\n/,h;;){h=d.exec(b);if(!h)break;var m={type:h[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(h[3])};c.push(m);if(h[2]){for(var k=h[2].split(g),w=0;h&&w<k.length;){h=k[w].replace(/\s+$/,"");for(var y=w+1;y<k.length;++y){var C=k[y];if(!/\s/.test(C[0]))break;h+=C;w=y}if(h=h.match(e)){for(var y={name:h[1],values:[]},C=h[2].split(","),z=0;z<C.length;++z)y.values.push(C[z].replace(/^\s+/,""));if(m.procType)if(m.contentDomain||
|
|
"Content-Domain"!==y.name)if(m.dekInfo||"DEK-Info"!==y.name)m.headers.push(y);else{if(0===y.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');m.dekInfo={algorithm:C[0],parameters:C[1]||null}}else m.contentDomain=C[0]||"";else{if("Proc-Type"!==y.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');
|
|
m.procType={version:C[0],type:C[1]}}}++w}if("ENCRYPTED"===m.procType&&!m.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===c.length)throw Error("Invalid PEM formatted message.");return c}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);
|
|
c=c||{};c.defined=c.defined||{};if(c.defined.pem)return c.pem;c.defined.pem=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pem}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pem",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,
|
|
function(){return new a.des.Algorithm(b,d)})}function d(a,b,c,e){var q=32===a.length?3:9;e=3===q?e?[30,-2,-2]:[0,32,2]:e?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m=b[0],l=b[1];b=(m>>>4^l)&252645135;l^=b;m^=b<<4;b=(m>>>16^l)&65535;l^=b;m^=b<<16;b=(l>>>2^m)&858993459;m^=b;l^=b<<2;b=(l>>>8^m)&16711935;m^=b;l^=b<<8;b=(m>>>1^l)&1431655765;for(var l=l^b,m=m^b<<1,m=m<<1|m>>>31,l=l<<1|l>>>31,w=0;w<q;w+=3){for(var G=e[w+1],u=e[w+2],R=e[w];R!=G;R+=u){var S=l^a[R],P=(l>>>4|l<<28)^a[R+1];b=m;
|
|
m=l;l=b^(p[S>>>24&63]|g[S>>>16&63]|v[S>>>8&63]|D[S&63]|k[P>>>24&63]|n[P>>>16&63]|h[P>>>8&63]|r[P&63])}b=m;m=l;l=b}m=m>>>1|m<<31;l=l>>>1|l<<31;b=(m>>>1^l)&1431655765;l^=b;m^=b<<1;b=(l>>>8^m)&16711935;m^=b;l^=b<<8;b=(l>>>2^m)&858993459;m^=b;l^=b<<2;b=(m>>>16^l)&65535;l^=b;m^=b<<16;b=(m>>>4^l)&252645135;c[0]=m^b<<4;c[1]=l^b}function e(b){b=b||{};var c="DES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):a.cipher.createCipher(c,b.key);var h=d.start;d.start=function(b,c){var e=
|
|
null;c instanceof a.util.ByteBuffer&&(e=c,c={});c=c||{};c.output=e;c.iv=b;h.call(d,c)};return d}a.des=a.des||{};a.des.startEncrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createEncryptionCipher=function(a,b){return e({key:a,output:null,decrypt:!1,mode:b})};a.des.startDecrypting=function(a,b,c,d){a=e({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};a.des.createDecryptionCipher=function(a,b){return e({key:a,
|
|
output:null,decrypt:!0,mode:b})};a.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,cipher:{encrypt:function(a,b){return d(c._keys,a,b,!1)},decrypt:function(a,b){return d(c._keys,a,b,!0)}}});c._init=!1};a.des.Algorithm.prototype.initialize=function(b){if(!this._init){b=a.util.createBuffer(b.key);if(0===this.name.indexOf("3DES")&&24!==b.length())throw Error("Invalid Triple-DES key size: "+8*b.length());for(var c=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
|
|
516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],e=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],A=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
|
|
g=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],m=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],k=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],n=[0,268435456,8,268435464,0,268435456,
|
|
8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],w=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],x=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],L=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],p=8<b.length()?3:
|
|
1,D=[],r=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],J=0,B,X=0;X<p;X++){var I=b.getInt32(),E=b.getInt32();B=(I>>>4^E)&252645135;E^=B;I^=B<<4;B=(E>>>-16^I)&65535;I^=B;E^=B<<-16;B=(I>>>2^E)&858993459;E^=B;I^=B<<2;B=(E>>>-16^I)&65535;I^=B;E^=B<<-16;B=(I>>>1^E)&1431655765;E^=B;I^=B<<1;B=(E>>>8^I)&16711935;I^=B;E^=B<<8;B=(I>>>1^E)&1431655765;E^=B;I^=B<<1;B=I<<8|E>>>20&240;for(var I=E<<24|E<<8&16711680|E>>>8&65280|E>>>24&240,E=B,T=0;T<r.length;++T){r[T]?(I=I<<2|I>>>26,E=E<<2|E>>>26):(I=I<<1|I>>>27,E=E<<1|E>>>27);
|
|
var I=I&-15,E=E&-15,aa=c[I>>>28]|d[I>>>24&15]|e[I>>>20&15]|A[I>>>16&15]|h[I>>>12&15]|g[I>>>8&15]|m[I>>>4&15],da=l[E>>>28]|k[E>>>24&15]|n[E>>>20&15]|w[E>>>16&15]|v[E>>>12&15]|x[E>>>8&15]|L[E>>>4&15];B=(da>>>16^aa)&65535;D[J++]=aa^B;D[J++]=da^B<<16}}this._keys=D;this._init=!0}};c("DES-ECB",a.cipher.modes.ecb);c("DES-CBC",a.cipher.modes.cbc);c("DES-CFB",a.cipher.modes.cfb);c("DES-OFB",a.cipher.modes.ofb);c("DES-CTR",a.cipher.modes.ctr);c("3DES-ECB",a.cipher.modes.ecb);c("3DES-CBC",a.cipher.modes.cbc);
|
|
c("3DES-CFB",a.cipher.modes.cfb);c("3DES-OFB",a.cipher.modes.ofb);c("3DES-CTR",a.cipher.modes.ctr);var k=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,
|
|
16778240,16778240,0,65540,66560,0,16842756],p=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,
|
|
-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,
|
|
134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],h=[256,
|
|
34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,
|
|
524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],v=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,
|
|
541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],r=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,
|
|
0,2099202,69206016,2048,67108866,67110912,2048,2097154],D=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,
|
|
266240,4160,4160,262208,268435456,268701696]}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.des)return c.des;c.defined.des=!0;for(var m=0;m<e.length;++m)e[m](c);return c.des}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,
|
|
k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d=a.pkcs5=a.pkcs5||{},e="undefined"!==typeof process&&process.versions&&process.versions.node,l;e&&!a.disableNativeCode&&(l=c("crypto"));a.pbkdf2=d.pbkdf2=function(b,c,d,g,h,m){function k(){if(G>r)return m(null,A);
|
|
O.start(null,null);O.update(c);O.update(a.util.int32ToBytes(G));F=M=O.digest().getBytes();u=2;p()}function p(){if(u<=d)return O.start(null,null),O.update(M),H=O.digest().getBytes(),F=a.util.xorBytes(F,H,y),M=H,++u,a.util.setImmediate(p);A+=G<r?F:F.substr(0,z);++G;k()}"function"===typeof h&&(m=h,h=null);if(e&&!a.disableNativeCode&&l.pbkdf2&&(null===h||"object"!==typeof h)&&(4<l.pbkdf2Sync.length||!h||"sha1"===h))return"string"!==typeof h&&(h="sha1"),c=new Buffer(c,"binary"),m?4===l.pbkdf2Sync.length?
|
|
l.pbkdf2(b,c,d,g,function(a,b){if(a)return m(a);m(null,b.toString("binary"))}):l.pbkdf2(b,c,d,g,h,function(a,b){if(a)return m(a);m(null,b.toString("binary"))}):4===l.pbkdf2Sync.length?l.pbkdf2Sync(b,c,d,g).toString("binary"):l.pbkdf2Sync(b,c,d,g,h).toString("binary");if("undefined"===typeof h||null===h)h=a.md.sha1.create();if("string"===typeof h){if(!(h in a.md.algorithms))throw Error("Unknown hash algorithm: "+h);h=a.md[h].create()}var y=h.digestLength;if(g>4294967295*y){b=Error("Derived key is too long.");
|
|
if(m)return m(b);throw b;}var r=Math.ceil(g/y),z=g-(r-1)*y,O=a.hmac.create();O.start(h,b);var A="",F,H,M;if(!m){for(var G=1;G<=r;++G){O.start(null,null);O.update(c);O.update(a.util.int32ToBytes(G));F=M=O.digest().getBytes();for(var u=2;u<=d;++u)O.start(null,null),O.update(M),H=O.digest().getBytes(),F=a.util.xorBytes(F,H,y),M=H;A+=G<r?F:F.substr(0,z)}return A}G=1;k()}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbkdf2)return c.pbkdf2;c.defined.pbkdf2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pbkdf2}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbkdf2",["require","module",
|
|
"./hmac","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var d="undefined"!==typeof process&&process.versions&&process.versions.node,e=null;a.disableNativeCode||!d||process.versions["node-webkit"]||(e=c("crypto"));(a.prng=a.prng||{}).create=function(b){function c(a){if(32<=g.pools[0].messageLength)return d(),a();g.seedFile(32-g.pools[0].messageLength<<5,function(b,c){if(b)return a(b);g.collect(c);d();a()})}function d(){var a=g.plugin.md.create();
|
|
a.update(g.pools[0].digest().getBytes());g.pools[0].start();for(var b=1,c=1;32>c;++c)b=31===b?2147483648:b<<2,0===b%g.reseeds&&(a.update(g.pools[c].digest().getBytes()),g.pools[c].start());b=a.digest().getBytes();a.start();a.update(b);a=a.digest().getBytes();g.key=g.plugin.formatKey(b);g.seed=g.plugin.formatSeed(a);g.reseeds=4294967295===g.reseeds?0:g.reseeds+1;g.generated=0}function m(b){var c=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(c=function(a){return d.getRandomValues(a)})}var e=
|
|
a.util.createBuffer();if(c)for(;e.length()<b;){var h=Math.max(1,Math.min(b-e.length(),65536)/4),g=new Uint32Array(Math.floor(h));try{for(c(g),h=0;h<g.length;++h)e.putInt32(g[h])}catch(A){if(!("undefined"!==typeof QuotaExceededError&&A instanceof QuotaExceededError))throw A;}}if(e.length()<b)for(c=Math.floor(65536*Math.random());e.length()<b;)for(h=16807*(c&65535),c=16807*(c>>16),h+=(c&32767)<<16,h+=c>>15,h=(h&2147483647)+(h>>31),c=h&4294967295,h=0;3>h;++h)g=c>>>(h<<3),g^=Math.floor(256*Math.random()),
|
|
e.putByte(String.fromCharCode(g&255));return e.getBytes(b)}var g={plugin:b,key:null,seed:null,time:null,reseeds:0,generated:0};b=b.md;for(var h=Array(32),k=0;32>k;++k)h[k]=b.create();g.pools=h;g.pool=0;g.generate=function(b,d){function e(n){if(n)return d(n);if(k.length()>=b)return d(null,k.getBytes(b));1048575<g.generated&&(g.key=null);if(null===g.key)return a.util.nextTick(function(){c(e)});n=h(g.key,g.seed);g.generated+=n.length;k.putBytes(n);g.key=l(h(g.key,m(g.seed)));g.seed=A(h(g.key,g.seed));
|
|
a.util.setImmediate(e)}if(!d)return g.generateSync(b);var h=g.plugin.cipher,m=g.plugin.increment,l=g.plugin.formatKey,A=g.plugin.formatSeed,k=a.util.createBuffer();g.key=null;e()};g.generateSync=function(b){var c=g.plugin.cipher,e=g.plugin.increment,h=g.plugin.formatKey,m=g.plugin.formatSeed;g.key=null;for(var l=a.util.createBuffer();l.length()<b;){1048575<g.generated&&(g.key=null);null===g.key&&(32<=g.pools[0].messageLength||g.collect(g.seedFileSync(32-g.pools[0].messageLength<<5)),d());var A=c(g.key,
|
|
g.seed);g.generated+=A.length;l.putBytes(A);g.key=h(c(g.key,e(g.seed)));g.seed=m(c(g.key,g.seed))}return l.getBytes(b)};e?(g.seedFile=function(a,b){e.randomBytes(a,function(a,c){if(a)return b(a);b(null,c.toString())})},g.seedFileSync=function(a){return e.randomBytes(a).toString()}):(g.seedFile=function(a,b){try{b(null,m(a))}catch(c){b(c)}},g.seedFileSync=m);g.collect=function(a){for(var b=a.length,c=0;c<b;++c)g.pools[g.pool].update(a.substr(c,1)),g.pool=31===g.pool?0:g.pool+1};g.collectInt=function(a,
|
|
b){for(var c="",d=0;d<b;d+=8)c+=String.fromCharCode(a>>d&255);g.collect(c)};g.registerWorker=function(a){a===self?g.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&g.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})};
|
|
return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prng)return c.prng;c.defined.prng=!0;for(var m=0;m<e.length;++m)e[m](c);return c.prng}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,
|
|
0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prng",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.random&&a.random.getBytes||function(b){function c(){var b=a.prng.create(d);b.getBytes=function(a,c){return b.generate(a,c)};b.getBytesSync=function(a){return b.generate(a)};return b}var d={},e=Array(4),k=a.util.createBuffer();d.formatKey=function(b){var c=a.util.createBuffer(b);b=Array(4);
|
|
b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return a.aes._expandKey(b,!1)};d.formatSeed=function(b){var c=a.util.createBuffer(b);b=Array(4);b[0]=c.getInt32();b[1]=c.getInt32();b[2]=c.getInt32();b[3]=c.getInt32();return b};d.cipher=function(b,c){a.aes._updateBlock(b,c,e,!1);k.putInt32(e[0]);k.putInt32(e[1]);k.putInt32(e[2]);k.putInt32(e[3]);return k.getBytes()};d.increment=function(a){++a[3];return a};d.md=a.md.sha256;var n=c(),g="undefined"!==typeof process&&process.versions&&
|
|
process.versions.node,h=null;if("undefined"!==typeof window){var v=window.crypto||window.msCrypto;v&&v.getRandomValues&&(h=function(a){return v.getRandomValues(a)})}if(a.disableNativeCode||!g&&!h){n.collectInt(+new Date,32);if("undefined"!==typeof navigator){var g="",p;for(p in navigator)try{"string"==typeof navigator[p]&&(g+=navigator[p])}catch(r){}n.collect(g);g=null}b&&(b().mousemove(function(a){n.collectInt(a.clientX,16);n.collectInt(a.clientY,16)}),b().keypress(function(a){n.collectInt(a.charCode,
|
|
8)}))}if(a.random)for(p in n)a.random[p]=n[p];else a.random=n;a.random.createInstance=c}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.random)return c.random;c.defined.random=!0;for(var m=0;m<e.length;++m)e[m](c);
|
|
return c.random}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
|
|
139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
|
|
175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];a.rc2=a.rc2||{};a.rc2.expandKey=function(b,d){"string"===typeof b&&(b=a.util.createBuffer(b));d=d||128;var e=b,g=b.length(),h=d,l=Math.ceil(h/8),h=255>>(h&7),k;for(k=g;128>k;k++)e.putByte(c[e.at(k-
|
|
1)+e.at(k-g)&255]);e.setAt(128-l,c[e.at(128-l)&h]);for(k=127-l;0<=k;k--)e.setAt(k,c[e.at(k+1)^e.at(k+l)]);return e};var e=function(b,c,e){var g=!1,h=null,m=null,l=null,k,y,p,z,r=[];b=a.rc2.expandKey(b,c);for(p=0;64>p;p++)r.push(b.getInt16Le());e?(k=function(a){for(p=0;4>p;p++){a[p]+=r[z]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);var b=a[p],c=d[p];a[p]=b<<c&65535|(b&65535)>>16-c;z++}},y=function(a){for(p=0;4>p;p++)a[p]+=r[a[(p+3)%4]&63]}):(k=function(a){for(p=3;0<=p;p--){var b=a[p],c=d[p];a[p]=
|
|
(b&65535)>>c|b<<16-c&65535;a[p]-=r[z]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);z--}},y=function(a){for(p=3;0<=p;p--)a[p]-=r[a[(p+3)%4]&63]});var A=null;return A={start:function(b,c){b&&"string"===typeof b&&(b=a.util.createBuffer(b));g=!1;h=a.util.createBuffer();m=c||new a.util.createBuffer;l=b;A.output=m},update:function(a){for(g||h.putBuffer(a);8<=h.length();){a=[[5,k],[1,y],[6,k],[1,y],[5,k]];var b=[];for(p=0;4>p;p++){var c=h.getInt16Le();null!==l&&(e?c^=l.getInt16Le():l.putInt16Le(c));
|
|
b.push(c&65535)}z=e?0:63;for(c=0;c<a.length;c++)for(var d=0;d<a[c][0];d++)a[c][1](b);for(p=0;4>p;p++)null!==l&&(e?l.putInt16Le(b[p]):b[p]^=l.getInt16Le()),m.putInt16Le(b[p])}},finish:function(a){var b=!0;if(e)if(a)b=a(8,h,!e);else{var c=8===h.length()?8:8-h.length();h.fillWithByte(c,c)}b&&(g=!0,A.update());!e&&(b=0===h.length())&&(a?b=a(8,m,!e):(a=m.length(),c=m.at(a-1),c>a?b=!1:m.truncate(c)));return b}}};a.rc2.startEncrypting=function(b,c,d){b=a.rc2.createEncryptionCipher(b,128);b.start(c,d);return b};
|
|
a.rc2.createEncryptionCipher=function(a,b){return e(a,b,!0)};a.rc2.startDecrypting=function(b,c,d){b=a.rc2.createDecryptionCipher(b,128);b.start(c,d);return b};a.rc2.createDecryptionCipher=function(a,b){return e(a,b,!1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
|
|
{};if(c.defined.rc2)return c.rc2;c.defined.rc2=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rc2}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rc2",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d){this.data=[];null!=a&&("number"==typeof a?
|
|
this.fromNumber(a,b,d):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function d(){return new c(null)}function e(a,b,c,d,q,h){for(;0<=--h;){var A=b*this.data[a++]+c.data[d]+q;q=Math.floor(A/67108864);c.data[d++]=A&67108863}return q}function k(a,b,c,d,e,q){var h=b&32767;for(b>>=15;0<=--q;){var A=this.data[a]&32767,g=this.data[a++]>>15,l=b*A+g*h,A=h*A+((l&32767)<<15)+c.data[d]+(e&1073741823);e=(A>>>30)+(l>>>15)+b*g+(e>>>30);c.data[d++]=A&1073741823}return e}function p(a,b,
|
|
c,d,e,q){var h=b&16383;for(b>>=14;0<=--q;){var A=this.data[a]&16383,g=this.data[a++]>>14,l=b*A+g*h,A=h*A+((l&16383)<<14)+c.data[d]+e;e=(A>>28)+(l>>14)+b*g;c.data[d++]=A&268435455}return e}function n(a,b){var c=G[a.charCodeAt(b)];return null==c?-1:c}function g(a){var b=d();b.fromInt(a);return b}function h(a){var b=1,c;0!=(c=a>>>16)&&(a=c,b+=16);0!=(c=a>>8)&&(a=c,b+=8);0!=(c=a>>4)&&(a=c,b+=4);0!=(c=a>>2)&&(a=c,b+=2);0!=a>>1&&(b+=1);return b}function v(a){this.m=a}function r(a){this.m=a;this.mp=a.invDigit();
|
|
this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function D(a,b){return a&b}function y(a,b){return a|b}function C(a,b){return a^b}function z(a,b){return a&~b}function O(){}function A(a){return a}function F(a){this.r2=d();this.q3=d();c.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function H(){return{nextBytes:function(a){for(var b=0;b<a.length;++b)a[b]=Math.floor(256*Math.random())}}}var M;"undefined"===typeof navigator?(c.prototype.am=p,M=28):"Microsoft Internet Explorer"==
|
|
navigator.appName?(c.prototype.am=k,M=30):"Netscape"!=navigator.appName?(c.prototype.am=e,M=26):(c.prototype.am=p,M=28);c.prototype.DB=M;c.prototype.DM=(1<<M)-1;c.prototype.DV=1<<M;c.prototype.FV=Math.pow(2,52);c.prototype.F1=52-M;c.prototype.F2=2*M-52;var G=[],u;M=48;for(u=0;9>=u;++u)G[M++]=u;M=97;for(u=10;36>u;++u)G[M++]=u;M=65;for(u=10;36>u;++u)G[M++]=u;v.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};v.prototype.revert=function(a){return a};v.prototype.reduce=
|
|
function(a){a.divRemTo(this.m,null,a)};v.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};v.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};r.prototype.convert=function(a){var b=d();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(c.ZERO)&&this.m.subTo(b,b);return b};r.prototype.revert=function(a){var b=d();a.copyTo(b);this.reduce(b);return b};r.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=
|
|
a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};r.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};r.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
|
|
c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,q=!1,h=0;0<=--e;){var A=8==d?a[e]&255:n(a,e);0>A?"-"==a.charAt(e)&&(q=!0):(q=!1,0==h?this.data[this.t++]=A:h+d>this.DB?(this.data[this.t-1]|=(A&(1<<this.DB-h)-1)<<h,this.data[this.t++]=
|
|
A>>this.DB-h):this.data[this.t-1]|=A<<h,h+=d,h>=this.DB&&(h-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<h&&(this.data[this.t-1]|=(1<<this.DB-h)-1<<h));this.clamp();q&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
|
|
a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,q=Math.floor(a/this.DB),h=this.s<<c&this.DM,A;for(A=this.t-1;0<=A;--A)b.data[A+q+1]=this.data[A]>>d|h,h=(this.data[A]&e)<<c;for(A=q-1;0<=A;--A)b.data[A]=0;b.data[q]=h;b.t=this.t+q+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,q=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var h=
|
|
c+1;h<this.t;++h)b.data[h-c-1]|=(this.data[h]&q)<<e,b.data[h-c]=this.data[h]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&q)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
|
|
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),q=d.t;for(b.t=q+e.t;0<=--q;)b.data[q]=0;for(q=0;q<e.t;++q)b.data[q+d.t]=d.am(0,e.data[q],b,q,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
|
|
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var q=a.abs();if(!(0>=q.t)){var A=this.abs();if(A.t<q.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var g=d(),l=this.s;a=a.s;var k=this.DB-h(q.data[q.t-1]);0<k?(q.lShiftTo(k,g),A.lShiftTo(k,e)):(q.copyTo(g),A.copyTo(e));q=g.t;A=g.data[q-1];if(0!=A){var n=A*(1<<this.F1)+(1<q?g.data[q-2]>>this.F2:0),F=this.FV/n,n=(1<<this.F1)/n,u=1<<this.F2,z=e.t,v=z-q,y=null==b?d():b;g.dlShiftTo(v,y);0<=e.compareTo(y)&&
|
|
(e.data[e.t++]=1,e.subTo(y,e));c.ONE.dlShiftTo(q,y);for(y.subTo(g,g);g.t<q;)g.data[g.t++]=0;for(;0<=--v;){var H=e.data[--z]==A?this.DM:Math.floor(e.data[z]*F+(e.data[z-1]+u)*n);if((e.data[z]+=g.am(0,H,e,v,0,q))<H)for(g.dlShiftTo(v,y),e.subTo(y,e);e.data[z]<--H;)e.subTo(y,e)}null!=b&&(e.drShiftTo(q,b),l!=a&&c.ZERO.subTo(b,b));e.t=q;e.clamp();0<k&&e.rShiftTo(k,e);0>l&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
|
|
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var e=d(),q=d(),A=b.convert(this),g=h(a)-1;for(A.copyTo(e);0<=--g;)if(b.sqrTo(e,q),0<(a&1<<g))b.mulTo(q,A,e);else var l=e,e=q,q=l;return b.revert(e)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
|
|
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",q=this.t,h=this.DB-q*this.DB%a;if(0<q--)for(h<this.DB&&0<(c=this.data[q]>>h)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=q;)h<a?(c=(this.data[q]&(1<<h)-1)<<a-h,c|=this.data[--q]>>(h+=this.DB-a)):(c=this.data[q]>>(h-=a)&b,0>=h&&(h+=this.DB,--q)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
|
|
d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
|
|
b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new v(b):new r(b);return this.exp(a,c)};c.ZERO=g(0);c.ONE=g(1);O.prototype.convert=A;O.prototype.revert=A;O.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};O.prototype.sqrTo=function(a,b){a.squareTo(b)};F.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};F.prototype.revert=function(a){return a};F.prototype.reduce=function(a){a.drShiftTo(this.m.t-
|
|
1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};F.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};F.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var R=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
|
|
113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],S=67108864/R[R.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
|
|
b),c=g(b),e=d(),q=d(),h="";for(this.divRemTo(c,e,q);0<e.signum();)h=(b+q.intValue()).toString(a).substr(1)+h,e.divRemTo(c,e,q);return q.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),q=!1,h=0,A=0,g=0;g<a.length;++g){var l=n(a,g);0>l?"-"==a.charAt(g)&&0==this.signum()&&(q=!0):(A=b*A+l,++h>=d&&(this.dMultiply(e),this.dAddOffset(A,0),A=h=0))}0<h&&(this.dMultiply(Math.pow(b,h)),this.dAddOffset(A,0));q&&c.ZERO.subTo(this,
|
|
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,q=Math.min(a.t,this.t);for(d=
|
|
0;d<q;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=q;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=q;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
|
|
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
|
|
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
|
|
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),q=H(),h,A=0;A<a;++A){do h=new c(this.bitLength(),q);while(0>=h.compareTo(c.ONE)||0<=h.compareTo(b));h=h.modPow(e,this);if(0!=h.compareTo(c.ONE)&&0!=h.compareTo(b)){for(var g=1;g++<d&&0!=
|
|
h.compareTo(b);)if(h=h.modPowInt(2,this),0==h.compareTo(c.ONE))return!1;if(0!=h.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
|
|
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
|
|
(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,D,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,y,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,C,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
|
|
z,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
|
|
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,y)};c.prototype.clearBit=function(a){return this.changeBit(a,
|
|
z)};c.prototype.flipBit=function(a){return this.changeBit(a,C)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
|
|
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),e,q=g(1),A;if(0>=c)return q;e=18>c?1:48>c?3:144>c?4:768>c?5:6;A=8>c?new v(b):b.isEven()?new F(b):new r(b);var l=[],m=3,k=e-1,n=(1<<e)-1;l[1]=A.convert(this);if(1<e)for(c=d(),A.sqrTo(l[1],c);m<=n;)l[m]=d(),A.mulTo(c,l[m-2],l[m]),m+=2;for(var u=a.t-1,z,y=!0,H=d(),c=h(a.data[u])-1;0<=u;){c>=k?z=a.data[u]>>c-k&n:(z=(a.data[u]&(1<<c+1)-1)<<k-c,0<u&&(z|=a.data[u-1]>>this.DB+c-k));for(m=e;0==(z&1);)z>>=1,--m;0>(c-=m)&&(c+=this.DB,--u);
|
|
if(y)l[z].copyTo(q),y=!1;else{for(;1<m;)A.sqrTo(q,H),A.sqrTo(H,q),m-=2;0<m?A.sqrTo(q,H):(m=q,q=H,H=m);A.mulTo(H,l[z],q)}for(;0<=u&&0==(a.data[u]&1<<c);)A.sqrTo(q,H),m=q,q=H,H=m,0>--c&&(c=this.DB-1,--u)}return A.revert(q)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),q=g(1),h=g(0),A=g(0),l=g(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(q.isEven()&&h.isEven()||(q.addTo(this,q),h.subTo(a,h)),q.rShiftTo(1,
|
|
q)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);for(;e.isEven();)e.rShiftTo(1,e),b?(A.isEven()&&l.isEven()||(A.addTo(this,A),l.subTo(a,l)),A.rShiftTo(1,A)):l.isEven()||l.subTo(a,l),l.rShiftTo(1,l);0<=d.compareTo(e)?(d.subTo(e,d),b&&q.subTo(A,q),h.subTo(l,h)):(e.subTo(d,e),b&&A.subTo(q,A),l.subTo(h,l))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=l.compareTo(a))return l.subtract(a);if(0>l.signum())l.addTo(a,l);else return l;return 0>l.signum()?l.add(a):l};c.prototype.pow=function(a){return this.exp(a,
|
|
new O)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
|
|
function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=R[R.length-1]){for(b=0;b<R.length;++b)if(c.data[0]==R[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<R.length;){for(var d=R[b],e=b+1;e<R.length&&d<S;)d*=R[e++];for(d=c.modInt(d);b<e;)if(0==d%R[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,
|
|
p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var m=0;m<e.length;++m)e[m](c);return c.jsbn}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var m="",g=Math.ceil(d/e.digestLength),h=0;h<g;++h){var k=String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+k);m+=e.digest().getBytes()}return m.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,k,g){var h,v,p,w;"string"===typeof e?(h=e,v=k||void 0,p=g||void 0):e&&(h=e.label||void 0,v=e.seed||void 0,p=e.md||void 0,e.mgf1&&e.mgf1.md&&(w=e.mgf1.md));p?p.start():p=a.md.sha1.create();
|
|
w||(w=p);b=Math.ceil(b.n.bitLength()/8);e=b-2*p.digestLength-2;if(d.length>e)throw w=Error("RSAES-OAEP input message length is too long."),w.length=d.length,w.maxLength=e,w;h||(h="");p.update(h,"raw");h=p.digest();k="";e-=d.length;for(g=0;g<e;g++)k+="\x00";d=h.getBytes()+k+"\u0001"+d;if(!v)v=a.random.getBytes(p.digestLength);else if(v.length!==p.digestLength)throw w=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),w.seedLength=v.length,w.digestLength=p.digestLength,
|
|
w;b=c(v,b-p.digestLength-1,w);d=a.util.xorBytes(d,b,d.length);p=c(d,p.digestLength,w);return"\x00"+a.util.xorBytes(v,p,v.length)+d};d.decode_rsa_oaep=function(b,d,e,k){var g,h,v;"string"===typeof e?(g=e,h=k||void 0):e&&(g=e.label||void 0,h=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));e=Math.ceil(b.n.bitLength()/8);if(d.length!==e)throw v=Error("RSAES-OAEP encoded message length is invalid."),v.length=d.length,v.expectedLength=e,v;void 0===h?h=a.md.sha1.create():h.start();v||(v=h);if(e<2*h.digestLength+
|
|
2)throw Error("RSAES-OAEP key is too short for the hash function.");g||(g="");h.update(g,"raw");g=h.digest().getBytes();b=d.charAt(0);k=d.substring(1,h.digestLength+1);d=d.substring(1+h.digestLength);var p=c(d,h.digestLength,v);k=a.util.xorBytes(k,p,k.length);v=c(k,e-h.digestLength-1,v);d=a.util.xorBytes(d,v,d.length);e=d.substring(0,h.digestLength);v="\x00"!==b;for(b=0;b<h.digestLength;++b)v|=g.charAt(b)!==e.charAt(b);g=1;for(h=b=h.digestLength;h<d.length;h++)e=d.charCodeAt(h),k=e&1^1,v|=e&(g?65534:
|
|
0),g&=k,b+=g;if(v||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var m=0;m<e.length;++m)e[m](c);return c.pkcs1}},
|
|
k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,q,h){return"workers"in q?e(a,b,q,h):d(a,b,q,h)}function d(b,c,e,g){var l=k(b,c),A=0,m=p(l.bitLength());"millerRabinTests"in
|
|
e&&(m=e.millerRabinTests);var n=10;"maxBlockTime"in e&&(n=e.maxBlockTime);var v=+new Date;do{l.bitLength()>b&&(l=k(b,c));if(l.isProbablePrime(m))return g(null,l);l.dAddOffset(h[A++%8],0)}while(0>n||+new Date-v<n);a.util.setImmediate(function(){d(b,c,e,g)})}function e(b,c,h,l){function m(){function a(e){if(!h){--q;var m=e.data;if(m.found){for(e=0;e<d.length;++e)d[e].terminate();h=!0;return l(null,new g(m.prime,16))}A.bitLength()>b&&(A=k(b,c));m=A.toString(16);e.target.postMessage({hex:m,workLoad:v});
|
|
A.dAddOffset(p,0)}}n=Math.max(1,n);for(var d=[],e=0;e<n;++e)d[e]=new Worker(r);for(var q=n,e=0;e<n;++e)d[e].addEventListener("message",a);var h=!1}if("undefined"===typeof Worker)return d(b,c,h,l);var A=k(b,c),n=h.workers,v=h.workLoad||100,p=30*v/8,r=h.workerScript||"forge/prime.worker.js";if(-1===n)return a.util.estimateCores(function(a,b){a&&(b=2);n=b-1;m()});m()}function k(a,b){var c=new g(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(g.ONE.shiftLeft(d),r,c);c.dAddOffset(31-c.mod(v).byteValue(),0);return c}
|
|
function p(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var n=a.prime=a.prime||{},g=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],v=new g(null);v.fromInt(30);var r=function(a,b){return a|b};n.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var h=d.algorithm||"PRIMEINC";"string"===typeof h&&(h={name:h});h.options=h.options||{};var g=d.prng||a.random;d={nextBytes:function(a){for(var b=g.getBytesSync(a.length),
|
|
c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===h.name)return c(b,d,h.options,e);throw Error("Invalid prime generation algorithm: "+h.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var m=
|
|
0;m<e.length;++m)e[m](c);return c.prime}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var h=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw h=
|
|
Error("Message is too long for PKCS#1 v1.5 padding."),h.length=b.length,h.max=d-11,h;h.putByte(0);h.putByte(e);d=d-3-b.length;if(0===e||1===e){e=0===e?0:255;for(var g=0;g<d;++g)h.putByte(e)}else for(;0<d;){for(var l=0,m=a.random.getBytes(d),g=0;g<d;++g)e=m.charCodeAt(g),0===e?++l:h.putByte(e);d=l}h.putByte(0);h.putBytes(b);return h}function d(b,c,e,h){c=Math.ceil(c.n.bitLength()/8);b=a.util.createBuffer(b);var g=b.getByte(),l=b.getByte();if(0!==g||e&&0!==l&&1!==l||!e&&2!=l||e&&0===l&&"undefined"===
|
|
typeof h)throw Error("Encryption block is invalid.");e=0;if(0===l)for(e=c-3-h,h=0;h<e;++h){if(0!==b.getByte())throw Error("Encryption block is invalid.");}else if(1===l)for(e=0;1<b.length();){if(255!==b.getByte()){--b.read;break}++e}else if(2===l)for(e=0;1<b.length();){if(0===b.getByte()){--b.read;break}++e}if(0!==b.getByte()||e!==c-3-b.length())throw Error("Encryption block is invalid.");return b.getBytes()}function e(b,c,d){function g(){l(b.pBits,function(a,c){if(a)return d(a);b.p=c;if(null!==b.q)return m(a,
|
|
b.q);l(b.qBits,m)})}function l(b,c){a.prime.generateProbablePrime(b,k,c)}function m(a,c){if(a)return d(a);b.q=c;if(0>b.p.compareTo(b.q)){var e=b.p;b.p=b.q;b.q=e}0!==b.p.subtract(n.ONE).gcd(b.e).compareTo(n.ONE)?(b.p=null,g()):0!==b.q.subtract(n.ONE).gcd(b.e).compareTo(n.ONE)?(b.q=null,l(b.qBits,m)):(b.p1=b.p.subtract(n.ONE),b.q1=b.q.subtract(n.ONE),b.phi=b.p1.multiply(b.q1),0!==b.phi.gcd(b.e).compareTo(n.ONE)?(b.p=b.q=null,g()):(b.n=b.p.multiply(b.q),b.n.bitLength()!==b.bits?(b.q=null,l(b.qBits,m)):
|
|
(e=b.e.modInverse(b.phi),b.keys={privateKey:h.rsa.setPrivateKey(b.n,b.e,e,b.p,b.q,e.mod(b.p1),e.mod(b.q1),b.q.modInverse(b.p)),publicKey:h.rsa.setPublicKey(b.n,b.e)},d(null,b.keys))))}"function"===typeof c&&(d=c,c={});c=c||{};var k={algorithm:{name:c.algorithm||"PRIMEINC",options:{workers:c.workers||2,workLoad:c.workLoad||100,workerScript:c.workerScript}}};"prng"in c&&(k.prng=c.prng);g()}function k(b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);return a.util.hexToBytes(b)}function p(a){return 100>=a?27:
|
|
150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof n)var n=a.jsbn.BigInteger;var g=a.asn1;a.pki=a.pki||{};a.pki.rsa=a.rsa=a.rsa||{};var h=a.pki,v=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},D={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
|
|
tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
|
|
tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},y={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},C=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},z=function(a){var b;if(a.algorithm in h.oids)b=h.oids[a.algorithm];
|
|
else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=g.oidToDer(b).getBytes();b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);var d=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);d.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,c));d.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));a=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return g.toDer(b).getBytes()},O=function(b,c,d){if(d)return b.modPow(c.e,
|
|
c.n);if(!c.p||!c.q)return b.modPow(c.d,c.n);c.dP||(c.dP=c.d.mod(c.p.subtract(n.ONE)));c.dQ||(c.dQ=c.d.mod(c.q.subtract(n.ONE)));c.qInv||(c.qInv=c.q.modInverse(c.p));do d=new n(a.util.bytesToHex(a.random.getBytes(c.n.bitLength()/8)),16);while(0<=d.compareTo(c.n)||!d.gcd(c.n).equals(n.ONE));b=b.multiply(d.modPow(c.e,c.n)).mod(c.n);var e=b.mod(c.p).modPow(c.dP,c.p);for(b=b.mod(c.q).modPow(c.dQ,c.q);0>e.compareTo(b);)e=e.add(c.p);b=e.subtract(b).multiply(c.qInv).mod(c.p).multiply(c.q).add(b);return b=
|
|
b.multiply(d.modInverse(c.n)).mod(c.n)};h.rsa.encrypt=function(b,d,e){var h=e,g=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(h=2===e,e=c(b,d,e)):(e=a.util.createBuffer(),e.putBytes(b));b=new n(e.toHex(),16);d=O(b,d,h).toString(16);h=a.util.createBuffer();for(g-=Math.ceil(d.length/2);0<g;)h.putByte(0),--g;h.putBytes(a.util.hexToBytes(d));return h.getBytes()};h.rsa.decrypt=function(b,c,e,h){var g=Math.ceil(c.n.bitLength()/8);if(b.length!==g)throw c=Error("Encrypted message length is invalid."),c.length=
|
|
b.length,c.expected=g,c;b=new n(a.util.createBuffer(b).toHex(),16);if(0<=b.compareTo(c.n))throw Error("Encrypted message is invalid.");b=O(b,c,e).toString(16);for(var l=a.util.createBuffer(),g=g-Math.ceil(b.length/2);0<g;)l.putByte(0),--g;l.putBytes(a.util.hexToBytes(b));return!1!==h?d(l.getBytes(),c,e):l.getBytes()};h.rsa.createKeyPairGenerationState=function(b,c,d){"string"===typeof b&&(b=parseInt(b,10));b=b||2048;d=d||{};var e=d.prng||a.random,h={nextBytes:function(a){for(var b=e.getBytesSync(a.length),
|
|
c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)b={algorithm:d,state:0,bits:b,rng:h,eInt:c||65537,e:new n(null),p:null,q:null,qBits:b>>1,pBits:b-(b>>1),pqState:0,num:null,keys:null},b.e.fromInt(b.eInt);else throw Error("Invalid key generation algorithm: "+d);return b};h.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new n(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},q=+new Date,g,l=0;null===a.keys&&
|
|
(0>=b||l<b);){if(0===a.state){g=null===a.p?a.pBits:a.qBits;var m=g-1;0===a.pqState?(a.num=new n(g,a.rng),a.num.testBit(m)||a.num.bitwiseTo(n.ONE.shiftLeft(m),e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>g?a.pqState=0:a.num.isProbablePrime(p(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(v[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(n.ONE).gcd(a.e).compareTo(n.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
|
|
null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(n.ONE),a.q1=a.q.subtract(n.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(n.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(g=a.e.modInverse(a.phi),a.keys={privateKey:h.rsa.setPrivateKey(a.n,a.e,g,a.p,a.q,
|
|
g.mod(a.p1),g.mod(a.q1),a.q.modInverse(a.p)),publicKey:h.rsa.setPublicKey(a.n,a.e)});g=+new Date;l+=g-q;q=g}return null!==a.keys};h.rsa.generateKeyPair=function(a,b,c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=
|
|
c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);var q=h.rsa.createKeyPairGenerationState(a,b,c);if(!d)return h.rsa.stepKeyPairGenerationState(q,0),q.keys;e(q,c,d)};h.setRsaPublicKey=h.rsa.setPublicKey=function(b,e){var l={n:b,e:e,encrypt:function(b,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,b,d){return c(a,b,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(b,c){return a.pkcs1.encode_rsa_oaep(c,
|
|
b,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');b=d.encode(b,l,!0);return h.rsa.encrypt(b,l,!0)},verify:function(a,b,c){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===c)c={verify:function(a,b){b=d(b,l,!0);var c=g.fromDer(b);return a===c.value[1].value}};else if("NONE"===c||"NULL"===c||null===c)c={verify:function(a,b){b=d(b,
|
|
l,!0);return a===b}};b=h.rsa.decrypt(b,l,!0,!1);return c.verify(a,b,l.n.bitLength())}};return l};h.setRsaPrivateKey=h.rsa.setPrivateKey=function(b,c,e,g,l,m,k,n){var v={n:b,e:c,d:e,p:g,q:l,dP:m,dQ:k,qInv:n,decrypt:function(b,c,e){"string"===typeof c?c=c.toUpperCase():void 0===c&&(c="RSAES-PKCS1-V1_5");b=h.rsa.decrypt(b,v,!1,!1);if("RSAES-PKCS1-V1_5"===c)c={decode:d};else if("RSA-OAEP"===c||"RSAES-OAEP"===c)c={decode:function(b,c){return a.pkcs1.decode_rsa_oaep(c,b,e)}};else if(-1!==["RAW","NONE",
|
|
"NULL",null].indexOf(c))c={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+c+'".');return c.decode(b,v,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:z},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;var d=b.encode(a,v.n.bitLength());return h.rsa.encrypt(d,v,c)}};return v};h.wrapRsaPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,
|
|
[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(h.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};h.privateKeyFromAsn1=function(b){var c={},d=[];g.validate(b,r,c,d)&&(b=g.fromDer(a.util.createBuffer(c.privateKey)));c={};d=[];if(!g.validate(b,D,c,d))throw c=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
|
|
c.errors=d,c;var e,l,m,k,z,d=a.util.createBuffer(c.privateKeyModulus).toHex();b=a.util.createBuffer(c.privateKeyPublicExponent).toHex();e=a.util.createBuffer(c.privateKeyPrivateExponent).toHex();l=a.util.createBuffer(c.privateKeyPrime1).toHex();m=a.util.createBuffer(c.privateKeyPrime2).toHex();k=a.util.createBuffer(c.privateKeyExponent1).toHex();z=a.util.createBuffer(c.privateKeyExponent2).toHex();c=a.util.createBuffer(c.privateKeyCoefficient).toHex();return h.setRsaPrivateKey(new n(d,16),new n(b,
|
|
16),new n(e,16),new n(l,16),new n(m,16),new n(k,16),new n(z,16),new n(c,16))};h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.p)),g.create(g.Class.UNIVERSAL,
|
|
g.Type.INTEGER,!1,k(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.qInv))])};h.publicKeyFromAsn1=function(b){var c={},d=[];if(g.validate(b,C,c,d)){d=g.derToOid(c.publicKeyOid);if(d!==h.oids.rsaEncryption)throw c=Error("Cannot read public key. Unknown OID."),c.oid=d,c;b=c.rsaPublicKey}d=[];if(!g.validate(b,y,c,d))throw c=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
|
|
c.errors=d,c;d=a.util.createBuffer(c.publicKeyModulus).toHex();c=a.util.createBuffer(c.publicKeyExponent).toHex();return h.setRsaPublicKey(new n(d,16),new n(c,16))};h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(h.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
|
|
!1,[h.publicKeyToRSAPublicKey(a)])])};h.publicKeyToRSAPublicKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,k(a.e))])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||
|
|
{};c.defined=c.defined||{};if(c.defined.rsa)return c.rsa;c.defined.rsa=!0;for(var m=0;m<e.length;++m)e[m](c);return c.rsa}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,
|
|
b){return a.start().update(b).digest().getBytes()}if("undefined"===typeof d)var d=a.jsbn.BigInteger;var e=a.asn1,k=a.pki=a.pki||{};k.pbe=a.pbe=a.pbe||{};var p=k.oids,n={name:"EncryptedPrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encryptionOid"},
|
|
{name:"AlgorithmIdentifier.parameters",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},g={name:"PBES2Algorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
|
|
tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:e.Class.UNIVERSAL,
|
|
type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},h={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
|
|
{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};k.encryptPrivateKeyInfo=function(b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var h=a.random.getBytesSync(d.saltSize),g=d.count,m=e.integerToDer(g),n;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var A,F;switch(d.algorithm){case "aes128":A=n=16;d=p["aes128-CBC"];F=a.aes.createEncryptionCipher;break;case "aes192":n=24;
|
|
A=16;d=p["aes192-CBC"];F=a.aes.createEncryptionCipher;break;case "aes256":n=32;A=16;d=p["aes256-CBC"];F=a.aes.createEncryptionCipher;break;case "des":A=n=8;d=p.desCBC;F=a.des.createEncryptionCipher;break;default:throw h=Error("Cannot encrypt private key. Unknown encryption algorithm."),h.algorithm=d.algorithm,h;}var w=a.pkcs5.pbkdf2(c,h,g,n);c=a.random.getBytesSync(A);g=F(w);g.start(c);g.update(e.toDer(b));g.finish();b=g.output.getBytes();h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
|
|
e.Type.OID,!1,e.oidToDer(p.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,m.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
|
|
e.Type.OCTETSTRING,!1,c)])])])}else if("3des"===d.algorithm)n=24,d=new a.util.ByteBuffer(h),w=k.pbe.generatePkcs12Key(c,d,1,g,n),c=k.pbe.generatePkcs12Key(c,d,2,g,n),g=a.des.createEncryptionCipher(w),g.start(c),g.update(e.toDer(b)),g.finish(),b=g.output.getBytes(),h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
|
|
!1,h),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,m.getBytes())])]);else throw h=Error("Cannot encrypt private key. Unknown encryption algorithm."),h.algorithm=d.algorithm,h;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[h,e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,b)])};k.decryptPrivateKeyInfo=function(b,c){var d=null,h={},g=[];if(!e.validate(b,n,h,g))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=g,d;g=e.derToOid(h.encryptionOid);
|
|
g=k.pbe.getCipher(g,h.encryptionParams,c);h=a.util.createBuffer(h.encryptedData);g.update(h);g.finish()&&(d=e.fromDer(g.output));return d};k.encryptedPrivateKeyToPem=function(b,c){var d={type:"ENCRYPTED PRIVATE KEY",body:e.toDer(b).getBytes()};return a.pem.encode(d,{maxline:c})};k.encryptedPrivateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==b.type){var c=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');c.headerType=
|
|
b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return e.fromDer(b.body)};k.encryptRsaPrivateKey=function(b,c,d){d=d||{};if(!d.legacy)return b=k.wrapRsaPrivateKey(k.privateKeyToAsn1(b)),b=k.encryptPrivateKeyInfo(b,c,d),k.encryptedPrivateKeyToPem(b);var h,g,m;switch(d.algorithm){case "aes128":d="AES-128-CBC";g=16;h=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "aes192":d="AES-192-CBC";
|
|
g=24;h=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "aes256":d="AES-256-CBC";g=32;h=a.random.getBytesSync(16);m=a.aes.createEncryptionCipher;break;case "3des":d="DES-EDE3-CBC";g=24;h=a.random.getBytesSync(8);m=a.des.createEncryptionCipher;break;case "des":d="DES-CBC";g=8;h=a.random.getBytesSync(8);m=a.des.createEncryptionCipher;break;default:throw b=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+d.algorithm+'".'),b.algorithm=d.algorithm,b;}c=a.pbe.opensslDeriveBytes(c,
|
|
h.substr(0,8),g);c=m(c);c.start(h);c.update(e.toDer(k.privateKeyToAsn1(b)));c.finish();b={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:d,parameters:a.util.bytesToHex(h).toUpperCase()},body:c.output.getBytes()};return a.pem.encode(b)};k.decryptRsaPrivateKey=function(b,c){var d=null,h=a.pem.decode(b)[0];if("ENCRYPTED PRIVATE KEY"!==h.type&&"PRIVATE KEY"!==h.type&&"RSA PRIVATE KEY"!==h.type)throw d=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),
|
|
d.headerType=d,d;if(h.procType&&"ENCRYPTED"===h.procType.type){var g,m;switch(h.dekInfo.algorithm){case "DES-CBC":g=8;m=a.des.createDecryptionCipher;break;case "DES-EDE3-CBC":g=24;m=a.des.createDecryptionCipher;break;case "AES-128-CBC":g=16;m=a.aes.createDecryptionCipher;break;case "AES-192-CBC":g=24;m=a.aes.createDecryptionCipher;break;case "AES-256-CBC":g=32;m=a.aes.createDecryptionCipher;break;case "RC2-40-CBC":g=5;m=function(b){return a.rc2.createDecryptionCipher(b,40)};break;case "RC2-64-CBC":g=
|
|
8;m=function(b){return a.rc2.createDecryptionCipher(b,64)};break;case "RC2-128-CBC":g=16;m=function(b){return a.rc2.createDecryptionCipher(b,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+h.dekInfo.algorithm+'".'),d.algorithm=h.dekInfo.algorithm,d;}var n=a.util.hexToBytes(h.dekInfo.parameters);g=a.pbe.opensslDeriveBytes(c,n.substr(0,8),g);m=m(g);m.start(n);m.update(a.util.createBuffer(h.body));if(m.finish())d=m.output.getBytes();else return d}else d=
|
|
h.body;d="ENCRYPTED PRIVATE KEY"===h.type?k.decryptPrivateKeyInfo(e.fromDer(d),c):e.fromDer(d);null!==d&&(d=k.privateKeyFromAsn1(d));return d};k.pbe.generatePkcs12Key=function(b,c,d,e,h,g){var k,m;if("undefined"===typeof g||null===g)g=a.md.sha1.create();var l=g.digestLength,n=g.blockLength,p=new a.util.ByteBuffer,w=new a.util.ByteBuffer;if(null!==b&&void 0!==b){for(m=0;m<b.length;m++)w.putInt16(b.charCodeAt(m));w.putInt16(0)}b=w.length();var u=c.length(),r=new a.util.ByteBuffer;r.fillWithByte(d,n);
|
|
var x=n*Math.ceil(u/n);d=new a.util.ByteBuffer;for(m=0;m<x;m++)d.putByte(c.at(m%u));x=n*Math.ceil(b/n);c=new a.util.ByteBuffer;for(m=0;m<x;m++)c.putByte(w.at(m%b));w=d;w.putBuffer(c);c=Math.ceil(h/l);for(d=1;d<=c;d++){x=new a.util.ByteBuffer;x.putBytes(r.bytes());x.putBytes(w.bytes());for(m=0;m<e;m++)g.start(),g.update(x.getBytes()),x=g.digest();var B=new a.util.ByteBuffer;for(m=0;m<n;m++)B.putByte(x.at(m%l));var Z=Math.ceil(u/n)+Math.ceil(b/n),L=new a.util.ByteBuffer;for(k=0;k<Z;k++){var W=new a.util.ByteBuffer(w.getBytes(n)),
|
|
V=511;for(m=B.length()-1;0<=m;m--)V>>=8,V+=B.at(m)+W.at(m),W.setAt(m,V&255);L.putBuffer(W)}w=L;p.putBuffer(x)}p.truncate(p.length()-h);return p};k.pbe.getCipher=function(a,b,c){switch(a){case k.oids.pkcs5PBES2:return k.pbe.getCipherForPBES2(a,b,c);case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case k.oids["pbewithSHAAnd40BitRC2-CBC"]:return k.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
|
|
"pbewithSHAAnd40BitRC2-CBC"],b;}};k.pbe.getCipherForPBES2=function(b,c,d){var h={};b=[];if(!e.validate(c,g,h,b)){var m=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");m.errors=b;throw m;}b=e.derToOid(h.kdfOid);if(b!==k.oids.pkcs5PBKDF2)throw m=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),m.oid=b,m.supportedOids=["pkcs5PBKDF2"],m;b=e.derToOid(h.encOid);if(b!==k.oids["aes128-CBC"]&&
|
|
b!==k.oids["aes192-CBC"]&&b!==k.oids["aes256-CBC"]&&b!==k.oids["des-EDE3-CBC"]&&b!==k.oids.desCBC)throw m=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),m.oid=b,m.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],m;c=h.kdfSalt;var n=a.util.createBuffer(h.kdfIterationCount),n=n.getInt(n.length()<<3),p;switch(k.oids[b]){case "aes128-CBC":p=16;m=a.aes.createDecryptionCipher;break;case "aes192-CBC":p=24;m=a.aes.createDecryptionCipher;break;
|
|
case "aes256-CBC":p=32;m=a.aes.createDecryptionCipher;break;case "des-EDE3-CBC":p=24;m=a.des.createDecryptionCipher;break;case "desCBC":p=8,m=a.des.createDecryptionCipher}b=a.pkcs5.pbkdf2(d,c,n,p);h=h.encIv;m=m(b);m.start(h);return m};k.pbe.getCipherForPKCS12PBE=function(b,c,d){var g={},m=[];if(!e.validate(c,h,g,m))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=m,d;var m=a.util.createBuffer(g.salt),g=a.util.createBuffer(g.iterations),
|
|
g=g.getInt(g.length()<<3),n;switch(b){case k.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:n=24;c=8;b=a.des.startDecrypting;break;case k.oids["pbewithSHAAnd40BitRC2-CBC"]:n=5;c=8;b=function(b,c){var d=a.rc2.createDecryptionCipher(b,40);d.start(c,null);return d};break;default:throw d=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),d.oid=b,d;}n=k.pbe.generatePkcs12Key(d,m,1,g,n);d=k.pbe.generatePkcs12Key(d,m,2,g,c);return b(n,d)};k.pbe.opensslDeriveBytes=function(b,d,e,h){if("undefined"===
|
|
typeof h||null===h)h=a.md.md5.create();null===d&&(d="");for(var g=[c(h,b+d)],k=16,l=1;k<e;++l,k+=16)g.push(c(h,g[l-1]+b+d));return g.join("").substr(0,e)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pbe)return c.pbe;c.defined.pbe=!0;for(var m=
|
|
0;m<e.length;++m)e[m](c);return c.pbe}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=
|
|
a.pkcs7||{};a.pkcs7.asn1=d;a={name:"ContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};d.contentInfoValidator=a;var e={name:"EncryptedContentInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",
|
|
tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",
|
|
tagClass:c.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};d.envelopedDataValidator={name:"EnvelopedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(e)};d.encryptedDataValidator={name:"EncryptedData",
|
|
tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"}].concat(e)};d.signedDataValidator={name:"SignedData",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,constructed:!0,
|
|
captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:c.Class.UNIVERSAL,type:c.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:c.Class.UNIVERSAL,
|
|
type:c.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,
|
|
constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:c.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};d.recipientInfoValidator={name:"RecipientInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,
|
|
constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:c.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7asn1)return c.pkcs7asn1;c.defined.pkcs7asn1=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pkcs7asn1}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs7asn1",
|
|
["require","module","./asn1","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};(a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(b){return{generate:function(c,d){for(var e=new a.util.ByteBuffer,k=Math.ceil(d/b.digestLength),n=0;n<k;n++){var g=new a.util.ByteBuffer;g.putInt32(n);b.start();b.update(c+g.getBytes());e.putBuffer(b.digest())}e.truncate(e.length()-d);return e.getBytes()}}}}if("function"!==typeof a)if("object"===typeof module&&
|
|
module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.mgf1)return c.mgf1;c.defined.mgf1=!0;for(var k=0;k<e.length;++k)e[k](c);return c.mgf1}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};a("js/mgf1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.mgf=a.mgf||{};a.mgf.mgf1=a.mgf1}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||
|
|
{};if(c.defined.mgf)return c.mgf;c.defined.mgf=!0;for(var k=0;k<e.length;++k)e[k](c);return c.mgf}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/mgf",["require","module","./mgf1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){(a.pss=a.pss||{}).create=function(b){3===arguments.length&&
|
|
(b={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var c=b.md,d=b.mgf,e=c.digestLength,k=b.salt||null;"string"===typeof k&&(k=a.util.createBuffer(k));var n;if("saltLength"in b)n=b.saltLength;else if(null!==k)n=k.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==k&&k.length()!==n)throw Error("Given salt length does not match length of given salt.");var g=b.prng||a.random;return{encode:function(b,m){var p,r=m-1,y=Math.ceil(r/8),C=b.digest().getBytes();
|
|
if(y<e+n+2)throw Error("Message is too long to encrypt.");var z;z=null===k?g.getBytesSync(n):k.bytes();p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(C);p.putBytes(z);c.start();c.update(p.getBytes());C=c.digest().getBytes();p=new a.util.ByteBuffer;p.fillWithByte(0,y-n-e-2);p.putByte(1);p.putBytes(z);var O=p.getBytes(),A=y-e-1,F=d.generate(C,A);z="";for(p=0;p<A;p++)z+=String.fromCharCode(O.charCodeAt(p)^F.charCodeAt(p));r=65280>>8*y-r&255;z=String.fromCharCode(z.charCodeAt(0)&~r)+z.substr(1);
|
|
return z+C+String.fromCharCode(188)},verify:function(b,g,k){var m;m=k-1;k=Math.ceil(m/8);g=g.substr(-k);if(k<e+n+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(k-1))throw Error("Encoded message does not end in 0xBC.");var p=k-e-1,r=g.substr(0,p);g=g.substr(p,e);var z=65280>>8*k-m&255;if(0!==(r.charCodeAt(0)&z))throw Error("Bits beyond keysize not zero as expected.");var O=d.generate(g,p),A="";for(m=0;m<p;m++)A+=String.fromCharCode(r.charCodeAt(m)^O.charCodeAt(m));
|
|
A=String.fromCharCode(A.charCodeAt(0)&~z)+A.substr(1);k=k-e-n-2;for(m=0;m<k;m++)if(0!==A.charCodeAt(m))throw Error("Leftmost octets not zero as expected");if(1!==A.charCodeAt(k))throw Error("Inconsistent PSS signature, 0x01 marker not found");k=A.substr(-n);p=new a.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(b);p.putBytes(k);c.start();c.update(p.getBytes());b=c.digest().getBytes();return g===b}}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,
|
|
module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pss)return c.pss;c.defined.pss=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pss}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pss",
|
|
["require","module","./random","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b){"string"===typeof b&&(b={shortName:b});for(var d=null,e,h=0;null===d&&h<a.attributes.length;++h)e=a.attributes[h],b.type&&b.type===e.type?d=e:b.name&&b.name===e.name?d=e:b.shortName&&b.shortName===e.shortName&&(d=e);return d}function d(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),e;b=b.attributes;for(var h=0;h<b.length;++h){e=b[h];
|
|
var k=e.value,m=g.Type.PRINTABLESTRING;"valueTagClass"in e&&(m=e.valueTagClass,m===g.Type.UTF8&&(k=a.util.encodeUtf8(k)));e=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,m,!1,k)])]);c.value.push(e)}return c}function e(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in h.oids?b.name=h.oids[b.type]:b.shortName&&b.shortName in
|
|
r&&(b.name=h.oids[r[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in h.oids)b.type=h.oids[b.name];else throw a=Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in r&&(b.shortName=r[b.name]);if(b.type===v.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=g.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(h.certificateExtensionToAsn1(k(b.extensions[d])))}if("undefined"===
|
|
typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function k(b,c){c=c||{};"undefined"===typeof b.name&&b.id&&b.id in h.oids&&(b.name=h.oids[b.id]);if("undefined"===typeof b.id)if(b.name&&b.name in h.oids)b.id=h.oids[b.name];else{var d=Error("Extension ID not specified.");d.extension=b;throw d;}if("undefined"!==typeof b.value)return b;if("keyUsage"===b.name){var e=d=0,m=0;b.digitalSignature&&(e|=128,d=7);b.nonRepudiation&&(e|=64,d=6);b.keyEncipherment&&(e|=32,d=5);b.dataEncipherment&&
|
|
(e|=16,d=4);b.keyAgreement&&(e|=8,d=3);b.keyCertSign&&(e|=4,d=2);b.cRLSign&&(e|=2,d=1);b.encipherOnly&&(e|=1,d=0);b.decipherOnly&&(m|=128,d=7);d=String.fromCharCode(d);0!==m?d+=String.fromCharCode(e)+String.fromCharCode(m):0!==e&&(d+=String.fromCharCode(e));b.value=g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,d)}else if("basicConstraints"===b.name)b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),b.cA&&b.value.value.push(g.create(g.Class.UNIVERSAL,g.Type.BOOLEAN,!1,String.fromCharCode(255))),
|
|
"pathLenConstraint"in b&&b.value.value.push(g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.pathLenConstraint).getBytes()));else if("extKeyUsage"===b.name)for(e in b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),d=b.value.value,b)!0===b[e]&&(e in v?d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(v[e]).getBytes())):-1!==e.indexOf(".")&&d.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e).getBytes())));else if("nsCertType"===b.name)e=d=0,b.client&&(e|=128,
|
|
d=7),b.server&&(e|=64,d=6),b.email&&(e|=32,d=5),b.objsign&&(e|=16,d=4),b.reserved&&(e|=8,d=3),b.sslCA&&(e|=4,d=2),b.emailCA&&(e|=2,d=1),b.objCA&&(e|=1,d=0),d=String.fromCharCode(d),0!==e&&(d+=String.fromCharCode(e)),b.value=g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,d);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.value=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),m=0;m<b.altNames.length;++m){e=b.altNames[m];d=e.value;if(7===e.type&&e.ip){if(d=a.util.bytesFromIP(e.ip),
|
|
null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=b,d;}else 8===e.type&&(d=e.oid?g.oidToDer(g.oidToDer(e.oid)):g.oidToDer(d));b.value.value.push(g.create(g.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===b.name&&c.cert&&(d=c.cert.generateSubjectKeyIdentifier(),b.subjectKeyIdentifier=d.toHex(),b.value=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof b.value)throw d=Error("Extension value not specified."),
|
|
d.extension=b,d;return b}function p(a,b){switch(a){case v["RSASSA-PSS"]:var c=[];void 0!==b.hash.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])]));void 0!==b.mgf.algorithmOid&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,
|
|
!1,g.oidToDer(b.mgf.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.mgf.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])])]));void 0!==b.saltLength&&c.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.saltLength).getBytes())]));return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,c);default:return g.create(g.Class.UNIVERSAL,g.Type.NULL,
|
|
!1,"")}}function n(b){var c=g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===b.attributes.length)return c;b=b.attributes;for(var d=0;d<b.length;++d){var e=b[d],h=e.value,k=g.Type.UTF8;"valueTagClass"in e&&(k=e.valueTagClass);k===g.Type.UTF8&&(h=a.util.encodeUtf8(h));var m=!1;"valueConstructed"in e&&(m=e.valueConstructed);e=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,
|
|
k,m,h)])]);c.value.push(e)}return c}var g=a.asn1,h=a.pki=a.pki||{},v=h.oids,r={};r.CN=v.commonName;r.commonName="CN";r.C=v.countryName;r.countryName="C";r.L=v.localityName;r.localityName="L";r.ST=v.stateOrProvinceName;r.stateOrProvinceName="ST";r.O=v.organizationName;r.organizationName="O";r.OU=v.organizationalUnitName;r.organizationalUnitName="OU";r.E=v.emailAddress;r.emailAddress="E";var D=a.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"Certificate.TBSCertificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,
|
|
capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,
|
|
constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
|
|
{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},D,{name:"Certificate.TBSCertificate.issuerUniqueID",
|
|
tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},
|
|
{name:"Certificate.TBSCertificate.extensions",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},
|
|
{name:"Certificate.signatureValue",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},C={name:"rsapss",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
|
|
tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},z={name:"CertificationRequest",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
|
|
tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},D,{name:"CertificationRequestInfo.attributes",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
|
|
tagClass:g.Class.UNIVERSAL,type:g.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:g.Class.UNIVERSAL,
|
|
type:g.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};h.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,h,q=0;q<a.value.length;++q){d=a.value[q];for(var k=0;k<d.value.length;++k)h={},e=d.value[k],h.type=g.derToOid(e.value[0].value),h.value=e.value[1].value,h.valueTagClass=e.value[1].type,h.type in v&&(h.name=v[h.type],h.name in r&&(h.shortName=r[h.name])),b&&(b.update(h.type),b.update(h.value)),c.push(h)}return c};h.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
|
|
a[c],e=g.derToOid(d.value[0].value),d=d.value[1].value,q=0;q<d.length;++q){var k={};k.type=e;k.value=d[q].value;k.valueTagClass=d[q].type;k.type in v&&(k.name=v[k.type],k.name in r&&(k.shortName=r[k.name]));if(k.type===v.extensionRequest){k.extensions=[];for(var m=0;m<k.value.length;++m)k.extensions.push(h.certificateExtensionFromAsn1(k.value[m]))}b.push(k)}return b};var O=function(a,b,c){var d={};if(a!==v["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:v.sha1},mgf:{algorithmOid:v.mgf1,hash:{algorithmOid:v.sha1}},
|
|
saltLength:20});c={};a=[];if(!g.validate(b,C,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=g.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=g.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=g.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};h.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
|
|
b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return h.certificateFromAsn1(d,c)};h.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:g.toDer(h.certificateToAsn1(b)).getBytes()};
|
|
return a.pem.encode(d,{maxline:c})};h.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=g.fromDer(b.body);return h.publicKeyFromAsn1(b)};h.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",
|
|
body:g.toDer(h.publicKeyToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.publicKeyToRSAPublicKeyPem=function(b,c){var d={type:"RSA PUBLIC KEY",body:g.toDer(h.publicKeyToRSAPublicKey(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.getPublicKeyFingerprint=function(b,c){c=c||{};var d=c.md||a.md.sha1.create(),e;switch(c.type||"RSAPublicKey"){case "RSAPublicKey":e=g.toDer(h.publicKeyToRSAPublicKey(b)).getBytes();break;case "SubjectPublicKeyInfo":e=g.toDer(h.publicKeyToAsn1(b)).getBytes();
|
|
break;default:throw Error('Unknown fingerprint type "'+c.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===c.encoding)return d=d.toHex(),c.delimiter?d.match(/.{2}/g).join(c.delimiter):d;if("binary"===c.encoding)return d.getBytes();if(c.encoding)throw Error('Unknown encoding "'+c.encoding+'".');return d};h.certificationRequestFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE REQUEST"!==b.type)throw c=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
|
|
c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=g.fromDer(b.body,d);return h.certificationRequestFromAsn1(d,c)};h.certificationRequestToPem=function(b,c){var d={type:"CERTIFICATE REQUEST",body:g.toDer(h.certificationRequestToAsn1(b)).getBytes()};return a.pem.encode(d,{maxline:c})};h.createCertificate=function(){var b={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=
|
|
null;b.validity={};b.validity.notBefore=new Date;b.validity.notAfter=new Date;b.issuer={};b.issuer.getField=function(a){return c(b.issuer,a)};b.issuer.addField=function(a){e([a]);b.issuer.attributes.push(a)};b.issuer.attributes=[];b.issuer.hash=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.extensions=[];b.publicKey=null;b.md=null;b.setSubject=function(a,c){e(a);
|
|
b.subject.attributes=a;delete b.subject.uniqueId;c&&(b.subject.uniqueId=c);b.subject.hash=null};b.setIssuer=function(a,c){e(a);b.issuer.attributes=a;delete b.issuer.uniqueId;c&&(b.issuer.uniqueId=c);b.issuer.hash=null};b.setExtensions=function(a){for(var c=0;c<a.length;++c)k(a[c],{cert:b});b.extensions=a};b.getExtension=function(a){"string"===typeof a&&(a={name:a});for(var c=null,d,e=0;null===c&&e<b.extensions.length;++e)d=b.extensions[e],a.id&&d.id===a.id?c=d:a.name&&d.name===a.name&&(c=d);return c};
|
|
b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=v[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=e;b.tbsCertificate=h.getTBSCertificate(b);e=g.toDer(b.tbsCertificate);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(c){var d=!1;if(!b.issued(c)){var d=b.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
|
|
e.expectedIssuer=c.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=c.md;if(null===e){if(c.signatureOid in v)switch(v[c.signatureOid]){case "sha1WithRSAEncryption":e=a.md.sha1.create();break;case "md5WithRSAEncryption":e=a.md.md5.create();break;case "sha256WithRSAEncryption":e=a.md.sha256.create();break;case "sha512WithRSAEncryption":e=a.md.sha512.create();break;case "RSASSA-PSS":e=a.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
|
|
e.signatureOid=c.signatureOid,e;var k=c.tbsCertificate||h.getTBSCertificate(c),k=g.toDer(k);e.update(k.getBytes())}if(null!==e){var m;switch(c.signatureOid){case v.sha1WithRSAEncryption:m=void 0;break;case v["RSASSA-PSS"]:d=v[c.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=c.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;m=v[c.signatureParameters.mgf.algorithmOid];if(void 0===m||void 0===a.mgf[m])throw e=Error("Unsupported MGF function."),
|
|
e.oid=c.signatureParameters.mgf.algorithmOid,e.name=m,e;m=a.mgf[m].create(a.md[d].create());d=v[c.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===a.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:c.signatureParameters.hash.algorithmOid,name:d};m=a.pss.create(a.md[d].create(),m,c.signatureParameters.saltLength)}d=b.publicKey.verify(e.digest().getBytes(),c.signature,m)}return d};b.isIssuer=function(a){var c=!1,d=b.issuer;a=a.subject;if(d.hash&&a.hash)c=d.hash===a.hash;
|
|
else if(d.attributes.length===a.attributes.length)for(var c=!0,e,h,g=0;c&&g<d.attributes.length;++g)if(e=d.attributes[g],h=a.attributes[g],e.type!==h.type||e.value!==h.value)c=!1;return c};b.issued=function(a){return a.isIssuer(b)};b.generateSubjectKeyIdentifier=function(){return h.getPublicKeyFingerprint(b.publicKey,{type:"RSAPublicKey"})};b.verifySubjectKeyIdentifier=function(){for(var c=v.subjectKeyIdentifier,d=0;d<b.extensions.length;++d){var e=b.extensions[d];if(e.id===c)return c=b.generateSubjectKeyIdentifier().getBytes(),
|
|
a.util.hexToBytes(e.subjectKeyIdentifier)===c}return!1};return b};h.certificateFromAsn1=function(b,d){var k={},n=[];if(!g.validate(b,y,k,n))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=n,k;if("string"!==typeof k.certSignature){for(var n="\x00",z=0;z<k.certSignature.length;++z)n+=g.toDer(k.certSignature[z]).getBytes();k.certSignature=n}var n=g.derToOid(k.publicKeyOid),u=h.createCertificate();u.version=k.certVersion?k.certVersion.charCodeAt(0):
|
|
0;z=a.util.createBuffer(k.certSerialNumber);u.serialNumber=z.toHex();u.signatureOid=a.asn1.derToOid(k.certSignatureOid);u.signatureParameters=O(u.signatureOid,k.certSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.certinfoSignatureOid);u.siginfo.parameters=O(u.siginfo.algorithmOid,k.certinfoSignatureParams,!1);z=a.util.createBuffer(k.certSignature);++z.read;u.signature=z.getBytes();z=[];void 0!==k.certValidity1UTCTime&&z.push(g.utcTimeToDate(k.certValidity1UTCTime));void 0!==k.certValidity2GeneralizedTime&&
|
|
z.push(g.generalizedTimeToDate(k.certValidity2GeneralizedTime));void 0!==k.certValidity3UTCTime&&z.push(g.utcTimeToDate(k.certValidity3UTCTime));void 0!==k.certValidity4GeneralizedTime&&z.push(g.generalizedTimeToDate(k.certValidity4GeneralizedTime));if(2<z.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>z.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
|
|
u.validity.notBefore=z[0];u.validity.notAfter=z[1];u.tbsCertificate=k.tbsCertificate;if(d){u.md=null;if(u.signatureOid in v)switch(n=v[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===u.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
|
|
k.signatureOid=u.signatureOid,k;z=g.toDer(u.tbsCertificate);u.md.update(z.getBytes())}z=a.md.sha1.create();u.issuer.getField=function(a){return c(u.issuer,a)};u.issuer.addField=function(a){e([a]);u.issuer.attributes.push(a)};u.issuer.attributes=h.RDNAttributesAsArray(k.certIssuer,z);k.certIssuerUniqueId&&(u.issuer.uniqueId=k.certIssuerUniqueId);u.issuer.hash=z.digest().toHex();z=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};
|
|
u.subject.attributes=h.RDNAttributesAsArray(k.certSubject,z);k.certSubjectUniqueId&&(u.subject.uniqueId=k.certSubjectUniqueId);u.subject.hash=z.digest().toHex();u.extensions=k.certExtensions?h.certificateExtensionsFromAsn1(k.certExtensions):[];n===h.oids.rsaEncryption&&(u.publicKey=h.publicKeyFromAsn1(k.subjectPublicKeyInfo));return u};h.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(h.certificateExtensionFromAsn1(d.value[e]));
|
|
return b};h.certificateExtensionFromAsn1=function(b){var c={};c.id=g.derToOid(b.value[0].value);c.critical=!1;b.value[1].type===g.Type.BOOLEAN?(c.critical=0!==b.value[1].value.charCodeAt(0),c.value=b.value[2].value):c.value=b.value[1].value;if(c.id in v)if(c.name=v[c.id],"keyUsage"===c.name){b=g.fromDer(c.value);var d=0,e=0;1<b.value.length&&(d=b.value.charCodeAt(1),e=2<b.value.length?b.value.charCodeAt(2):0);c.digitalSignature=128===(d&128);c.nonRepudiation=64===(d&64);c.keyEncipherment=32===(d&
|
|
32);c.dataEncipherment=16===(d&16);c.keyAgreement=8===(d&8);c.keyCertSign=4===(d&4);c.cRLSign=2===(d&2);c.encipherOnly=1===(d&1);c.decipherOnly=128===(e&128)}else if("basicConstraints"===c.name)b=g.fromDer(c.value),c.cA=0<b.value.length&&b.value[0].type===g.Type.BOOLEAN?0!==b.value[0].value.charCodeAt(0):!1,d=null,0<b.value.length&&b.value[0].type===g.Type.INTEGER?d=b.value[0].value:1<b.value.length&&(d=b.value[1].value),null!==d&&(c.pathLenConstraint=g.derToInteger(d));else if("extKeyUsage"===c.name)for(b=
|
|
g.fromDer(c.value),d=0;d<b.value.length;++d)e=g.derToOid(b.value[d].value),e in v?c[v[e]]=!0:c[e]=!0;else if("nsCertType"===c.name)b=g.fromDer(c.value),d=0,1<b.value.length&&(d=b.value.charCodeAt(1)),c.client=128===(d&128),c.server=64===(d&64),c.email=32===(d&32),c.objsign=16===(d&16),c.reserved=8===(d&8),c.sslCA=4===(d&4),c.emailCA=2===(d&2),c.objCA=1===(d&1);else if("subjectAltName"===c.name||"issuerAltName"===c.name)for(c.altNames=[],b=g.fromDer(c.value),e=0;e<b.value.length;++e){var d=b.value[e],
|
|
h={type:d.type,value:d.value};c.altNames.push(h);switch(d.type){case 7:h.ip=a.util.bytesToIP(d.value);break;case 8:h.oid=g.derToOid(d.value)}}else"subjectKeyIdentifier"===c.name&&(b=g.fromDer(c.value),c.subjectKeyIdentifier=a.util.bytesToHex(b.value));return c};h.certificationRequestFromAsn1=function(b,d){var k={},n=[];if(!g.validate(b,z,k,n))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=n,k;if("string"!==typeof k.csrSignature){for(var n=
|
|
"\x00",p=0;p<k.csrSignature.length;++p)n+=g.toDer(k.csrSignature[p]).getBytes();k.csrSignature=n}n=g.derToOid(k.publicKeyOid);if(n!==h.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var u=h.createCertificationRequest();u.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;u.signatureOid=a.asn1.derToOid(k.csrSignatureOid);u.signatureParameters=O(u.signatureOid,k.csrSignatureParams,!0);u.siginfo.algorithmOid=a.asn1.derToOid(k.csrSignatureOid);u.siginfo.parameters=O(u.siginfo.algorithmOid,
|
|
k.csrSignatureParams,!1);n=a.util.createBuffer(k.csrSignature);++n.read;u.signature=n.getBytes();u.certificationRequestInfo=k.certificationRequestInfo;if(d){u.md=null;if(u.signatureOid in v)switch(n=v[u.signatureOid],n){case "sha1WithRSAEncryption":u.md=a.md.sha1.create();break;case "md5WithRSAEncryption":u.md=a.md.md5.create();break;case "sha256WithRSAEncryption":u.md=a.md.sha256.create();break;case "sha512WithRSAEncryption":u.md=a.md.sha512.create();break;case "RSASSA-PSS":u.md=a.md.sha256.create()}if(null===
|
|
u.md)throw k=Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=u.signatureOid,k;n=g.toDer(u.certificationRequestInfo);u.md.update(n.getBytes())}n=a.md.sha1.create();u.subject.getField=function(a){return c(u.subject,a)};u.subject.addField=function(a){e([a]);u.subject.attributes.push(a)};u.subject.attributes=h.RDNAttributesAsArray(k.certificationRequestInfoSubject,n);u.subject.hash=n.digest().toHex();u.publicKey=h.publicKeyFromAsn1(k.subjectPublicKeyInfo);
|
|
u.getAttribute=function(a){return c(u,a)};u.addAttribute=function(a){e([a]);u.attributes.push(a)};u.attributes=h.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return u};h.createCertificationRequest=function(){var b={version:0,signatureOid:null,signature:null,siginfo:{}};b.siginfo.algorithmOid=null;b.subject={};b.subject.getField=function(a){return c(b.subject,a)};b.subject.addField=function(a){e([a]);b.subject.attributes.push(a)};b.subject.attributes=[];b.subject.hash=null;b.publicKey=
|
|
null;b.attributes=[];b.getAttribute=function(a){return c(b,a)};b.addAttribute=function(a){e([a]);b.attributes.push(a)};b.md=null;b.setSubject=function(a){e(a);b.subject.attributes=a;b.subject.hash=null};b.setAttributes=function(a){e(a);b.attributes=a};b.sign=function(c,d){b.md=d||a.md.sha1.create();var e=v[b.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=b.md.algorithm,e;b.signatureOid=b.siginfo.algorithmOid=
|
|
e;b.certificationRequestInfo=h.getCertificationRequestInfo(b);e=g.toDer(b.certificationRequestInfo);b.md.update(e.getBytes());b.signature=c.sign(b.md)};b.verify=function(){var c=!1,d=b.md;if(null===d){if(b.signatureOid in v)switch(v[b.signatureOid]){case "sha1WithRSAEncryption":d=a.md.sha1.create();break;case "md5WithRSAEncryption":d=a.md.md5.create();break;case "sha256WithRSAEncryption":d=a.md.sha256.create();break;case "sha512WithRSAEncryption":d=a.md.sha512.create();break;case "RSASSA-PSS":d=a.md.sha256.create()}if(null===
|
|
d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=b.signatureOid,d;var e=b.certificationRequestInfo||h.getCertificationRequestInfo(b),e=g.toDer(e);d.update(e.getBytes())}if(null!==d){var k;switch(b.signatureOid){case v["RSASSA-PSS"]:c=v[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;k=v[b.signatureParameters.mgf.algorithmOid];
|
|
if(void 0===k||void 0===a.mgf[k])throw d=Error("Unsupported MGF function."),d.oid=b.signatureParameters.mgf.algorithmOid,d.name=k,d;k=a.mgf[k].create(a.md[c].create());c=v[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===a.md[c])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=b.signatureParameters.hash.algorithmOid,d.name=c,d;k=a.pss.create(a.md[c].create(),k,b.signatureParameters.saltLength)}c=b.publicKey.verify(d.digest().getBytes(),b.signature,k)}return c};return b};
|
|
h.getTBSCertificate=function(b){var c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(b.version).getBytes())]),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber)),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(b.siginfo.algorithmOid).getBytes()),p(b.siginfo.algorithmOid,b.siginfo.parameters)]),d(b.issuer),g.create(g.Class.UNIVERSAL,
|
|
g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notBefore)),g.create(g.Class.UNIVERSAL,g.Type.UTCTIME,!1,g.dateToUtcTime(b.validity.notAfter))]),d(b.subject),h.publicKeyToAsn1(b.publicKey)]);b.issuer.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+b.issuer.uniqueId)]));b.subject.uniqueId&&c.value.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
|
|
!1,String.fromCharCode(0)+b.subject.uniqueId)]));0<b.extensions.length&&c.value.push(h.certificateExtensionsToAsn1(b.extensions));return c};h.getCertificationRequestInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(a.version).getBytes()),d(a.subject),h.publicKeyToAsn1(a.publicKey),n(a)])};h.distinguishedNameToAsn1=function(a){return d(a)};h.certificateToAsn1=function(a){var b=a.tbsCertificate||h.getTBSCertificate(a);
|
|
return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};h.certificateExtensionsToAsn1=function(a){var b=g.create(g.Class.CONTEXT_SPECIFIC,3,!0,[]),c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(h.certificateExtensionToAsn1(a[d]));
|
|
return b};h.certificateExtensionToAsn1=function(a){var b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.id).getBytes()));a.critical&&b.value.push(g.create(g.Class.UNIVERSAL,g.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=g.toDer(c).getBytes());b.value.push(g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,c));return b};h.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||
|
|
h.getCertificationRequestInfo(a);return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[b,g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(a.signatureOid).getBytes()),p(a.signatureOid,a.signatureParameters)]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};h.createCaStore=function(b){function c(b){if(!b.hash){var g=a.md.sha1.create();b.attributes=h.RDNAttributesAsArray(d(b),g);b.hash=g.digest().toHex()}return e.certs[b.hash]||
|
|
null}var e={certs:{},getIssuer:function(a){return c(a.issuer)},addCertificate:function(b){"string"===typeof b&&(b=a.pki.certificateFromPem(b));if(!b.subject.hash){var c=a.md.sha1.create();b.subject.attributes=h.RDNAttributesAsArray(d(b.subject),c);b.subject.hash=c.digest().toHex()}b.subject.hash in e.certs?(c=e.certs[b.subject.hash],a.util.isArray(c)||(c=[c]),c.push(b)):e.certs[b.subject.hash]=b},hasCertificate:function(b){var d=c(b.subject);if(!d)return!1;a.util.isArray(d)||(d=[d]);b=g.toDer(h.certificateToAsn1(b)).getBytes();
|
|
for(var e=0;e<d.length;++e){var k=g.toDer(h.certificateToAsn1(d[e])).getBytes();if(b===k)return!0}return!1}};if(b)for(var k=0;k<b.length;++k)e.addCertificate(b[k]);return e};h.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
|
|
h.verifyCertificateChain=function(b,c,d){c=c.slice(0);var e=c.slice(0),g=new Date,k=!0,m=null,l=0;do{var n=c.shift(),z=null,p=!1;if(g<n.validity.notBefore||g>n.validity.notAfter)m={message:"Certificate is not valid yet or has expired.",error:h.certificateError.certificate_expired,notBefore:n.validity.notBefore,notAfter:n.validity.notAfter,now:g};if(null===m){z=c[0]||b.getIssuer(n);null===z&&n.isIssuer(n)&&(p=!0,z=n);if(z){var v=z;a.util.isArray(v)||(v=[v]);for(var r=!1;!r&&0<v.length;){z=v.shift();
|
|
try{r=z.verify(n)}catch(y){}}r||(m={message:"Certificate signature is invalid.",error:h.certificateError.bad_certificate})}null!==m||z&&!p||b.hasCertificate(n)||(m={message:"Certificate is not trusted.",error:h.certificateError.unknown_ca})}null===m&&z&&!n.isIssuer(z)&&(m={message:"Certificate issuer is invalid.",error:h.certificateError.bad_certificate});if(null===m)for(v={keyUsage:!0,basicConstraints:!0},r=0;null===m&&r<n.extensions.length;++r){var w=n.extensions[r];!w.critical||w.name in v||(m=
|
|
{message:"Certificate has an unsupported critical extension.",error:h.certificateError.unsupported_certificate})}null!==m||k&&(0!==c.length||z&&!p)||(k=n.getExtension("basicConstraints"),n=n.getExtension("keyUsage"),null!==n&&(n.keyCertSign&&null!==k||(m={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:h.certificateError.bad_certificate})),
|
|
null!==m||null===k||k.cA||(m={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:h.certificateError.bad_certificate}),null===m&&null!==n&&"pathLenConstraint"in k&&l-1>k.pathLenConstraint&&(m={message:"Certificate basicConstraints pathLenConstraint violated.",error:h.certificateError.bad_certificate}));n=null===m?!0:m.error;k=d?d(n,l,e):n;if(!0===k)m=null;else{!0===n&&(m={message:"The application rejected the certificate.",error:h.certificateError.bad_certificate});
|
|
if(k||0===k)"object"!==typeof k||a.util.isArray(k)?"string"===typeof k&&(m.error=k):(k.message&&(m.message=k.message),k.error&&(m.error=k.error));throw m;}k=!1;++l}while(0<c.length);return!0}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.x509)return c.x509;
|
|
c.defined.x509=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pki}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,d,e){for(var h=
|
|
[],g=0;g<a.length;g++)for(var k=0;k<a[g].safeBags.length;k++){var q=a[g].safeBags[k];if(void 0===e||q.type===e)null===b?h.push(q):void 0!==q.attributes[b]&&0<=q.attributes[b].indexOf(d)&&h.push(q)}return h}function d(b){if(b.composed||b.constructed){for(var c=a.util.createBuffer(),e=0;e<b.value.length;++e)c.putBytes(b.value[e].value);b.composed=b.constructed=!1;b.value=c.getBytes()}return b}function e(b,c,h,m){c=n.fromDer(c,h);if(c.tagClass!==n.Class.UNIVERSAL||c.type!==n.Type.SEQUENCE||!0!==c.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
|
|
for(var l=0;l<c.value.length;l++){var p={},r=[];if(!n.validate(c.value[l],v,p,r))throw b=Error("Cannot read ContentInfo."),b.errors=r,b;var r={encrypted:!1},u=null,u=p.content.value[0];switch(n.derToOid(p.contentType)){case g.oids.data:if(u.tagClass!==n.Class.UNIVERSAL||u.type!==n.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");u=d(u).value;break;case g.oids.encryptedData:var y=m,p={},C=[];if(!n.validate(u,a.pkcs7.asn1.encryptedDataValidator,p,C))throw b=Error("Cannot read EncryptedContentInfo."),
|
|
b.errors=C,b;u=n.derToOid(p.contentType);if(u!==g.oids.data)throw b=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),b.oid=u,b;u=n.derToOid(p.encAlgorithm);u=g.pbe.getCipher(u,p.encParameter,y);p=d(p.encryptedContentAsn1);p=a.util.createBuffer(p.value);u.update(p);if(!u.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");u=u.output.getBytes();r.encrypted=!0;break;default:throw b=Error("Unsupported PKCS#12 contentType."),b.contentType=n.derToOid(p.contentType),b;}r.safeBags=
|
|
k(u,h,m);b.safeContents.push(r)}}function k(a,b,c){if(!b&&0===a.length)return[];a=n.fromDer(a,b);if(a.tagClass!==n.Class.UNIVERSAL||a.type!==n.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var h={},q=[];if(!n.validate(a.value[e],D,h,q))throw a=Error("Cannot read SafeBag."),a.errors=q,a;var m={type:n.derToOid(h.bagId),attributes:p(h.bagAttributes)};d.push(m);var l,v,r=h.bagValue.value[0];switch(m.type){case g.oids.pkcs8ShroudedKeyBag:if(r=
|
|
g.decryptPrivateKeyInfo(r,c),null===r)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{m.key=g.privateKeyFromAsn1(r)}catch(y){m.key=null,m.asn1=r}continue;case g.oids.certBag:l=C;v=function(){if(n.derToOid(h.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=n.derToOid(h.certId);throw a;}a=n.fromDer(h.cert,b);try{m.cert=g.certificateFromAsn1(a,!0)}catch(c){m.cert=null,m.asn1=a}};break;default:throw a=
|
|
Error("Unsupported PKCS#12 SafeBag type."),a.oid=m.type,a;}if(void 0!==l&&!n.validate(r,l,h,q))throw a=Error("Cannot read PKCS#12 "+l.name),a.errors=q,a;v()}return d}function p(a){var b={};if(void 0!==a)for(var c=0;c<a.length;++c){var d={},e=[];if(!n.validate(a[c],y,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=n.derToOid(d.oid);if(void 0!==g.oids[e]){b[g.oids[e]]=[];for(var h=0;h<d.values.length;++h)b[g.oids[e]].push(d.values[h].value)}}return b}var n=a.asn1,g=a.pki,h=a.pkcs12=
|
|
a.pkcs12||{},v={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},r={name:"PFX",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},
|
|
v,{name:"PFX.macData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
|
|
tagClass:n.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},D={name:"SafeBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"SafeBag.bagId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},y={name:"Attribute",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,
|
|
capture:"oid"},{name:"Attribute.attrValues",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,capture:"values"}]},C={name:"CertBag",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:n.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:n.Class.UNIVERSAL,type:n.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
|
|
h.pkcs12FromAsn1=function(b,k,p){"string"===typeof k?(p=k,k=!0):void 0===k&&(k=!0);var v={};if(!n.validate(b,r,v,[]))throw k=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),k.errors=k,k;var y={version:v.version.charCodeAt(0),safeContents:[],getBags:function(b){var d={},e;"localKeyId"in b?e=b.localKeyId:"localKeyIdHex"in b&&(e=a.util.hexToBytes(b.localKeyIdHex));void 0===e&&!("friendlyName"in b)&&"bagType"in b&&(d[b.bagType]=c(y.safeContents,null,null,b.bagType));void 0!==e&&
|
|
(d.localKeyId=c(y.safeContents,"localKeyId",e,b.bagType));"friendlyName"in b&&(d.friendlyName=c(y.safeContents,"friendlyName",b.friendlyName,b.bagType));return d},getBagsByFriendlyName:function(a,b){return c(y.safeContents,"friendlyName",a,b)},getBagsByLocalKeyId:function(a,b){return c(y.safeContents,"localKeyId",a,b)}};if(3!==v.version.charCodeAt(0))throw k=Error("PKCS#12 PFX of version other than 3 not supported."),k.version=v.version.charCodeAt(0),k;if(n.derToOid(v.contentType)!==g.oids.data)throw k=
|
|
Error("Only PKCS#12 PFX in password integrity mode supported."),k.oid=n.derToOid(v.contentType),k;b=v.content.value[0];if(b.tagClass!==n.Class.UNIVERSAL||b.type!==n.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");b=d(b);if(v.mac){var x=null,C=0,u=n.derToOid(v.macAlgorithm);switch(u){case g.oids.sha1:x=a.md.sha1.create();C=20;break;case g.oids.sha256:x=a.md.sha256.create();C=32;break;case g.oids.sha384:x=a.md.sha384.create();C=48;break;case g.oids.sha512:x=a.md.sha512.create();
|
|
C=64;break;case g.oids.md5:x=a.md.md5.create(),C=16}if(null===x)throw Error("PKCS#12 uses unsupported MAC algorithm: "+u);var u=new a.util.ByteBuffer(v.macSalt),D="macIterations"in v?parseInt(a.util.bytesToHex(v.macIterations),16):1,C=h.generateKey(p,u,3,D,C,x),u=a.hmac.create();u.start(x,C);u.update(b.value);if(u.getMac().getBytes()!==v.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(y,b.value,k,p);return y};h.toPkcs12Asn1=function(b,c,d,e){e=e||{};e.saltSize=e.saltSize||
|
|
8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var k=e.localKeyId,m;if(null!==k)k=a.util.hexToBytes(k);else if(e.generateLocalKeyId)if(c){var l=a.util.isArray(c)?c[0]:c;"string"===typeof l&&(l=g.certificateFromPem(l));k=a.md.sha1.create();k.update(n.toDer(g.certificateToAsn1(l)).getBytes());k=k.digest().getBytes()}else k=a.random.getBytes(20);l=[];null!==
|
|
k&&l.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.localKeyId).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,k)])]));"friendlyName"in e&&l.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.friendlyName).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[n.create(n.Class.UNIVERSAL,n.Type.BMPSTRING,!1,e.friendlyName)])]));
|
|
0<l.length&&(m=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,l));k=[];l=[];null!==c&&(l=a.util.isArray(c)?c:[c]);for(var p=[],v=0;v<l.length;++v){c=l[v];"string"===typeof c&&(c=g.certificateFromPem(c));var r=0===v?m:void 0;c=g.certificateToAsn1(c);c=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.certBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.x509Certificate).getBytes()),
|
|
n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(c).getBytes())])])]),r]);p.push(c)}0<p.length&&(c=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,p),c=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(c).getBytes())])]),k.push(c));c=null;null!==b&&(b=g.wrapRsaPrivateKey(g.privateKeyToAsn1(b)),
|
|
c=null===d?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[b]),m]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[g.encryptPrivateKeyInfo(b,d,e)]),m]),b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[c]),b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,
|
|
[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(b).getBytes())])]),k.push(b));m=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,k);var y;e.useMac&&(k=a.md.sha1.create(),y=new a.util.ByteBuffer(a.random.getBytes(e.saltSize)),e=e.count,b=h.generateKey(d,y,3,e,20),d=a.hmac.create(),d.start(k,b),d.update(n.toDer(m).getBytes()),d=d.getMac(),y=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,
|
|
!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,d.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,y.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e).getBytes())]));return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,
|
|
n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(g.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(m).getBytes())])]),y])};h.generateKey=a.pbe.generatePkcs12Key}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,
|
|
p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs12)return c.pkcs12;c.defined.pkcs12=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pkcs12}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
|
|
function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=a.asn1,d=a.pki=a.pki||{};d.pemToDer=function(b){b=a.pem.decode(b)[0];if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(b.body)};d.privateKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PRIVATE KEY"!==b.type&&"RSA PRIVATE KEY"!==b.type){var e=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
|
|
e.headerType=b.type;throw e;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");b=c.fromDer(b.body);return d.privateKeyFromAsn1(b)};d.privateKeyToPem=function(b,e){var k={type:"RSA PRIVATE KEY",body:c.toDer(d.privateKeyToAsn1(b)).getBytes()};return a.pem.encode(k,{maxline:e})};d.privateKeyInfoToPem=function(b,d){var e={type:"PRIVATE KEY",body:c.toDer(b).getBytes()};return a.pem.encode(e,{maxline:d})}}if("function"!==typeof a)if("object"===
|
|
typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pki)return c.pki;c.defined.pki=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pki}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};a("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c=function(b,c,d,e){var h=a.util.createBuffer(),g=b.length>>1,k=g+(b.length&1),m=b.substr(0,k),k=b.substr(g,k);b=a.util.createBuffer();g=a.hmac.create();d=c+d;var l=Math.ceil(e/16);c=Math.ceil(e/20);g.start("MD5",m);m=a.util.createBuffer();b.putBytes(d);
|
|
for(var n=0;n<l;++n)g.start(null,null),g.update(b.getBytes()),b.putBuffer(g.digest()),g.start(null,null),g.update(b.bytes()+d),m.putBuffer(g.digest());g.start("SHA1",k);k=a.util.createBuffer();b.clear();b.putBytes(d);for(n=0;n<c;++n)g.start(null,null),g.update(b.getBytes()),b.putBuffer(g.digest()),g.start(null,null),g.update(b.bytes()+d),k.putBuffer(g.digest());h.putBytes(a.util.xorBytes(m.getBytes(),k.getBytes(),e));return h},d=function(b,c,d){d=!1;try{var e=b.deflate(c.fragment.getBytes());c.fragment=
|
|
a.util.createBuffer(e);c.length=e.length;d=!0}catch(h){}return d},e=function(b,c,d){d=!1;try{var e=b.inflate(c.fragment.getBytes());c.fragment=a.util.createBuffer(e);c.length=e.length;d=!0}catch(h){}return d},k=function(b,c){var d=0;switch(c){case 1:d=b.getByte();break;case 2:d=b.getInt16();break;case 3:d=b.getInt24();break;case 4:d=b.getInt32()}return a.util.createBuffer(b.getBytes(d))},p=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},n={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
|
|
minor:2},TLS_1_2:{major:3,minor:3}}};n.SupportedVersions=[n.Versions.TLS_1_1,n.Versions.TLS_1_0];n.Version=n.SupportedVersions[0];n.MaxFragment=15360;n.ConnectionEnd={server:0,client:1};n.PRFAlgorithm={tls_prf_sha256:0};n.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};n.CipherType={stream:0,block:1,aead:2};n.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};n.CompressionMethod={none:0,deflate:1};n.ContentType={change_cipher_spec:20,alert:21,handshake:22,
|
|
application_data:23,heartbeat:24};n.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};n.Alert={};n.Alert.Level={warning:1,fatal:2};n.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,
|
|
certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};n.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};n.CipherSuites={};n.getCipherSuite=function(a){var b=null,c;for(c in n.CipherSuites){var d=n.CipherSuites[c];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){b=d;break}}return b};
|
|
n.handleUnexpected=function(a,b){(a.open||a.entity!==n.ConnectionEnd.client)&&a.error(a,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unexpected_message}})};n.handleHelloRequest=function(a,b,c){!a.handshaking&&0<a.handshakes&&(n.queue(a,n.createAlert(a,{level:n.Alert.Level.warning,description:n.Alert.Description.no_renegotiation})),n.flush(a));a.process()};n.parseHelloMessage=function(b,c,d){var e=null,h=b.entity===
|
|
n.ConnectionEnd.client;if(38>d)b.error(b,{message:h?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});else{c=c.fragment;var g=c.length(),e={version:{major:c.getByte(),minor:c.getByte()},random:a.util.createBuffer(c.getBytes(32)),session_id:k(c,1),extensions:[]};h?(e.cipher_suite=c.getBytes(2),e.compression_method=c.getByte()):(e.cipher_suites=k(c,2),e.compression_methods=
|
|
k(c,1));g=d-(g-c.length());if(0<g){for(d=k(c,2);0<d.length();)e.extensions.push({type:[d.getByte(),d.getByte()],data:k(d,2)});if(!h)for(d=0;d<e.extensions.length;++d)if(c=e.extensions[d],0===c.type[0]&&0===c.type[1])for(c=k(c.data,2);0<c.length()&&0===c.getByte();)b.session.extensions.server_name.serverNameList.push(k(c,2).getBytes())}if(b.session.version&&(e.version.major!==b.session.version.major||e.version.minor!==b.session.version.minor))return b.error(b,{message:"TLS version change is disallowed during renegotiation.",
|
|
send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}});if(h)b.session.cipherSuite=n.getCipherSuite(e.cipher_suite);else for(d=a.util.createBuffer(e.cipher_suites.bytes());0<d.length()&&(b.session.cipherSuite=n.getCipherSuite(d.getBytes(2)),null===b.session.cipherSuite););if(null===b.session.cipherSuite)return b.error(b,{message:"No cipher suites in common.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(e.cipher_suite)});
|
|
b.session.compressionMethod=h?e.compression_method:n.CompressionMethod.none}return e};n.createSecurityParameters=function(a,b){var c=a.entity===n.ConnectionEnd.client,d=b.random.bytes(),e=c?a.session.sp.client_random:d,c=c?d:n.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:n.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
|
|
compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:c}};n.handleServerHello=function(a,b,c){b=n.parseHelloMessage(a,b,c);if(!a.fail){if(b.version.minor<=a.version.minor)a.version.minor=b.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}});a.session.version=a.version;c=b.session_id.bytes();0<c.length&&c===a.session.id?
|
|
(a.expect=D,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=g,a.session.resuming=!1,n.createSecurityParameters(a,b));a.session.id=c;a.process()}};n.handleClientHello=function(b,c,d){c=n.parseHelloMessage(b,c,d);if(!b.fail){var e=c.session_id.bytes();d=null;if(b.sessionCache)if(d=b.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==c.version.major||d.version.minor>c.version.minor)d=null,e="";0===e.length&&(e=a.random.getBytes(32));b.session.id=e;b.session.clientHelloVersion=
|
|
c.version;b.session.sp={};if(d)b.version=b.session.version=d.version,b.session.sp=d.sp;else{for(var h,e=1;e<n.SupportedVersions.length&&!(h=n.SupportedVersions[e],h.minor<=c.version.minor);++e);b.version={major:h.major,minor:h.minor};b.session.version=b.version}null!==d?(b.expect=H,b.session.resuming=!0,b.session.sp.client_random=c.random.bytes()):(b.expect=!1!==b.verifyClient?O:A,b.session.resuming=!1,n.createSecurityParameters(b,c));b.open=!0;n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,
|
|
data:n.createServerHello(b)}));b.session.resuming?(n.queue(b,n.createRecord(b,{type:n.ContentType.change_cipher_spec,data:n.createChangeCipherSpec()})),b.state.pending=n.createConnectionState(b),b.state.current.write=b.state.pending.write,n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createFinished(b)}))):(n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createCertificate(b)})),b.fail||(n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createServerKeyExchange(b)})),
|
|
!1!==b.verifyClient&&n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createCertificateRequest(b)})),n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createServerHelloDone(b)}))));n.flush(b);b.process()}};n.handleCertificate=function(b,c,d){if(3>d)return b.error(b,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});d=k(c.fragment,3);var e,g;c=[];try{for(;0<d.length();)e=
|
|
k(d,3),g=a.asn1.fromDer(e),e=a.pki.certificateFromAsn1(g,!0),c.push(e)}catch(m){return b.error(b,{message:"Could not parse certificate list.",cause:m,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate}})}e=b.entity===n.ConnectionEnd.client;!e&&!0!==b.verifyClient||0!==c.length?0===c.length?b.expect=e?h:A:(e?b.session.serverCertificate=c[0]:b.session.clientCertificate=c[0],n.verifyCertificateChain(b,c)&&(b.expect=e?h:A)):b.error(b,{message:e?"No server certificate provided.":
|
|
"No client certificate provided.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});b.process()};n.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unsupported_certificate}});a.expect=v;a.process()};n.handleClientKeyExchange=function(b,c,d){if(48>d)return b.error(b,{message:"Invalid key parameters. Only RSA is supported.",
|
|
send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unsupported_certificate}});c=k(c.fragment,2).getBytes();d=null;if(b.getPrivateKey)try{d=b.getPrivateKey(b,b.session.serverCertificate),d=a.pki.privateKeyFromPem(d)}catch(e){b.error(b,{message:"Could not get private key.",cause:e,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}})}if(null===d)return b.error(b,{message:"No private key set.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}});
|
|
try{var h=b.session.sp;h.pre_master_secret=d.decrypt(c);var g=b.session.clientHelloVersion;if(g.major!==h.pre_master_secret.charCodeAt(0)||g.minor!==h.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){h.pre_master_secret=a.random.getBytes(48)}b.expect=H;null!==b.session.clientCertificate&&(b.expect=F);b.process()};n.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,
|
|
description:n.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:k(b,1),certificate_authorities:k(b,2)};a.session.certificateRequest=b;a.expect=r;a.process()};n.handleCertificateVerify=function(b,c,d){if(2>d)return b.error(b,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});d=c.fragment;d.read-=4;c=d.bytes();d.read+=4;d=k(d,2).getBytes();var e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
|
|
e.putBuffer(b.session.sha1.digest());e=e.getBytes();try{if(!b.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");b.session.md5.update(c);b.session.sha1.update(c)}catch(h){return b.error(b,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.handshake_failure}})}b.expect=H;b.process()};n.handleServerHelloDone=function(b,c,d){if(0<d)return b.error(b,{message:"Invalid ServerHelloDone message. Invalid length.",
|
|
send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.record_overflow}});if(null===b.serverCertificate&&(c={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.insufficient_security}},d=b.verify(b,c.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||a.util.isArray(d)?"number"===typeof d&&(c.alert.description=d):(d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert));
|
|
return b.error(b,c)}null!==b.session.certificateRequest&&(c=n.createRecord(b,{type:n.ContentType.handshake,data:n.createCertificate(b)}),n.queue(b,c));c=n.createRecord(b,{type:n.ContentType.handshake,data:n.createClientKeyExchange(b)});n.queue(b,c);b.expect=z;c=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&n.queue(a,n.createRecord(a,{type:n.ContentType.handshake,data:n.createCertificateVerify(a,b)}));n.queue(a,n.createRecord(a,{type:n.ContentType.change_cipher_spec,
|
|
data:n.createChangeCipherSpec()}));a.state.pending=n.createConnectionState(a);a.state.current.write=a.state.pending.write;n.queue(a,n.createRecord(a,{type:n.ContentType.handshake,data:n.createFinished(a)}));a.expect=D;n.flush(a);a.process()};if(null===b.session.certificateRequest||null===b.session.clientCertificate)return c(b,null);n.getClientSignature(b,c)};n.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
|
|
alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.illegal_parameter}});var c=a.entity===n.ConnectionEnd.client;if(a.session.resuming&&c||!a.session.resuming&&!c)a.state.pending=n.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&c||a.session.resuming&&!c)a.state.pending=null;a.expect=c?y:M;a.process()};n.handleFinished=function(b,d,e){e=d.fragment;e.read-=4;var h=e.bytes();e.read+=4;d=d.fragment.getBytes();e=a.util.createBuffer();e.putBuffer(b.session.md5.digest());
|
|
e.putBuffer(b.session.sha1.digest());var g=b.entity===n.ConnectionEnd.client;e=c(b.session.sp.master_secret,g?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return b.error(b,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.decrypt_error}});b.session.md5.update(h);b.session.sha1.update(h);if(b.session.resuming&&g||!b.session.resuming&&!g)n.queue(b,n.createRecord(b,{type:n.ContentType.change_cipher_spec,
|
|
data:n.createChangeCipherSpec()})),b.state.current.write=b.state.pending.write,b.state.pending=null,n.queue(b,n.createRecord(b,{type:n.ContentType.handshake,data:n.createFinished(b)}));b.expect=g?C:G;b.handshaking=!1;++b.handshakes;b.peerCertificate=g?b.session.serverCertificate:b.session.clientCertificate;n.flush(b);b.isConnected=!0;b.connected(b);b.process()};n.handleAlert=function(a,b){var c=b.fragment,c={level:c.getByte(),description:c.getByte()},d;switch(c.description){case n.Alert.Description.close_notify:d=
|
|
"Connection closed.";break;case n.Alert.Description.unexpected_message:d="Unexpected message.";break;case n.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case n.Alert.Description.decryption_failed:d="Decryption failed.";break;case n.Alert.Description.record_overflow:d="Record overflow.";break;case n.Alert.Description.decompression_failure:d="Decompression failed.";break;case n.Alert.Description.handshake_failure:d="Handshake failure.";break;case n.Alert.Description.bad_certificate:d=
|
|
"Bad certificate.";break;case n.Alert.Description.unsupported_certificate:d="Unsupported certificate.";break;case n.Alert.Description.certificate_revoked:d="Certificate revoked.";break;case n.Alert.Description.certificate_expired:d="Certificate expired.";break;case n.Alert.Description.certificate_unknown:d="Certificate unknown.";break;case n.Alert.Description.illegal_parameter:d="Illegal parameter.";break;case n.Alert.Description.unknown_ca:d="Unknown certificate authority.";break;case n.Alert.Description.access_denied:d=
|
|
"Access denied.";break;case n.Alert.Description.decode_error:d="Decode error.";break;case n.Alert.Description.decrypt_error:d="Decrypt error.";break;case n.Alert.Description.export_restriction:d="Export restriction.";break;case n.Alert.Description.protocol_version:d="Unsupported protocol version.";break;case n.Alert.Description.insufficient_security:d="Insufficient security.";break;case n.Alert.Description.internal_error:d="Internal error.";break;case n.Alert.Description.user_canceled:d="User canceled.";
|
|
break;case n.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(c.description===n.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===n.ConnectionEnd.client?"server":"client",alert:c});a.process()};n.handleHandshake=function(b,c){var d=c.fragment,e=d.getByte(),h=d.getInt24();if(h>d.length())return b.fragmented=c,c.fragment=a.util.createBuffer(),d.read-=4,b.process();b.fragmented=null;d.read-=4;var g=d.bytes(h+
|
|
4);d.read+=4;e in K[b.entity][b.expect]?(b.entity!==n.ConnectionEnd.server||b.open||b.fail||(b.handshaking=!0,b.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),e!==n.HandshakeType.hello_request&&e!==n.HandshakeType.certificate_verify&&e!==n.HandshakeType.finished&&(b.session.md5.update(g),b.session.sha1.update(g)),K[b.entity][b.expect][e](b,c,h)):
|
|
n.handleUnexpected(b,c)};n.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};n.handleHeartbeat=function(b,c){var d=c.fragment,e=d.getByte(),h=d.getInt16(),d=d.getBytes(h);if(e===n.HeartbeatMessageType.heartbeat_request){if(b.handshaking||h>d.length)return b.process();n.queue(b,n.createRecord(b,{type:n.ContentType.heartbeat,data:n.createHeartbeat(n.HeartbeatMessageType.heartbeat_response,d)}));n.flush(b)}else if(e===n.HeartbeatMessageType.heartbeat_response){if(d!==
|
|
b.expectedHeartbeatPayload)return b.process();b.heartbeatReceived&&b.heartbeatReceived(b,a.util.createBuffer(d))}b.process()};var g=1,h=2,v=3,r=4,D=5,y=6,C=7,z=8,O=1,A=2,F=3,H=4,M=5,G=6,u=n.handleUnexpected,R=n.handleChangeCipherSpec,S=n.handleAlert,P=n.handleHandshake,Z=n.handleApplicationData,L=n.handleHeartbeat,W=[];W[n.ConnectionEnd.client]=[[u,S,P,u,L],[u,S,P,u,L],[u,S,P,u,L],[u,S,P,u,L],[u,S,P,u,L],[R,S,u,u,L],[u,S,P,u,L],[u,S,P,Z,L],[u,S,P,u,L]];W[n.ConnectionEnd.server]=[[u,S,P,u,L],[u,S,
|
|
P,u,L],[u,S,P,u,L],[u,S,P,u,L],[R,S,u,u,L],[u,S,P,u,L],[u,S,P,Z,L],[u,S,P,u,L]];var R=n.handleHelloRequest,S=n.handleCertificate,P=n.handleServerKeyExchange,Z=n.handleCertificateRequest,L=n.handleServerHelloDone,V=n.handleFinished,K=[];K[n.ConnectionEnd.client]=[[u,u,n.handleServerHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,S,P,Z,L,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,u,P,Z,L,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,u,u,Z,L,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,u,u,u,L,u,u,u,u,u,u],
|
|
[R,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[R,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[R,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];K[n.ConnectionEnd.server]=[[u,n.handleClientHello,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,S,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,n.handleClientKeyExchange,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,n.handleCertificateVerify,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,
|
|
u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,V],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u],[u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u,u]];n.generateKeys=function(a,b){var d=b.client_random+b.server_random;a.session.resuming||(b.master_secret=c(b.pre_master_secret,"master secret",d,48).bytes(),b.pre_master_secret=null);var d=b.server_random+b.client_random,e=2*b.mac_key_length+2*b.enc_key_length,h=a.version.major===n.Versions.TLS_1_0.major&&a.version.minor===n.Versions.TLS_1_0.minor;h&&(e+=2*b.fixed_iv_length);d=
|
|
c(b.master_secret,"key expansion",d,e);e={client_write_MAC_key:d.getBytes(b.mac_key_length),server_write_MAC_key:d.getBytes(b.mac_key_length),client_write_key:d.getBytes(b.enc_key_length),server_write_key:d.getBytes(b.enc_key_length)};h&&(e.client_write_IV=d.getBytes(b.fixed_iv_length),e.server_write_IV=d.getBytes(b.fixed_iv_length));return e};n.createConnectionState=function(a){var b=a.entity===n.ConnectionEnd.client,c=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
|
|
cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},h={read:c(),write:c()};h.read.update=function(a,b){h.read.cipherFunction(b,h.read)?h.read.compressFunction(a,b,h.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.decompression_failure}}):
|
|
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_record_mac}});return!a.fail};h.write.update=function(a,b){h.write.compressFunction(a,b,h.write)?h.write.cipherFunction(b,h.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}});
|
|
return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=n.generateKeys(a,c),h.read.macKey=b?c.keys.server_write_MAC_key:c.keys.client_write_MAC_key,h.write.macKey=b?c.keys.client_write_MAC_key:c.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(h,a,c),c.compression_algorithm){case n.CompressionMethod.none:break;case n.CompressionMethod.deflate:h.read.compressFunction=e;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
|
|
}return h};n.createRandom=function(){var b=new Date,b=+b+6E4*b.getTimezoneOffset(),c=a.util.createBuffer();c.putInt32(b);c.putBytes(a.random.getBytes(28));return c};n.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};n.createAlert=function(b,c){var d=a.util.createBuffer();d.putByte(c.level);d.putByte(c.description);return n.createRecord(b,{type:n.ContentType.alert,data:d})};n.createClientHello=
|
|
function(b){b.session.clientHelloVersion={major:b.version.major,minor:b.version.minor};for(var c=a.util.createBuffer(),d=0;d<b.cipherSuites.length;++d){var e=b.cipherSuites[d];c.putByte(e.id[0]);c.putByte(e.id[1])}var h=c.length(),d=a.util.createBuffer();d.putByte(n.CompressionMethod.none);var g=d.length(),e=a.util.createBuffer();if(b.virtualHost){var k=a.util.createBuffer();k.putByte(0);k.putByte(0);var m=a.util.createBuffer();m.putByte(0);p(m,2,a.util.createBuffer(b.virtualHost));var l=a.util.createBuffer();
|
|
p(l,2,m);p(k,2,l);e.putBuffer(k)}k=e.length();0<k&&(k+=2);m=b.session.id;h=m.length+1+2+4+28+2+h+1+g+k;g=a.util.createBuffer();g.putByte(n.HandshakeType.client_hello);g.putInt24(h);g.putByte(b.version.major);g.putByte(b.version.minor);g.putBytes(b.session.sp.client_random);p(g,1,a.util.createBuffer(m));p(g,2,c);p(g,1,d);0<k&&p(g,2,e);return g};n.createServerHello=function(b){var c=b.session.id,d=c.length+1+2+4+28+2+1,e=a.util.createBuffer();e.putByte(n.HandshakeType.server_hello);e.putInt24(d);e.putByte(b.version.major);
|
|
e.putByte(b.version.minor);e.putBytes(b.session.sp.server_random);p(e,1,a.util.createBuffer(c));e.putByte(b.session.cipherSuite.id[0]);e.putByte(b.session.cipherSuite.id[1]);e.putByte(b.session.compressionMethod);return e};n.createCertificate=function(b){var c=b.entity===n.ConnectionEnd.client,d=null;b.getCertificate&&(d=b.getCertificate(b,c?b.session.certificateRequest:b.session.extensions.server_name.serverNameList));var e=a.util.createBuffer();if(null!==d)try{a.util.isArray(d)||(d=[d]);for(var h=
|
|
null,g=0;g<d.length;++g){var k=a.pem.decode(d[g])[0];if("CERTIFICATE"!==k.type&&"X509 CERTIFICATE"!==k.type&&"TRUSTED CERTIFICATE"!==k.type){var m=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');m.headerType=k.type;throw m;}if(k.procType&&"ENCRYPTED"===k.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var l=a.util.createBuffer(k.body);null===h&&(h=a.asn1.fromDer(l.bytes(),!1));
|
|
var z=a.util.createBuffer();p(z,3,l);e.putBuffer(z)}d=a.pki.certificateFromAsn1(h);c?b.session.clientCertificate=d:b.session.serverCertificate=d}catch(u){return b.error(b,{message:"Could not send certificate list.",cause:u,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate}})}b=3+e.length();c=a.util.createBuffer();c.putByte(n.HandshakeType.certificate);c.putInt24(b);p(c,3,e);return c};n.createClientKeyExchange=function(b){var c=a.util.createBuffer();c.putByte(b.session.clientHelloVersion.major);
|
|
c.putByte(b.session.clientHelloVersion.minor);c.putBytes(a.random.getBytes(46));var d=b.session.sp;d.pre_master_secret=c.getBytes();c=b.session.serverCertificate.publicKey.encrypt(d.pre_master_secret);b=c.length+2;d=a.util.createBuffer();d.putByte(n.HandshakeType.client_key_exchange);d.putInt24(b);d.putInt16(c.length);d.putBytes(c);return d};n.createServerKeyExchange=function(b){return a.util.createBuffer()};n.getClientSignature=function(b,c){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());
|
|
d.putBuffer(b.session.sha1.digest());d=d.getBytes();b.getSignature=b.getSignature||function(b,c,d){var e=null;if(b.getPrivateKey)try{e=b.getPrivateKey(b,b.session.clientCertificate),e=a.pki.privateKeyFromPem(e)}catch(h){b.error(b,{message:"Could not get private key.",cause:h,send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}})}null===e?b.error(b,{message:"No private key set.",send:!0,alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.internal_error}}):
|
|
c=e.sign(c,null);d(b,c)};b.getSignature(b,d,c)};n.createCertificateVerify=function(b,c){var d=c.length+2,e=a.util.createBuffer();e.putByte(n.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(c.length);e.putBytes(c);return e};n.createCertificateRequest=function(b){var c=a.util.createBuffer();c.putByte(1);var d=a.util.createBuffer(),e;for(e in b.caStore.certs){var h=a.pki.distinguishedNameToAsn1(b.caStore.certs[e].subject);d.putBuffer(a.asn1.toDer(h))}b=1+c.length()+2+d.length();e=a.util.createBuffer();
|
|
e.putByte(n.HandshakeType.certificate_request);e.putInt24(b);p(e,1,c);p(e,2,d);return e};n.createServerHelloDone=function(b){b=a.util.createBuffer();b.putByte(n.HandshakeType.server_hello_done);b.putInt24(0);return b};n.createChangeCipherSpec=function(){var b=a.util.createBuffer();b.putByte(1);return b};n.createFinished=function(b){var d=a.util.createBuffer();d.putBuffer(b.session.md5.digest());d.putBuffer(b.session.sha1.digest());d=c(b.session.sp.master_secret,b.entity===n.ConnectionEnd.client?"client finished":
|
|
"server finished",d.getBytes(),12);b=a.util.createBuffer();b.putByte(n.HandshakeType.finished);b.putInt24(d.length());b.putBuffer(d);return b};n.createHeartbeat=function(b,c,d){"undefined"===typeof d&&(d=c.length);var e=a.util.createBuffer();e.putByte(b);e.putInt16(d);e.putBytes(c);b=e.length();e.putBytes(a.random.getBytes(Math.max(16,b-d-3)));return e};n.queue=function(b,c){if(c){if(c.type===n.ContentType.handshake){var d=c.fragment.bytes();b.session.md5.update(d);b.session.sha1.update(d)}if(c.fragment.length()<=
|
|
n.MaxFragment)d=[c];else{for(var d=[],e=c.fragment.bytes();e.length>n.MaxFragment;)d.push(n.createRecord(b,{type:c.type,data:a.util.createBuffer(e.slice(0,n.MaxFragment))})),e=e.slice(n.MaxFragment);0<e.length&&d.push(n.createRecord(b,{type:c.type,data:a.util.createBuffer(e)}))}for(e=0;e<d.length&&!b.fail;++e){var h=d[e];b.state.current.write.update(b,h)&&b.records.push(h)}}};n.flush=function(a){for(var b=0;b<a.records.length;++b){var c=a.records[b];a.tlsData.putByte(c.type);a.tlsData.putByte(c.version.major);
|
|
a.tlsData.putByte(c.version.minor);a.tlsData.putInt16(c.fragment.length());a.tlsData.putBuffer(a.records[b].fragment)}a.records=[];return a.tlsDataReady(a)};var ba=function(b){switch(b){case !0:return!0;case a.pki.certificateError.bad_certificate:return n.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return n.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return n.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return n.Alert.Description.certificate_expired;
|
|
case a.pki.certificateError.certificate_unknown:return n.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return n.Alert.Description.unknown_ca;default:return n.Alert.Description.bad_certificate}},ca=function(b){switch(b){case !0:return!0;case n.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case n.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case n.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;
|
|
case n.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case n.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case n.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};n.verifyCertificateChain=function(b,c){try{a.pki.verifyCertificateChain(b.caStore,c,function(c,d,e){ba(c);d=b.verify(b,c,d,e);if(!0!==d){if("object"===typeof d&&!a.util.isArray(d))throw c=
|
|
Error("The application rejected the certificate."),c.send=!0,c.alert={level:n.Alert.Level.fatal,description:n.Alert.Description.bad_certificate},d.message&&(c.message=d.message),d.alert&&(c.alert.description=d.alert),c;d!==c&&(d=ca(d))}return d})}catch(d){var e=d;if("object"!==typeof e||a.util.isArray(e))e={send:!0,alert:{level:n.Alert.Level.fatal,description:ba(d)}};"send"in e||(e.send=!0);"alert"in e||(e.alert={level:n.Alert.Level.fatal,description:ba(e.error)});b.error(b,e)}return!b.fail};n.createSessionCache=
|
|
function(b,c){var d=null;if(b&&b.getSession&&b.setSession&&b.order)d=b;else{d={};d.cache=b||{};d.capacity=Math.max(c||100,1);d.order=[];for(var e in b)d.order.length<=c?d.order.push(e):delete b[e];d.getSession=function(b){var c=null,e=null;b?e=a.util.bytesToHex(b):0<d.order.length&&(e=d.order[0]);if(null!==e&&e in d.cache){c=d.cache[e];delete d.cache[e];for(var h in d.order)if(d.order[h]===e){d.order.splice(h,1);break}}return c};d.setSession=function(b,c){if(d.order.length===d.capacity){var e=d.order.shift();
|
|
delete d.cache[e]}e=a.util.bytesToHex(b);d.order.push(e);d.cache[e]=c}}return d};n.createConnection=function(b){var c=null,c=b.caStore?a.util.isArray(b.caStore)?a.pki.createCaStore(b.caStore):b.caStore:a.pki.createCaStore(),d=b.cipherSuites||null;if(null===d){var d=[],e;for(e in n.CipherSuites)d.push(n.CipherSuites[e])}e=b.server?n.ConnectionEnd.server:n.ConnectionEnd.client;var h=b.sessionCache?n.createSessionCache(b.sessionCache):null,g={version:{major:n.Version.major,minor:n.Version.minor},entity:e,
|
|
sessionId:b.sessionId,caStore:c,sessionCache:h,cipherSuites:d,connected:b.connected,virtualHost:b.virtualHost||null,verifyClient:b.verifyClient||!1,verify:b.verify||function(a,b,c,d){return b},getCertificate:b.getCertificate||null,getPrivateKey:b.getPrivateKey||null,getSignature:b.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:b.tlsDataReady,dataReady:b.dataReady,heartbeatReceived:b.heartbeatReceived,closed:b.closed,error:function(a,
|
|
c){c.origin=c.origin||(a.entity===n.ConnectionEnd.client?"client":"server");c.send&&(n.queue(a,n.createAlert(a,c.alert)),n.flush(a));var d=!1!==c.fatal;d&&(a.fail=!0);b.error(a,c);d&&a.close(!1)},deflate:b.deflate||null,inflate:b.inflate||null,reset:function(a){g.version={major:n.Version.major,minor:n.Version.minor};g.record=null;g.session=null;g.peerCertificate=null;g.state={pending:null,current:null};g.expect=0;g.fragmented=null;g.records=[];g.open=!1;g.handshakes=0;g.handshaking=!1;g.isConnected=
|
|
!1;g.fail=!(a||"undefined"===typeof a);g.input.clear();g.tlsData.clear();g.data.clear();g.state.current=n.createConnectionState(g)}};g.reset();g.handshake=function(b){if(g.entity!==n.ConnectionEnd.client)g.error(g,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(g.handshaking)g.error(g,{message:"Handshake already in progress.",fatal:!1});else{g.fail&&!g.open&&0===g.handshakes&&(g.fail=!1);g.handshaking=!0;b=b||"";var c=null;0<b.length&&(g.sessionCache&&(c=g.sessionCache.getSession(b)),
|
|
null===c&&(b=""));0===b.length&&g.sessionCache&&(c=g.sessionCache.getSession(),null!==c&&(b=c.id));g.session={id:b,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()};c&&(g.version=c.version,g.session.sp=c.sp);g.session.sp.client_random=n.createRandom().getBytes();g.open=!0;n.queue(g,n.createRecord(g,{type:n.ContentType.handshake,data:n.createClientHello(g)}));n.flush(g)}};g.process=
|
|
function(b){var c=0;b&&g.input.putBytes(b);if(!g.fail){null!==g.record&&g.record.ready&&g.record.fragment.isEmpty()&&(g.record=null);if(null===g.record){c=0;b=g.input;var d=b.length();5>d?c=5-d:(g.record={type:b.getByte(),version:{major:b.getByte(),minor:b.getByte()},length:b.getInt16(),fragment:a.util.createBuffer(),ready:!1},(b=g.record.version.major===g.version.major)&&g.session&&g.session.version&&(b=g.record.version.minor===g.version.minor),b||g.error(g,{message:"Incompatible TLS version.",send:!0,
|
|
alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.protocol_version}}))}if(!g.fail&&null!==g.record&&!g.record.ready){c=g;b=0;var d=c.input,e=d.length();e<c.record.length?b=c.record.length-e:(c.record.fragment.putBytes(d.getBytes(c.record.length)),d.compact(),c.state.current.read.update(c,c.record)&&(null!==c.fragmented&&(c.fragmented.type===c.record.type?(c.fragmented.fragment.putBuffer(c.record.fragment),c.record=c.fragmented):c.error(c,{message:"Invalid fragmented record.",send:!0,
|
|
alert:{level:n.Alert.Level.fatal,description:n.Alert.Description.unexpected_message}})),c.record.ready=!0));c=b}if(!g.fail&&null!==g.record&&g.record.ready)if(b=g.record,d=b.type-n.ContentType.change_cipher_spec,e=W[g.entity][g.expect],d in e)e[d](g,b);else n.handleUnexpected(g,b)}return c};g.prepare=function(b){n.queue(g,n.createRecord(g,{type:n.ContentType.application_data,data:a.util.createBuffer(b)}));return n.flush(g)};g.prepareHeartbeatRequest=function(b,c){b instanceof a.util.ByteBuffer&&(b=
|
|
b.bytes());"undefined"===typeof c&&(c=b.length);g.expectedHeartbeatPayload=b;n.queue(g,n.createRecord(g,{type:n.ContentType.heartbeat,data:n.createHeartbeat(n.HeartbeatMessageType.heartbeat_request,b,c)}));return n.flush(g)};g.close=function(a){if(!g.fail&&g.sessionCache&&g.session){var b={id:g.session.id,version:g.session.version,sp:g.session.sp};b.sp.keys=null;g.sessionCache.setSession(b.id,b)}if(g.open){g.open=!1;g.input.clear();if(g.isConnected||g.handshaking)g.isConnected=g.handshaking=!1,n.queue(g,
|
|
n.createAlert(g,{level:n.Alert.Level.warning,description:n.Alert.Description.close_notify})),n.flush(g);g.closed(g)}g.reset(a)};return g};a.tls=a.tls||{};for(var X in n)"function"!==typeof n[X]&&(a.tls[X]=n[X]);a.tls.prf_tls1=c;a.tls.hmac_sha1=function(b,c,d){var e=a.hmac.create();e.start("SHA1",b);b=a.util.createBuffer();b.putInt32(c[0]);b.putInt32(c[1]);b.putByte(d.type);b.putByte(d.version.major);b.putByte(d.version.minor);b.putInt16(d.length);b.putBytes(d.fragment.bytes());e.update(b.getBytes());
|
|
return e.digest().getBytes()};a.tls.createSessionCache=n.createSessionCache;a.tls.createConnection=n.createConnection}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.tls)return c.tls;c.defined.tls=!0;for(var k=0;k<e.length;++k)e[k](c);return c.tls}},
|
|
k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,e,g){e=e.entity===a.tls.ConnectionEnd.client;b.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",
|
|
e?g.keys.server_write_key:g.keys.client_write_key),iv:e?g.keys.server_write_IV:g.keys.client_write_IV};b.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",e?g.keys.client_write_key:g.keys.server_write_key),iv:e?g.keys.client_write_IV:g.keys.server_write_IV};b.read.cipherFunction=p;b.write.cipherFunction=d;b.read.macLength=b.write.macLength=g.mac_length;b.read.macFunction=b.write.macFunction=n.hmac_sha1}function d(b,c){var g=!1,k=c.macFunction(c.macKey,c.sequenceNumber,b);b.fragment.putBytes(k);
|
|
c.updateSequenceNumber();k=b.version.minor===n.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:a.random.getBytesSync(16);c.cipherState.init=!0;var m=c.cipherState.cipher;m.start({iv:k});b.version.minor>=n.Versions.TLS_1_1.minor&&m.output.putBytes(k);m.update(b.fragment);m.finish(e)&&(b.fragment=m.output,b.length=b.fragment.length(),g=!0);return g}function e(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function k(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1-
|
|
d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function p(b,c){var d=!1;++g;d=b.version.minor===n.Versions.TLS_1_0.minor?c.cipherState.init?null:c.cipherState.iv:b.fragment.getBytes(16);c.cipherState.init=!0;var e=c.cipherState.cipher;e.start({iv:d});e.update(b.fragment);var d=e.finish(k),m=c.macLength,l=a.random.getBytesSync(m),z=e.output.length();z>=m?(b.fragment=e.output.getBytes(z-m),l=e.output.getBytes(m)):b.fragment=e.output.getBytes();b.fragment=a.util.createBuffer(b.fragment);b.length=
|
|
b.fragment.length();m=c.macFunction(c.macKey,c.sequenceNumber,b);c.updateSequenceNumber();e=c.macKey;z=a.hmac.create();z.start("SHA1",e);z.update(l);l=z.digest().getBytes();z.start(null,null);z.update(m);m=z.digest().getBytes();return l===m&&d}var n=a.tls;n.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes;a.cipher_type=n.CipherType.block;a.enc_key_length=16;a.block_length=16;
|
|
a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=n.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:c};n.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes;a.cipher_type=n.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=n.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=
|
|
20},initConnectionState:c};var g=0}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aesCipherSuites)return c.aesCipherSuites;c.defined.aesCipherSuites=!0;for(var k=0;k<e.length;++k)e[k](c);return c.aesCipherSuites}},k=a;a=function(b,c){r="string"===
|
|
typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/aesCipherSuites",["require","module","./aes","./tls"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.debug=a.debug||{};a.debug.storage={};a.debug.get=function(b,c){var d;"undefined"===typeof b?d=a.debug.storage:b in a.debug.storage&&(d="undefined"===typeof c?a.debug.storage[b]:
|
|
a.debug.storage[b][c]);return d};a.debug.set=function(b,c,d){b in a.debug.storage||(a.debug.storage[b]={});a.debug.storage[b][c]=d};a.debug.clear=function(b,c){"undefined"===typeof b?a.debug.storage={}:b in a.debug.storage&&("undefined"===typeof c?delete a.debug.storage[b]:delete a.debug.storage[b][c])}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=
|
|
function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.debug)return c.debug;c.defined.debug=!0;for(var k=0;k<e.length;++k)e[k](c);return c.debug}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/debug",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();
|
|
(function(){function b(a){function c(b,d,e,k){b.generate=function(b,c){for(var m=new a.util.ByteBuffer,l=Math.ceil(c/k)+e,p=new a.util.ByteBuffer,r=e;r<l;++r){p.putInt32(r);d.start();d.update(b+p.getBytes());var w=d.digest();m.putBytes(w.getBytes(k))}m.truncate(m.length()-c);return m.getBytes()}}a.kem=a.kem||{};var d=a.jsbn.BigInteger;a.kem.rsa={};a.kem.rsa.create=function(b,c){c=c||{};var e=c.prng||a.random;return{encrypt:function(c,g){var h=Math.ceil(c.n.bitLength()/8),k;do k=(new d(a.util.bytesToHex(e.getBytesSync(h)),
|
|
16)).mod(c.n);while(k.equals(d.ZERO));k=a.util.hexToBytes(k.toString(16));h-=k.length;0<h&&(k=a.util.fillString(String.fromCharCode(0),h)+k);h=c.encrypt(k,"NONE");k=b.generate(k,g);return{encapsulation:h,key:k}},decrypt:function(a,c,d){a=a.decrypt(c,"NONE");return b.generate(a,d)}}};a.kem.kdf1=function(a,b){c(this,a,0,b||a.digestLength)};a.kem.kdf2=function(a,b){c(this,a,1,b||a.digestLength)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.kem)return c.kem;c.defined.kem=!0;for(var k=0;k<e.length;++k)e[k](c);return c.kem}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/kem",["require","module","./util","./random",
|
|
"./jsbn"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){a.log=a.log||{};a.log.levels="none error warning info debug verbose max".split(" ");var c={},d=[],e=null;a.log.LEVEL_LOCKED=2;a.log.NO_LEVEL_CHECK=4;a.log.INTERPOLATE=8;for(var k=0;k<a.log.levels.length;++k){var p=a.log.levels[k];c[p]={index:k,name:p.toUpperCase()}}a.log.logMessage=function(b){for(var e=c[b.level].index,k=0;k<d.length;++k){var l=d[k];l.flags&a.log.NO_LEVEL_CHECK?l.f(b):e<=c[l.level].index&&
|
|
l.f(l,b)}};a.log.prepareStandard=function(a){"standard"in a||(a.standard=c[a.level].name+" ["+a.category+"] "+a.message)};a.log.prepareFull=function(b){if(!("full"in b)){var c=[b.message],c=c.concat([]);b.full=a.util.format.apply(this,c)}};a.log.prepareStandardFull=function(b){"standardFull"in b||(a.log.prepareStandard(b),b.standardFull=b.standard)};p=["error","warning","info","debug","verbose"];for(k=0;k<p.length;++k)(function(b){a.log[b]=function(c,d){var e=Array.prototype.slice.call(arguments).slice(2);
|
|
a.log.logMessage({timestamp:new Date,level:b,category:c,message:d,arguments:e})}})(p[k]);a.log.makeLogger=function(b){b={flags:0,f:b};a.log.setLevel(b,"none");return b};a.log.setLevel=function(b,c){var d=!1;if(b&&!(b.flags&a.log.LEVEL_LOCKED))for(var e=0;e<a.log.levels.length;++e)if(c==a.log.levels[e]){b.level=c;d=!0;break}return d};a.log.lock=function(b,c){b.flags="undefined"===typeof c||c?b.flags|a.log.LEVEL_LOCKED:b.flags&~a.log.LEVEL_LOCKED};a.log.addLogger=function(a){d.push(a)};if("undefined"!==
|
|
typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var n={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},e=function(b,c){a.log.prepareStandard(c);var d=n[c.level],e=[c.standard],e=e.concat(c.arguments.slice());d.apply(console,e)};else e=function(b,c){a.log.prepareStandardFull(c);console.log(c.standardFull)};e=a.log.makeLogger(e);a.log.setLevel(e,"debug");a.log.addLogger(e)}else console={log:function(){}};
|
|
null!==e&&(k=a.util.getQueryVariables(),"console.level"in k&&a.log.setLevel(e,k["console.level"].slice(-1)[0]),"console.lock"in k&&"true"==k["console.lock"].slice(-1)[0]&&a.log.lock(e));a.log.consoleLogger=e}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.log)return c.log;
|
|
c.defined.log=!0;for(var k=0;k<e.length;++k)e[k](c);return c.log}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/log",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b){var d={},e=[];if(!r.validate(b,J.asn1.recipientInfoValidator,d,e))throw b=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
|
|
b.errors=e,b;return{version:d.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(d.issuer),serialNumber:a.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:r.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(b){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),
|
|
r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.encryptedContent.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.encryptedContent.content)])}function e(a){for(var b=[],c=0;c<a.length;++c)b.push(d(a[c]));return b}function k(b){var c=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
|
|
r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:b.issuer}),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,a.util.hexToBytes(b.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.digestAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])]);b.authenticatedAttributesAsn1&&c.value.push(b.authenticatedAttributesAsn1);c.value.push(r.create(r.Class.UNIVERSAL,
|
|
r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.signatureAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));c.value.push(r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.signature));if(0<b.unauthenticatedAttributes.length){for(var d=r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<b.unauthenticatedAttributes.length;++e)d.values.push(p(b.unauthenticatedAttributes[e]));c.value.push(d)}return c}function p(b){var c;if(b.type===a.pki.oids.contentType)c=
|
|
r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.value).getBytes());else if(b.type===a.pki.oids.messageDigest)c=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.value.bytes());else if(b.type===a.pki.oids.signingTime){c=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=b.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?r.utcTimeToDate(e):r.generalizedTimeToDate(e):new Date(g);c=e>=c&&e<d?r.create(r.Class.UNIVERSAL,r.Type.UTCTIME,!1,r.dateToUtcTime(e)):
|
|
r.create(r.Class.UNIVERSAL,r.Type.GENERALIZEDTIME,!1,r.dateToGeneralizedTime(e))}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[c])])}function n(b){return[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,
|
|
r.Type.OCTETSTRING,!1,b.parameter.getBytes())]),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,b.content.getBytes())])]}function g(b,c,d){var e={};if(!r.validate(c,d,e,[]))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),b.errors=b,b;if(r.derToOid(e.contentType)!==a.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){c="";if(a.util.isArray(e.encryptedContent))for(d=
|
|
0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");c+=e.encryptedContent[d].value}else c=e.encryptedContent;b.encryptedContent={algorithm:r.derToOid(e.encAlgorithm),parameter:a.util.createBuffer(e.encParameter.value),content:a.util.createBuffer(c)}}if(e.content){c="";if(a.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==r.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
|
|
c+=e.content[d].value}else c=e.content;b.content=a.util.createBuffer(c)}b.version=e.version.charCodeAt(0);return b.rawCapture=e}function h(b){if(void 0===b.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===b.content){var c;switch(b.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:c=a.aes.createDecryptionCipher(b.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:c=a.des.createDecryptionCipher(b.encryptedContent.key);
|
|
break;default:throw Error("Unsupported symmetric cipher, OID "+b.encryptedContent.algorithm);}c.start(b.encryptedContent.parameter);c.update(b.encryptedContent.content);if(!c.finish())throw Error("Symmetric decryption failed.");b.content=c.output}}var r=a.asn1,J=a.pkcs7=a.pkcs7||{};J.messageFromPem=function(b){b=a.pem.decode(b)[0];if("PKCS7"!==b.type){var c=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===
|
|
b.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");b=r.fromDer(b.body);return J.messageFromAsn1(b)};J.messageToPem=function(b,c){var d={type:"PKCS7",body:r.toDer(b.toAsn1()).getBytes()};return a.pem.encode(d,{maxline:c})};J.messageFromAsn1=function(b){var c={},d=[];if(!r.validate(b,J.asn1.contentInfoValidator,c,d))throw c=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),c.errors=d,c;d=r.derToOid(c.contentType);switch(d){case a.pki.oids.envelopedData:d=
|
|
J.createEnvelopedData();break;case a.pki.oids.encryptedData:d=J.createEncryptedData();break;case a.pki.oids.signedData:d=J.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}d.fromAsn1(c.content.value[0]);return d};J.createSignedData=function(){var b=null;return b={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(c){g(b,
|
|
c,J.asn1.signedDataValidator);b.certificates=[];b.crls=[];b.digestAlgorithmIdentifiers=[];b.contentInfo=null;b.signerInfos=[];c=b.rawCapture.certificates.value;for(var d=0;d<c.length;++d)b.certificates.push(a.pki.certificateFromAsn1(c[d]))},toAsn1:function(){b.contentInfo||b.sign();for(var c=[],d=0;d<b.certificates.length;++d)c.push(a.pki.certificateToAsn1(b.certificates[d]));var d=[],e=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,
|
|
r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.digestAlgorithmIdentifiers),b.contentInfo])]);0<c.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,c));0<d.length&&e.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(r.create(r.Class.UNIVERSAL,r.Type.SET,!0,b.signerInfos));return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),
|
|
e])},addSigner:function(c){var d=c.issuer,e=c.serialNumber;c.certificate&&(e=c.certificate,"string"===typeof e&&(e=a.pki.certificateFromPem(e)),d=e.issuer.attributes,e=e.serialNumber);var g=c.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof g&&(g=a.pki.privateKeyFromPem(g));var h=c.digestAlgorithm||a.pki.oids.sha1;switch(h){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+
|
|
h);}c=c.authenticatedAttributes||[];if(0<c.length){for(var k=!1,m=!1,l=0;l<c.length;++l){var n=c[l];if(!k&&n.type===a.pki.oids.contentType){if(k=!0,m)break}else if(!m&&n.type===a.pki.oids.messageDigest&&(m=!0,k))break}if(!k||!m)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}b.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
|
|
signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof b.content||null===b.contentInfo)if(b.contentInfo=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.pki.oids.data).getBytes())]),"content"in b){var c;b.content instanceof a.util.ByteBuffer?c=b.content.bytes():"string"===typeof b.content&&(c=a.util.encodeUtf8(b.content));b.contentInfo.value.push(r.create(r.Class.CONTEXT_SPECIFIC,
|
|
0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)]))}if(0!==b.signers.length){c={};for(var d=0;d<b.signers.length;++d){var e=b.signers[d],g=e.digestAlgorithm;g in c||(c[g]=a.md[a.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?c[g]:a.md[a.pki.oids[g]].create()}b.digestAlgorithmIdentifiers=[];for(g in c)b.digestAlgorithmIdentifiers.push(r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(g).getBytes()),r.create(r.Class.UNIVERSAL,
|
|
r.Type.NULL,!1,"")]));if(2>b.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=r.derToOid(b.contentInfo.value[0].value),d=b.contentInfo.value[1],d=d.value[0],h=r.toDer(d);h.getByte();r.getBerValueLength(h);var h=h.getBytes(),m;for(m in c)c[m].start().update(h);m=new Date;for(d=0;d<b.signers.length;++d){e=b.signers[d];if(0===e.authenticatedAttributes.length){if(g!==a.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
|
|
}else{e.authenticatedAttributesAsn1=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[]),l=0;l<e.authenticatedAttributes.length;++l){var n=e.authenticatedAttributes[l];n.type===a.pki.oids.messageDigest?n.value=c[e.digestAlgorithm].digest():n.type!==a.pki.oids.signingTime||n.value||(n.value=m);h.value.push(p(n));e.authenticatedAttributesAsn1.value.push(p(n))}h=r.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}c=
|
|
b;g=b.signers;m=[];for(d=0;d<g.length;++d)m.push(k(g[d]));c.signerInfos=m}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(c){"string"===typeof c&&(c=a.pki.certificateFromPem(c));b.certificates.push(c)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};J.createEncryptedData=function(){var b=null;return b={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},
|
|
fromAsn1:function(a){g(b,a,J.asn1.encryptedDataValidator)},decrypt:function(a){void 0!==a&&(b.encryptedContent.key=a);h(b)}}};J.createEnvelopedData=function(){var b=null;return b={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(a){var d=g(b,a,J.asn1.envelopedDataValidator);a=b;for(var d=d.recipientInfos.value,e=[],h=0;h<d.length;++h)e.push(c(d[h]));a.recipients=e},toAsn1:function(){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,
|
|
!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(b.type).getBytes()),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(b.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,e(b.recipients)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,n(b.encryptedContent))])])])},findRecipient:function(a){for(var c=a.issuer.attributes,d=0;d<b.recipients.length;++d){var e=b.recipients[d],g=e.issuer;if(e.serialNumber===
|
|
a.serialNumber&&g.length===c.length){for(var h=!0,k=0;k<c.length;++k)if(g[k].type!==c[k].type||g[k].value!==c[k].value){h=!1;break}if(h)return e}}return null},decrypt:function(c,d){if(void 0===b.encryptedContent.key&&void 0!==c&&void 0!==d)switch(c.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var e=d.decrypt(c.encryptedContent.content);b.encryptedContent.key=a.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);
|
|
}h(b)},addRecipient:function(c){b.recipients.push({version:0,issuer:c.issuer.attributes,serialNumber:c.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:c.publicKey}})},encrypt:function(c,d){if(void 0===b.encryptedContent.content){d=d||b.encryptedContent.algorithm;c=c||b.encryptedContent.key;var e,g,h;switch(d){case a.pki.oids["aes128-CBC"]:g=e=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:e=24;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:e=
|
|
32;g=16;h=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:e=24;g=8;h=a.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+d);}if(void 0===c)c=a.util.createBuffer(a.random.getBytes(e));else if(c.length()!=e)throw Error("Symmetric key has wrong length; got "+c.length()+" bytes, expected "+e+".");b.encryptedContent.algorithm=d;b.encryptedContent.key=c;b.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(g));e=h(c);e.start(b.encryptedContent.parameter.copy());
|
|
e.update(b.content);if(!e.finish())throw Error("Symmetric encryption failed.");b.encryptedContent.content=e.output}for(e=0;e<b.recipients.length;++e)if(g=b.recipients[e],void 0===g.encryptedContent.content)switch(g.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:g.encryptedContent.content=g.encryptedContent.key.encrypt(b.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm);}}}}}if("function"!==typeof a)if("object"===typeof module&&
|
|
module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs7)return c.pkcs7;c.defined.pkcs7=!0;for(var k=0;k<e.length;++k)e[k](c);return c.pkcs7}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};a("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=a.util.hexToBytes(e);b.putInt32(e.length);b.putBytes(e)}function d(a,b){a.putInt32(b.length);a.putString(b)}function e(){for(var b=a.md.sha1.create(),c=arguments.length,d=0;d<c;++d)b.update(arguments[d]);
|
|
return b.digest()}var k=a.ssh=a.ssh||{};k.privateKeyToPutty=function(b,k,g){g=g||"";k=k||"";var h=""===k?"none":"aes256-cbc",r;r="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+h+"\r\n")+("Comment: "+g+"\r\n");var p=a.util.createBuffer();d(p,"ssh-rsa");c(p,b.e);c(p,b.n);var x=a.util.encode64(p.bytes(),64),y=Math.floor(x.length/66)+1;r+="Public-Lines: "+y+"\r\n";r+=x;x=a.util.createBuffer();c(x,b.d);c(x,b.p);c(x,b.q);c(x,b.qInv);k?(y=x.length()+16-1,y-=y%16,b=e(x.bytes()),b.truncate(b.length()-
|
|
y+x.length()),x.putBuffer(b),y=a.util.createBuffer(),y.putBuffer(e("\x00\x00\x00\x00",k)),y.putBuffer(e("\x00\x00\x00\u0001",k)),y=a.aes.createEncryptionCipher(y.truncate(8),"CBC"),y.start(a.util.createBuffer().fillWithByte(0,16)),y.update(x.copy()),y.finish(),y=y.output,y.truncate(16),b=a.util.encode64(y.bytes(),64)):b=a.util.encode64(x.bytes(),64);y=Math.floor(b.length/66)+1;r+="\r\nPrivate-Lines: "+y+"\r\n";r+=b;k=e("putty-private-key-file-mac-key",k);y=a.util.createBuffer();d(y,"ssh-rsa");d(y,
|
|
h);d(y,g);y.putInt32(p.length());y.putBuffer(p);y.putInt32(x.length());y.putBuffer(x);g=a.hmac.create();g.start("sha1",k);g.update(y.bytes());return r+="\r\nPrivate-MAC: "+g.digest().toHex()+"\r\n"};k.publicKeyToOpenSSH=function(b,e){e=e||"";var g=a.util.createBuffer();d(g,"ssh-rsa");c(g,b.e);c(g,b.n);return"ssh-rsa "+a.util.encode64(g.bytes())+" "+e};k.privateKeyToOpenSSH=function(b,c){return c?a.pki.encryptRsaPrivateKey(b,c,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(b)};k.getPublicKeyFingerprint=
|
|
function(b,e){e=e||{};var g=e.md||a.md.md5.create(),h=a.util.createBuffer();d(h,"ssh-rsa");c(h,b.e);c(h,b.n);g.start();g.update(h.getBytes());g=g.digest();if("hex"===e.encoding)return g=g.toHex(),e.delimiter?g.match(/.{2}/g).join(e.delimiter):g;if("binary"===e.encoding)return g.getBytes();if(e.encoding)throw Error('Unknown encoding "'+e.encoding+'".');return g}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&
|
|
(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.ssh)return c.ssh;c.defined.ssh=!0;for(var k=0;k<e.length;++k)e[k](c);return c.ssh}},k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
|
|
function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){var c={},d=0;a.debug.set("forge.task","tasks",c);var e={};a.debug.set("forge.task","queues",e);var k={ready:{}};k.ready.stop="ready";k.ready.start="running";k.ready.cancel="done";k.ready.fail="error";k.running={};k.running.stop="ready";k.running.start="running";k.running.block="blocked";k.running.unblock="running";k.running.sleep="sleeping";k.running.wakeup="running";k.running.cancel="done";k.running.fail=
|
|
"error";k.blocked={};k.blocked.stop="blocked";k.blocked.start="blocked";k.blocked.block="blocked";k.blocked.unblock="blocked";k.blocked.sleep="blocked";k.blocked.wakeup="blocked";k.blocked.cancel="done";k.blocked.fail="error";k.sleeping={};k.sleeping.stop="sleeping";k.sleeping.start="sleeping";k.sleeping.block="sleeping";k.sleeping.unblock="sleeping";k.sleeping.sleep="sleeping";k.sleeping.wakeup="sleeping";k.sleeping.cancel="done";k.sleeping.fail="error";k.done={};k.done.stop="done";k.done.start=
|
|
"done";k.done.block="done";k.done.unblock="done";k.done.sleep="done";k.done.wakeup="done";k.done.cancel="done";k.done.fail="error";k.error={};k.error.stop="error";k.error.start="error";k.error.block="error";k.error.unblock="error";k.error.sleep="error";k.error.wakeup="error";k.error.cancel="error";k.error.fail="error";var r=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
|
|
this.timeoutId=null;this.id=d++;c[this.id]=this};r.prototype.debug=function(b){a.log.debug("forge.task",b||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",e)};r.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);var c=new r({run:b,name:a,parent:this});c.state="running";c.type=this.type;c.successCallback=this.successCallback||null;c.failureCallback=this.failureCallback||null;this.subtasks.push(c);return this};r.prototype.parallel=function(b,c){a.util.isArray(b)&&
|
|
(c=b,b=this.name);return this.next(b,function(d){d.block(c.length);for(var e=function(b,e){a.task.start({type:b,run:function(a){c[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},k=0;k<c.length;k++)e(b+"__parallel-"+d.id+"-"+k,k)})};r.prototype.stop=function(){this.state=k[this.state].stop};r.prototype.start=function(){this.error=!1;this.state=k[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),g(this,0))};r.prototype.block=function(a){this.blocks+=
|
|
"undefined"===typeof a?1:a;0<this.blocks&&(this.state=k[this.state].block)};r.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",g(this,0));return this.blocks};r.prototype.sleep=function(a){this.state=k[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";g(b,0)},"undefined"===typeof a?0:a)};r.prototype.wait=function(a){a.wait(this)};r.prototype.wakeup=function(){"sleeping"===
|
|
this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",g(this,0))};r.prototype.cancel=function(){this.state=k[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};r.prototype.fail=function(a){this.error=!0;h(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,g(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
|
|
a.userData=this.userData,a=a.parent;h(a,!0)}this.failureCallback&&this.failureCallback(this)}};var n=function(a){a.error=!1;a.state=k[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),g(a,0))},0)},g=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||g(d,b)}else h(a),a.error||
|
|
null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,g(a.parent,b))};c?setTimeout(d,0):d(b)},h=function(b,d){b.state="done";delete c[b.id];null===b.parent&&(b.type in e?0===e[b.type].length?a.log.error("forge.task","[%s][%s] task queue empty [%s]",b.id,b.name,b.type):e[b.type][0]!==b?a.log.error("forge.task","[%s][%s] task not first in queue [%s]",b.id,b.name,b.type):(e[b.type].shift(),0===e[b.type].length?delete e[b.type]:e[b.type][0].start()):a.log.error("forge.task",
|
|
"[%s][%s] task queue missing [%s]",b.id,b.name,b.type),d||(b.error&&b.failureCallback?b.failureCallback(b):!b.error&&b.successCallback&&b.successCallback(b)))};a.task=a.task||{};a.task.start=function(a){var b=new r({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in e?e[a.type].push(b):(e[b.type]=[b],n(b))};a.task.cancel=function(a){a in e&&(e[a]=[e[a][0]])};a.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in
|
|
a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks={};for(var c in b)b[c].unblock()}};return a}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var r,p=function(a,c){c.exports=function(c){var e=r.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.task)return c.task;c.defined.task=!0;for(var k=0;k<e.length;++k)e[k](c);return c.task}},
|
|
k=a;a=function(b,c){r="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/task",["require","module","./debug","./log","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof a)if("object"===typeof module&&module.exports){var b=!0;a=function(a,b){b(c,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
|
|
return}var e,r=function(a,b){b.exports=function(b){var c=e.map(function(b){return a(b)});b=b||{};b.defined=b.defined||{};if(b.defined.forge)return b.forge;b.defined.forge=!0;for(var d=0;d<c.length;++d)c[d](b);return b};b.exports.disableNativeCode=!0;b.exports(b.exports)},p=a;a=function(c,q){e="string"===typeof c?q.slice(2):c.slice(2);if(b)return delete a,p.apply(null,Array.prototype.slice.call(arguments,0));a=p;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
|
|
function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();return c("js/forge")});function amtcert_linkCertPrivateKey(b,c){for(var a in b){var d=b[a];try{if(0==xxCertPrivateKeys.length)break;for(var e=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),r=0;r<c.length;r++)e===c[r].DERKey+"-----END PUBLIC KEY-----"&&(c[r].XCert=d,d.XPrivateKey=c[r])}catch(p){console.log(p)}}}
|
|
function amtcert_loadP12File(b,c,a){try{var d=window.forge.util.decode64(btoa(b)),e=window.forge.asn1.fromDer(d),r=window.forge.pkcs12.pkcs12FromAsn1(e,c),p=r.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(p[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<p[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var k=p[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,q=window.forge.pki.privateKeyToAsn1(k),m=window.forge.pki.wrapRsaPrivateKey(q);window.forge.asn1.toDer(m).getBytes();
|
|
var w=r.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,l=r.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;a(k,w,l);return!0}catch(x){}return!1}function amtcert_signWithCaKey(b,c,a,d,e){c&&null!=c||(c=amtcert_createCertificate(d).key);return amtcert_createCertificate(a,c,b,d,e)}
|
|
function amtcert_createCertificate(b,c,a,d,e){var r,p=forge.pki.createCertificate();a?p.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+a+"-----END PUBLIC KEY-----"):(r=forge.pki.rsa.generateKeyPair(2048),p.publicKey=r.publicKey);p.serialNumber=""+Math.floor(1E5*Math.random()+1);p.validity.notBefore=new Date(2018,0,1);p.validity.notAfter=new Date(2049,11,31);var k=[];b.CN&&k.push({name:"commonName",value:b.CN});b.C&&k.push({name:"countryName",value:b.C});b.ST&&k.push({shortName:"ST",
|
|
value:b.ST});b.O&&k.push({name:"organizationName",value:b.O});p.setSubject(k);c?(b=[],d.CN&&b.push({name:"commonName",value:d.CN}),d.C&&b.push({name:"countryName",value:d.C}),d.ST&&b.push({shortName:"ST",value:d.ST}),d.O&&b.push({name:"organizationName",value:d.O}),p.setIssuer(b)):p.setIssuer(k);void 0==c?p.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==e?e={name:"extKeyUsage",serverAuth:!0}:e.name="extKeyUsage",
|
|
p.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},e,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));c?p.sign(c,forge.md.sha256.create()):p.sign(r.privateKey,forge.md.sha256.create());return a?p:{cert:p,key:r.privateKey}}
|
|
function _stringToArrayBuffer(b){for(var c=new ArrayBuffer(b.length),a=new Uint8Array(c),d=0,e=b.length;d<e;d++)a[d]=b.charCodeAt(d);return c}function _arrayBufferToString(b){var c="";b=new Uint8Array(b);for(var a=b.byteLength,d=0;d<a;d++)c+=String.fromCharCode(b[d]);return c}function certCetAsn1Values(b,c){if("string"===typeof b&&0==b.indexOf("https://"))c.push(b);else if(Array.isArray(b))for(var a in b)certCetAsn1Values(b[a],c);else b&&"object"===typeof b&&certCetAsn1Values(b.value,c)}
|
|
function getExtensionUrls(b,c){var a=[],d=b.getExtension(c);null!=d&&certCetAsn1Values(forge.asn1.fromDer(d.value),a);return a}var certUrlCache=null,certUrlCacheFile=null;
|
|
function getCertUrl(b,c){null==certUrlCacheFile&&(certUrlCacheFile=null!=process.env.LOCALAPPDATA?require("path").join(process.env.LOCALAPPDATA,"mccache.json"):"mccache.json");if(null==certUrlCache)try{certUrlCache=JSON.parse(require("fs").readFileSync(certUrlCacheFile))}catch(d){certUrlCache={}}if(null!=certUrlCache[b]&&null!=certUrlCache[b].data){var a=0;b.endsWith(".crl")&&(a=Date.now()-12096E5);if(certUrlCache[b].time>a){c(b,atob(certUrlCache[b].data));return}}console.log("Loading: "+b);a=require("url").parse(b);
|
|
require("https").get({hostname:a.hostname,port:a.port?a.port:443,path:a.path,method:"GET",rejectUnauthorized:!1},function(a){var e="";a.on("data",function(a){null!=e&&(e+=a.toString("binary"));5E5<e.length&&(e=null)});a.on("end",function(){certUrlCache[b]={data:btoa(e),time:Date.now()};try{require("fs").writeFileSync(certUrlCacheFile,JSON.stringify(certUrlCache,null,2))}catch(a){}c(b,e)})}).on("error",function(a){console.log("Error: "+a.message);c(b,null)})}script_functionTable1="nop jump set print dialog getitem substr indexof split join length jsonparse jsonstr add substract parseint wsbatchenum wsput wscreate wsdelete wsexec scriptspeed wssubscribe wsunsubscribe readchar signwithdummyca".split(" ");
|
|
script_functionTable2="encodeuri decodeuri passwordcheck atob btoa hex2str str2hex random md5 maketoarray readshort readshortx readint readsint readintx shorttostr shorttostrx inttostr inttostrx".split(" ");script_functionTableX2=[encodeURI,decodeURI,passwordcheck,window.atob.bind(window),window.btoa.bind(window),hex2rstr,rstr2hex,random,rstr_md5,MakeToArray,ReadShort,ReadShortX,ReadInt,ReadSInt,ReadIntX,ShortToStr,ShortToStrX,IntToStr,IntToStrX];script_functionTable3="pullsystemstatus pulleventlog pullauditlog pullcertificates pullwatchdog pullsystemdefense pullhardware pulluserinfo pullremoteaccess highlightblock disconnect getsidstring getsidbytearray pulleventsubscriptions".split(" ");
|
|
script_functionTableX3=[PullSystemStatus,PullEventLog,PullAuditLog,PullCertificates,PullWatchdog,PullSystemDefense,PullHardware,PullUserInfo,PullRemoteAccess,script_HighlightBlock,,function(b,c){return GetSidString(c)},function(b,c){return GetSidByteArray(c)},PullEventSubscriptions];
|
|
function script_setup(b,c){var a={startvars:c};if(6>b.length)return console.error("Invalid script length"),null;if(612182341!=ReadInt(b,0))return console.error("Invalid binary script"),null;if(1<ReadShort(b,4))return console.error("Unsupported script version"),null;a.script=b.substring(6);a.reset=function(b){a.stop();a.ip=0;a.variables=c;a.state=1};a.start=function(b){a.stop();a.stepspeed=b;0<b&&(a.timer=setInterval(function(){a.step()},b))};a.stop=function(){null!=a.timer&&clearInterval(a.timer);
|
|
a.timer=null;a.stepspeed=0};a.getVar=function(b){return void 0==b?void 0:a.getVarEx(b.split("."),a.variables)};a.getVarEx=function(b,c){try{return void 0==b?void 0:0==b.length?c:a.getVarEx(b.slice(1),c[b[0]])}catch(r){return null}};a.setVar=function(b,c){a.setVarEx(b.split("."),a.variables,c)};a.setVarEx=function(b,c,r){1==b.length?c[b[0]]=r:a.setVarEx(b.slice(1),c[b[0]],r)};a.step=function(){if(1==a.state){if(a.ip<a.script.length){var b=ReadShort(a.script,a.ip),c=ReadShort(a.script,a.ip+2),r=ReadShort(a.script,
|
|
a.ip+4),p=a.ip+6,k=[],q;for(q in a.variables)q.startsWith("__")&&delete a.variables[q];for(q=0;q<r;q++){var m=ReadShort(a.script,p),w=a.script.substring(p+2,p+2+m),l=w.charCodeAt(0),w=w.substring(1);if(2>l){for(;1<w.split("{").length;)var x=w.split("{").pop().split("}").shift(),w=w.replace("{"+x+"}",a.getVar(x));1==l&&(a.variables["__"+q]=decodeURI(w),w="__"+q);k.push(w)}if(2==l||3==l)a.variables["__"+q]=ReadSInt(w,0),k.push("__"+q);p+=2+m}a.ip+=c;c=[];for(q=0;10>q;q++)c.push(a.getVar(k[q]));var B;
|
|
try{if(1E4>b)switch(b){case 0:break;case 1:if(c[2]){if("<"==c[2]&&c[1]<c[3]||"<="==c[2]&&c[1]<=c[3]||"!="==c[2]&&c[1]!=c[3]||"="==c[2]&&c[1]==c[3]||">="==c[2]&&c[1]>=c[3]||">"==c[2]&&c[1]>c[3])a.ip=c[0]}else a.ip=c[0];break;case 2:void 0==k[1]?delete a.variables[k[0]]:a.setVar(k[0],c[1]);break;case 3:if(a.onConsole)a.onConsole(a.toString(c[0]),a);else console.log(a.toString(c[0]));break;case 4:a.state=2;a.dialog=!0;setDialogMode(11,c[0],c[2],a.xxStepDialogOk,c[1],a);break;case 5:for(q in c[1])c[1][q][c[2]]==
|
|
c[3]&&(B=q);break;case 6:B=c[1].substr(c[2],c[3]);break;case 7:B=c[1].indexOf(c[2]);break;case 8:B=c[1].split(c[2]);break;case 9:B=c[1].join(c[2]);break;case 10:B=c[1].length;break;case 11:B=JSON.parse(c[1]);break;case 12:B=JSON.stringify(c[1]);break;case 13:B=c[1]+c[2];break;case 14:B=c[1]-c[2];break;case 15:B=parseInt(c[1]);break;case 16:a.state=2;a.amtstack.BatchEnum(c[0],c[1],a.xxWsmanReturn,a);break;case 17:a.state=2;a.amtstack.Put(c[0],c[1],a.xxWsmanReturn,a);break;case 18:a.state=2;a.amtstack.Create(c[0],
|
|
c[1],a.xxWsmanReturn,a);break;case 19:a.state=2;a.amtstack.Delete(c[0],c[1],a.xxWsmanReturn,a);break;case 20:a.state=2;a.amtstack.Exec(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3]);break;case 21:a.stepspeed=c[0];null!=a.timer&&(clearInterval(a.timer),a.timer=setInterval(function(){a.step()},a.stepspeed));break;case 22:a.state=2;a.amtstack.Subscribe(c[0],c[1],c[2],a.xxWsmanReturn,a,0,c[3],c[4],c[5],c[6]);break;case 23:a.state=2;a.amtstack.UnSubscribe(c[0],a.xxWsmanReturn,a,0,c[1]);break;case 24:console.log(c[1],
|
|
c[2],c[1].charCodeAt(c[2]));B=c[1].charCodeAt(c[2]);break;case 25:a.state=2;amtcert_signWithCaKey(c[0],null,c[1],{CN:"Untrusted Root Certificate"},a.xxSignWithDummyCaReturn);break;default:a.state=9,console.error("Script Error, unknown command: "+b)}else 2E4>b?B=script_functionTableX2[b-1E4](c[1],c[2],c[3],c[4],c[5],c[6]):script_functionTableX3&&script_functionTableX3[b-2E4]&&(B=script_functionTableX3[b-2E4](a,c[1],c[2],c[3],c[4],c[5],c[6]));void 0!=B&&a.setVar(k[0],B)}catch(n){"object"==typeof n&&
|
|
(n=n.message),a.setVar("_exception",n)}}1==a.state&&a.ip>=a.script.length&&(a.state=0,a.stop());if(a.onStep)a.onStep(a);return a}};a.xxStepDialogOk=function(b){a.variables.DialogSelect=b;a.state=1;a.dialog=!1;if(a.onStep)a.onStep(a)};a.xxWsmanReturn=function(b,c,r,p){a.setVar(c,r);a.setVar("wsman_result",p);a.setVar("wsman_result_str",httpErrorTable[p]?httpErrorTable[p]:"Error #"+p);a.state=1;if(a.onStep)a.onStep(a)};a.xxSignWithDummyCaReturn=function(b){a.setVar("signed_cert",btoa(_arrayBufferToString(b)));
|
|
a.state=1;if(a.onStep)a.onStep(a)};a.toString=function(a){return"object"==typeof a?JSON.stringify(a):a};a.reset();return a}
|
|
function script_compile(b,c){var a="",d=b.split("\n"),e={},r=[],p=[],k;for(k in d){var q=d[k];if(q.startsWith("##SWAP ")){var m=q.split(" ");3==m.length&&(p[m[1]]=m[2])}if("#"!=q[0]&&0!=q.length){for(m in p)q=q.split(m).join(p[m]);var w=q.match(/"[^"]*"|[^\s"]+/g);if(0!=w.length)if(":"==q[0])e[w[0].toUpperCase()]=a.length;else{q=script_functionTable1.indexOf(w[0].toLowerCase());-1==q&&(q=script_functionTable2.indexOf(w[0].toLowerCase()),0<=q&&(q+=1E4));-1==q&&(q=script_functionTable3.indexOf(w[0].toLowerCase()),
|
|
0<=q&&(q+=2E4));if(-1==q)return c&&c("Unabled to compile, unknown command: "+w[0]),"";var l=ShortToStr(w.length-1),x;for(x in w)if(0!=x)if(":"==w[x][0])r.push([w[x],a.length+l.length+7]),l+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var B=parseInt(w[x]),l=B==w[x]?l+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(B)):'"'==w[x][0]&&'"'==w[x][w[x].length-1]?l+(ShortToStr(w[x].length-1)+String.fromCharCode(1)+w[x].substring(1,w[x].length-1)):l+(ShortToStr(w[x].length+1)+String.fromCharCode(0)+
|
|
w[x]);l=ShortToStr(q)+ShortToStr(l.length+4)+l;a+=l}}}for(k in r){d=r[k][0].toUpperCase();p=r[k][1];m=e[d];if(void 0==m)return c&&c("Unabled to compile, unknown label: "+d),"";a=a.substr(0,p)+IntToStr(m)+a.substr(p+4)}return IntToStr(612182341)+ShortToStr(1)+a}
|
|
function script_decompile(b,c){var a="",d=6,e={};if(0<=c)d=c;else{if(6>b.length)return"# Invalid script length";var r=ReadInt(b,0),p=ReadShort(b,4);if(612182341!=r)return"# Invalid binary script: "+r;if(1!=p)return"# Invalid script version"}for(;d<b.length;){var r=ReadShort(b,d),p=ReadShort(b,d+2),k=ReadShort(b,d+4),q=d+6,m="";0<=c||(a+=":label"+(d-6)+"\n");for(var w=0;w<k;w++){var l=ReadShort(b,q),x=b.substring(q+2,q+2+l),B=x.charCodeAt(0);0==B?m+=" "+x.substring(1):1==B?m+=' "'+x.substring(1)+'"':
|
|
2==B?m+=" "+ReadInt(x,1):3==B&&(x=ReadInt(x,1),B=e[x],B||(B=":label"+x,e[B]=x),m+=" "+B);q+=2+l}a=1E4>r?a+(script_functionTable1[r]+m+"\n"):2E4<=r?a+(script_functionTable3[r-2E4]+m+"\n"):a+(script_functionTable2[r-1E4]+m+"\n");d+=p;if(0<=c)return a}d=a.split("\n");a="";for(w in d)r=d[w],":"!=r[0]?a+=r+"\n":e[r]&&(a+=r+"\n");return a}
|
|
var CreateAmtRemoteDesktop=function(b,c){function a(a){return String.fromCharCode.apply(null,a)}function d(a,b,c,d,g,m,n,w){var G=a[b++];w={};var u=0,v=0;if(0==G){if(2==h.bpp)for(g=0;g<n;g++)p(a[b++]+(a[b++]<<8),g);else for(g=0;g<n;g++)r(a[b++],g);e(h.spare,c,d)}else if(1==G)G=a[b++]+(2==h.bpp?a[b++]<<8:0),h.canvas.fillStyle="rgb("+(1==h.bpp?(G&224)+","+((G&28)<<3)+","+B((G&3)<<6):(G>>8&248)+","+(G>>3&252)+","+((G&31)<<3))+")",a=l(c,d),d=x(c,d),h.canvas.fillRect(a,d,g,m);else if(1<G&&17>G){m=4;v=
|
|
15;if(2==h.bpp){for(g=0;g<G;g++)w[g]=a[b++]+(a[b++]<<8);2==G?v=m=1:4>=G&&(m=2,v=3);for(;u<n&&b<a.byteLength;)for(G=a[b++],g=8-m;0<=g;g-=m)p(w[G>>g&v],u++)}else{for(g=0;g<G;g++)w[g]=a[b++];2==G?v=m=1:4>=G&&(m=2,v=3);for(;u<n&&b<a.byteLength;)for(G=a[b++],g=8-m;0<=g;g-=m)r(w[G>>g&v],u++)}e(h.spare,c,d)}else if(128==G){if(2==h.bpp)for(;u<n&&b<a.byteLength;){G=a[b++]+(a[b++]<<8);v=1;do v+=g=a[b++];while(255==g);if(0==h.rotation)q(G,u,v),u+=v;else for(;0<=--v;)p(G,u++)}else for(;u<n&&b<a.byteLength;){G=
|
|
a[b++];v=1;do v+=g=a[b++];while(255==g);if(0==h.rotation)k(G,u,v),u+=v;else for(;0<=--v;)r(G,u++)}e(h.spare,c,d)}else if(129<G){if(2==h.bpp)for(g=0;g<G-128;g++)w[g]=a[b++]+(a[b++]<<8);else for(g=0;g<G-128;g++)w[g]=a[b++];for(;u<n&&b<a.byteLength;){v=1;g=a[b++];G=w[g%128];if(127<g){do v+=g=a[b++];while(255==g)}if(0==h.rotation)2==h.bpp?q(G,u,v):k(G,u,v),u+=v;else if(2==h.bpp)for(;0<=--v;)p(G,u++);else for(;0<=--v;)r(G,u++)}e(h.spare,c,d)}}function e(a,b,c){if(1!=h.holding){var d=0==h.rotation?b:1==
|
|
h.rotation?h.canvas.canvas.width-h.sparew2-c:2==h.rotation?h.canvas.canvas.width-h.sparew2-b:3==h.rotation?c:0;c=0==h.rotation?c:1==h.rotation?b:2==h.rotation?h.canvas.canvas.height-h.spareh2-c:3==h.rotation?h.canvas.canvas.height-h.spareh-b:0;h.canvas.putImageData(a,d,c)}}function r(a,b){var c=b<<2;if(0<h.rotation)if(1==h.rotation){var c=b%h.sparew,d=Math.floor(b/h.sparew);b=c*h.sparew2+(h.sparew2-1-d);c=b<<2}else 2==h.rotation?c=h.sparew*h.spareh*4-4-c:3==h.rotation&&(c=b%h.sparew,d=Math.floor(b/
|
|
h.sparew),b=(h.sparew2-1-c)*h.sparew2+d,c=b<<2);h.spare.data[c]=a&224;h.spare.data[c+1]=(a&28)<<3;h.spare.data[c+2]=B((a&3)<<6)}function p(a,b){var c=b<<2;if(0<h.rotation)if(1==h.rotation){var c=b%h.sparew,d=Math.floor(b/h.sparew);b=c*h.sparew2+(h.sparew2-1-d);c=b<<2}else 2==h.rotation?c=h.sparew*h.spareh*4-4-c:3==h.rotation&&(c=b%h.sparew,d=Math.floor(b/h.sparew),b=(h.sparew2-1-c)*h.sparew2+d,c=b<<2);h.spare.data[c]=a>>8&248;h.spare.data[c+1]=a>>3&252;h.spare.data[c+2]=(a&31)<<3}function k(a,b,c){b<<=
|
|
2;var d=a&224,e=(a&28)<<3;for(a=B((a&3)<<6);0<=--c;)h.spare.data[b]=d,h.spare.data[b+1]=e,h.spare.data[b+2]=a,b+=4}function q(a,b,c){b<<=2;var d=a>>8&248,e=a>>3&252;for(a=(a&31)<<3;0<=--c;)h.spare.data[b]=d,h.spare.data[b+1]=e,h.spare.data[b+2]=a,b+=4}function m(a,b){return 0==h.rotation?a:1==h.rotation?b:2==h.rotation?h.canvas.canvas.width-a:3==h.rotation?h.canvas.canvas.height-b:0}function w(a,b){return 0==h.rotation?b:1==h.rotation?h.canvas.canvas.width-a:2==h.rotation?h.canvas.canvas.height-b:
|
|
3==h.rotation?a:0}function l(a,b){return 0==h.rotation||1==h.rotation?a:2==h.rotation?a-h.canvas.canvas.width:3==h.rotation?a-h.canvas.canvas.height:0}function x(a,b){return 0==h.rotation?b:1==h.rotation?b-h.canvas.canvas.width:2==h.rotation?b-h.canvas.canvas.height:3==h.rotation?b:0}function B(a){return 127<a?a+32:a}function n(){1!=h.holding&&h.send(String.fromCharCode(3,1,0,0,0,0)+ShortToStr(h.rwidth)+ShortToStr(h.rheight))}function g(a,b){b||(b=window.event);if(b.code&&0==h.localKeyMap){var c;
|
|
c=b;c=c.code.startsWith("Key")&&4==c.code.length?c.code.charCodeAt(3)+(0==c.shiftKey?32:0):c.code.startsWith("Digit")&&6==c.code.length?c.code.charCodeAt(5):c.code.startsWith("Numpad")&&7==c.code.length?c.code.charCodeAt(6):v[c.code];null!=c&&h.sendkey(c,a)}else{var d=c=b.keyCode;0==b.shiftKey&&65<=c&&90>=c&&(d=c+32);112<=c&&124>=c&&(d=c+65358);8==c&&(d=65288);9==c&&(d=65289);13==c&&(d=65293);16==c&&(d=65505);17==c&&(d=65507);18==c&&(d=65513);27==c&&(d=65307);33==c&&(d=65365);34==c&&(d=65366);35==
|
|
c&&(d=65367);36==c&&(d=65360);37==c&&(d=65361);38==c&&(d=65362);39==c&&(d=65363);40==c&&(d=65364);45==c&&(d=65379);46==c&&(d=65535);96<=c&&105>=c&&(d=c-48);106==c&&(d=42);107==c&&(d=43);109==c&&(d=45);110==c&&(d=46);111==c&&(d=47);186==c&&(d=59);187==c&&(d=61);188==c&&(d=44);189==c&&(d=45);190==c&&(d=46);191==c&&(d=47);192==c&&(d=96);219==c&&(d=91);220==c&&(d=92);221==c&&(d=93);222==c&&(d=39);h.sendkey(d,a)}return h.haltEvent(b)}var h={};h.canvasid=b;h.CanvasId=Q(b);h.scrolldiv=c;h.canvas=Q(b).getContext("2d");
|
|
h.protocol=2;h.state=0;h.acc=null;h.ScreenWidth=960;h.ScreenHeight=700;h.width=0;h.height=0;h.rwidth=0;h.rheight=0;h.bpp=2;h.useRLE=!0;h.showmouse=!0;h.buttonmask=0;h.localKeyMap=!0;h.spare=null;h.sparew=0;h.spareh=0;h.sparew2=0;h.spareh2=0;h.sparecache={};h.onScreenSizeChange=null;h.frameRateDelay=0;h.noMouseRotate=!1;h.rotation=0;h.kvmDataSupported=!1;h.onKvmData=null;h.onKvmDataPending=[];h.onKvmDataAck=-1;h.holding=!1;h.lastKeepAlive=Date.now();h.kvmExt={};h.kvmExtChanged=null;h.useZLib=!1;h.graymode=
|
|
!1;h.mNagleTimer=null;h.mx=0;h.my=0;h.inflate=ZLIB.inflateInit(-15);h.xxStateChange=function(a){0==a?(h.canvas.fillStyle="#000000",h.canvas.fillRect(0,0,h.width,h.height),h.canvas.canvas.width=h.rwidth=h.width=640,h.canvas.canvas.height=h.rheight=h.height=400,QS(h.canvasid).cursor="default"):QS(h.canvasid).cursor=h.showmouse?"default":"none"};h.ProcessBinaryData=function(b){if(null==h.acc)h.acc=new Uint8Array(b);else{var c=new Uint8Array(h.acc.byteLength+b.byteLength);c.set(h.acc,0);c.set(new Uint8Array(b),
|
|
h.acc.byteLength);h.acc=c}for(;null!=h.acc&&0<h.acc.byteLength;){var g=0,k=new DataView(h.acc.buffer);if(0==h.state&&12<=h.acc.byteLength)g=12,h.state=1,h.send("RFB 003.008\n");else if(1==h.state&&1<=h.acc.byteLength)g=h.acc[0]+1,h.send(String.fromCharCode(1)),h.state=2;else if(2==h.state&&4<=h.acc.byteLength){g=4;if(0!=k.getUint32(0))return h.Stop();h.send(String.fromCharCode(1));h.state=3;h.parent&&(h.parent.disconnectCode=5E4)}else if(3==h.state&&24<=h.acc.byteLength){h.rotation=0;b=k.getUint32(20);
|
|
if(h.acc.byteLength<24+b)break;g=24+b;h.canvas.canvas.width=h.rwidth=h.width=h.ScreenWidth=k.getUint16(0);h.canvas.canvas.height=h.rheight=h.height=h.ScreenHeight=k.getUint16(2);b="";h.useRLE&&(b+=IntToStr(16));b+=IntToStr(0);b+=IntToStr(1092);h.send(String.fromCharCode(2,0)+ShortToStr(b.length/4+1)+b+IntToStr(-223));1==h.bpp&&h.send(String.fromCharCode(0,0,0,0,8,8,0,1)+ShortToStr(7)+ShortToStr(7)+ShortToStr(3)+String.fromCharCode(5,2,0,0,0,0));h.state=4;h.parent&&(h.parent.disconnectCode=0,h.parent.xxStateChange(3));
|
|
null!=h.kvmExtChanged&&(h.sendKvmExtCmd(2,h.graymode?1:0),h.sendKvmExtCmd(4,h.useZLib?1:0));n();if(null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight);h.parent&&(h.parent.disconnectCode=50001)}else if(4==h.state)switch(h.acc[0]){case 0:if(4>h.acc.byteLength)return;h.state=100+k.getUint16(2);g=4;break;case 2:g=1;break;case 3:if(8>h.acc.byteLength)return;b=k.getUint32(4)+8;if(h.acc.byteLength<b)return;c=h.acc;if(8>c.byteLength)g=0;else if(b=k.getUint32(4)+8,c.byteLength<
|
|
b)g=0;else{if(null!=h.onKvmData){var m=a(new Uint8Array(c.buffer.slice(8,b)));if(16<=m.length&&"\x00KvmDataChannel"==m.substring(0,15)){0==h.kvmDataSupported&&(h.kvmDataSupported=!0,console.log("KVM Data Channel Supported."));if(-1==h.onKvmDataAck&&16==m.length||0!=m.charCodeAt(15))h.onKvmDataAck=!0;urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Recv("+(m.length-16)+"): "+m.substring(16));if(16<=m.length)h.onKvmData(m.substring(16));1==h.onKvmDataAck&&0<h.onKvmDataPending.length&&h.sendKvmData(h.onKvmDataPending.shift())}else 13<=
|
|
m.length&&"\x00KvmExtCmd\x00"==m.substring(0,11)?(c=m.charCodeAt(11),m=m.charCodeAt(12),console.log("Received KvmExtCmd",c,m),1==c&&(h.kvmExt.decimation=m,null!=h.kvmExtChanged&&h.kvmExtChanged(1,m)),2==c&&h.sendKvmExtCmd(1),3==c&&(h.kvmExt.compression=m,null!=h.kvmExtChanged&&h.kvmExtChanged(3,m)),4==c&&h.sendKvmExtCmd(3)):(console.log("Got KVM clipboard data:",m),urlvars&&urlvars.kvmdatatrace&&console.log("KVM-ClipBoard-Recv("+m.length+"): "+rstr2hex(m)+", "+m))}g=b}}else if(100<h.state&&12<=h.acc.byteLength){b=
|
|
k.getUint16(0);var c=k.getUint16(2),g=k.getUint16(4),l=k.getUint16(6),m=g*l,q=k.getUint32(8);if(17>q){if(1>g||64<g||1>l||64<l)return console.log("Invalid tile size ("+g+","+l+"), disconnecting."),h.Stop();if(h.sparew!=g||h.spareh!=l){h.sparew=h.sparew2=g;h.spareh=h.spareh2=l;if(1==h.rotation||3==h.rotation)h.sparew2=l,h.spareh2=g;var w=h.sparew2+"x"+h.spareh2;h.spare=h.sparecache[w];if(!h.spare){h.sparecache[w]=h.spare=h.canvas.createImageData(h.sparew2,h.spareh2);for(var x=h.sparew2*h.spareh2<<2,
|
|
w=3;w<x;w+=4)h.spare.data[w]=255}}}if(4294967073==q){if(h.canvas.canvas.width=h.rwidth=h.width=g,h.canvas.canvas.height=h.rheight=h.height=l,h.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(h.width)+ShortToStr(h.height)),g=12,null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight)}else if(0==q){q=12;g=12+m*h.bpp;if(h.acc.byteLength<g)break;if(2==h.bpp)for(w=0;w<m;w++)p(k.getUint16(q,!0),w),q+=2;else for(w=0;w<m;w++)r(h.acc[q++],w);e(h.spare,b,c)}else if(16==q){if(16>h.acc.byteLength)break;
|
|
w=k.getUint32(12);if(h.acc.byteLength<16+w)break;q=16;if(5<w&&0==h.acc[q]&&k.getUint16(q+1,!0)==w-5)d(h.acc,q+5,b,c,g,l,m,w);else if(k=h.inflate.inflate(a(new Uint8Array(h.acc.buffer.slice(q,q+w-0)))),0<k.length){for(var q=k,x=new Uint8Array(q.length),u=0,v=q.length;u<v;++u)x[u]=q.charCodeAt(u);d(x,0,b,c,g,l,m,k.length)}else console.log("Invalid deflate data");g=16+w}else return h.Stop();100==--h.state&&(h.state=4,0==h.frameRateDelay?n():setTimeout(n,h.frameRateDelay))}if(0==g)break;h.acc=g!=h.acc.byteLength?
|
|
new Uint8Array(h.acc.buffer.slice(g)):null}};h.hold=function(a){if(h.holding!=a)if(h.holding=a,h.canvas.fillStyle="#000000",h.canvas.fillRect(0,0,h.width,h.height),0==h.holding){if(h.canvas.canvas.width!=h.width||h.canvas.canvas.height!=h.height)if(h.canvas.canvas.width=h.width,h.canvas.canvas.height=h.height,null!=h.onScreenSizeChange)h.onScreenSizeChange(h,h.ScreenWidth,h.ScreenHeight);h.send(String.fromCharCode(3,0,0,0,0,0)+ShortToStr(h.width)+ShortToStr(h.height))}else h.UnGrabMouseInput(),h.UnGrabKeyInput()};
|
|
h.tcanvas=null;h.setRotation=function(a){for(;0>a;)a+=4;a%=4;if(1==h.holding)h.rotation=a;else{if(a==h.rotation)return!0;var b=h.canvas.canvas.width,c=h.canvas.canvas.height;if(1==h.rotation||3==h.rotation)b=h.canvas.canvas.height,c=h.canvas.canvas.width;null==h.tcanvas&&(h.tcanvas=document.createElement("canvas"));var d=h.tcanvas.getContext("2d");d.setTransform(1,0,0,1,0,0);d.canvas.width=b;d.canvas.height=c;d.rotate(-90*h.rotation*Math.PI/180);0==h.rotation&&d.drawImage(h.canvas.canvas,0,0);1==
|
|
h.rotation&&d.drawImage(h.canvas.canvas,-h.canvas.canvas.width,0);2==h.rotation&&d.drawImage(h.canvas.canvas,-h.canvas.canvas.width,-h.canvas.canvas.height);3==h.rotation&&d.drawImage(h.canvas.canvas,0,-h.canvas.canvas.height);if(0==h.rotation||2==h.rotation)h.canvas.canvas.height=b,h.canvas.canvas.width=c;if(1==h.rotation||3==h.rotation)h.canvas.canvas.height=c,h.canvas.canvas.width=b;h.canvas.setTransform(1,0,0,1,0,0);h.canvas.rotate(90*a*Math.PI/180);h.rotation=a;h.canvas.drawImage(h.tcanvas,l(0,
|
|
0),x(0,0));h.width=h.canvas.canvas.width;h.height=h.canvas.canvas.height;if(null!=h.onScreenResize)h.onScreenResize(h,h.width,h.height,h.CanvasId);return!0}};h.Start=function(){h.state=0;h.acc=null;h.inflate.inflateReset();h.onKvmDataPending=[];h.onKvmDataAck=-1;h.kvmDataSupported=!1;h.kvmExt={};for(var a in h.sparecache)delete h.sparecache[a]};h.Stop=function(){h.UnGrabMouseInput();h.UnGrabKeyInput();h.parent&&h.parent.Stop()};h.send=function(a){h.parent&&h.parent.send(a)};var v={Pause:19,CapsLock:20,
|
|
Space:32,Quote:39,Minus:45,NumpadMultiply:42,NumpadAdd:43,PrintScreen:44,Comma:44,NumpadSubtract:45,NumpadDecimal:46,Period:46,Slash:47,NumpadDivide:47,Semicolon:59,Equal:61,OSLeft:91,BracketLeft:91,OSRight:91,Backslash:92,BracketRight:93,ContextMenu:93,Backquote:96,NumLock:144,ScrollLock:145,Backspace:65288,Tab:65289,Enter:65293,NumpadEnter:65293,Escape:65307,Delete:65535,Home:65360,PageUp:65365,PageDown:65366,ArrowLeft:65361,ArrowUp:65362,ArrowRight:65363,ArrowDown:65364,End:65367,Insert:65379,
|
|
F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481,ShiftLeft:65505,ShiftRight:65506,ControlLeft:65507,ControlRight:65508,AltLeft:65513,AltRight:65514,MetaLeft:65511,MetaRight:65512};h.sendkey=function(a,b){if("object"==typeof a){var c="",d;for(d in a)c+=String.fromCharCode(4,a[d][1],0,0)+IntToStr(a[d][0]);h.send(c)}else h.send(String.fromCharCode(4,b,0,0)+IntToStr(a))};h.sendKvmExtCmd=function(a,b){console.log("Sending KvmExtCmd",a,b);var c=
|
|
"\x00KvmExtCmd\x00"+String.fromCharCode(a)+(null!=b?String.fromCharCode(b):"");h.send(String.fromCharCode(6,0,0,0)+IntToStr(c.length)+c)};h.sendKvmData=function(a){!0!==h.onKvmDataAck?h.onKvmDataPending.push(a):(urlvars&&urlvars.kvmdatatrace&&console.log("KVM-DataChannel-Send("+a.length+"): "+a),a="\x00KvmDataChannel\x00"+a,h.send(String.fromCharCode(6,0,0,0)+IntToStr(a.length)+a),h.onKvmDataAck=!1)};h.sendKeepAlive=function(){h.lastKeepAlive<Date.now()-5E3&&(h.lastKeepAlive=Date.now(),h.send(String.fromCharCode(6,
|
|
0,0,0)+IntToStr(16)+"\x00KvmDataChannel\x00"))};h.SendCtrlAltDelMsg=function(){h.sendcad()};h.sendcad=function(){h.sendkey([[65507,1],[65513,1],[65535,1],[65535,0],[65513,0],[65507,0]])};var J=!1,D=!1;h.GrabMouseInput=function(){if(1!=J){var a=h.canvas.canvas;a.onmouseup=h.mouseup;a.onmousedown=h.mousedown;a.onmousemove=h.mousemove;J=!0}};h.UnGrabMouseInput=function(){if(0!=J){var a=h.canvas.canvas;a.onmousemove=null;a.onmouseup=null;a.onmousedown=null;J=!1}};h.GrabKeyInput=function(){1!=D&&(document.onkeyup=
|
|
h.handleKeyUp,document.onkeydown=h.handleKeyDown,document.onkeypress=h.handleKeys,D=!0)};h.UnGrabKeyInput=function(){0!=D&&(document.onkeyup=null,document.onkeydown=null,document.onkeypress=null,D=!1)};h.handleKeys=function(a){return h.haltEvent(a)};h.handleKeyUp=function(a){return g(0,a)};h.handleKeyDown=function(a){return g(1,a)};h.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};h.mousedblclick=function(a){};h.mousedown=function(a){h.buttonmask|=
|
|
1<<a.button;return h.mousemove(a,1)};h.mouseup=function(a){h.buttonmask&=65535-(1<<a.button);return h.mousemove(a,1)};h.mousemove=function(a,b){if(4>h.state)return!0;var c=h.canvas.canvas.height/Q(h.canvasid).offsetHeight,d=h.canvas.canvas.width/Q(h.canvasid).offsetWidth,e=h.getPositionOfControl(Q(h.canvasid));h.mx=(event.pageX-e[0])*d;h.my=(event.pageY-e[1])*c;event.addx&&(h.mx+=event.addx);event.addy&&(h.my+=event.addy);1!=h.noMouseRotate&&(h.mx2=m(h.mx,h.my),h.my=w(h.mx,h.my),h.mx=h.mx2);1==b?
|
|
(h.send(String.fromCharCode(5,h.buttonmask)+ShortToStr(h.mx)+ShortToStr(h.my)),null!=h.mNagleTimer&&(clearTimeout(h.mNagleTimer),h.mNagleTimer=null)):null==h.mNagleTimer&&(h.mNagleTimer=setTimeout(function(){h.send(String.fromCharCode(5,h.buttonmask)+ShortToStr(h.mx)+ShortToStr(h.my));h.mNagleTimer=null},50));return h.haltEvent(a)};h.getPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};return h},CreateAgentRemoteDesktop=
|
|
function(b,c){var a={};a.CanvasId=b;"string"===typeof b&&(a.CanvasId=Q(b));a.Canvas=a.CanvasId.getContext("2d");a.scrolldiv=c;a.State=0;a.PendingOperations=[];a.tilesReceived=0;a.TilesDrawn=0;a.KillDraw=0;a.ipad=!1;a.tabletKeyboardVisible=!1;a.LastX=0;a.LastY=0;a.touchenabled=0;a.submenuoffset=0;a.touchtimer=null;a.TouchArray={};a.connectmode=0;a.connectioncount=0;a.rotation=0;a.protocol=2;a.debugmode=0;a.firstUpKeys=[];a.stopInput=!1;a.localKeyMap=!0;a.altPressed=!1;a.ctrlPressed=!1;a.shiftPressed=
|
|
!1;a.sessionid=0;a.username;a.oldie=!1;a.CompressionLevel=50;a.ScalingLevel=1024;a.FrameRateTimer=10;a.FirstDraw=!1;a.ScreenWidth=960;a.ScreenHeight=700;a.width=960;a.height=960;a.onScreenSizeChange=null;a.onMessage=null;a.onConnectCountChanged=null;a.onDebugMessage=null;a.onTouchEnabledChanged=null;a.onDisplayinfo=null;a.accumulator=null;var d=!0,e="default";a.mouseCursorActive=function(b){d!=b&&(d=b,a.CanvasId.style.cursor=1==b?e:"default")};var r="default progress crosshair pointer help text no-drop move nesw-resize ns-resize nwse-resize w-resize alias wait none not-allowed col-resize row-resize copy zoom-in zoom-out".split(" ");
|
|
a.Start=function(){a.State=0;a.accumulator=null};a.Stop=function(){a.setRotation(0);a.UnGrabKeyInput();a.UnGrabMouseInput();a.touchenabled=0;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.Canvas.clearRect(0,0,a.CanvasId.width,a.CanvasId.height)};a.xxStateChange=function(b){if(a.State!=b)switch(a.State=b,a.CanvasId.style.cursor="default",b){case 0:a.Stop()}};a.send=function(b){1<a.debugmode&&console.log("KSend("+b.length+"): "+rstr2hex(b));null!=a.parent&&
|
|
a.parent.send(b)};a.ProcessPictureMsg=function(b,c,d){var e=new Image;e.xcount=a.tilesReceived++;var l=a.tilesReceived;e.src="data:image/jpeg;base64,"+btoa(b.substring(4,b.length));e.onload=function(){if(null!=a.Canvas&&a.KillDraw<l&&0!=a.State)for(a.PendingOperations.push([l,2,e,c,d]);a.DoPendingOperations(););};e.error=function(){console.log("DecodeTileError")}};a.DoPendingOperations=function(){if(0==a.PendingOperations.length)return!1;for(var b=0;b<a.PendingOperations.length;b++){var c=a.PendingOperations[b];
|
|
if(c[0]==a.TilesDrawn+1)return 1==c[1]?a.ProcessCopyRectMsg(c[2]):2==c[1]&&(a.Canvas.drawImage(c[2],a.rotX(c[3],c[4]),a.rotY(c[3],c[4])),delete c[2]),a.PendingOperations.splice(b,1),delete c,a.TilesDrawn++,a.TilesDrawn==a.tilesReceived&&a.KillDraw<a.TilesDrawn&&(a.KillDraw=a.TilesDrawn=a.tilesReceived=0),!0}a.oldie&&0<a.PendingOperations.length&&a.TilesDrawn++;return!1};a.ProcessCopyRectMsg=function(b){var c=((b.charCodeAt(0)&255)<<8)+(b.charCodeAt(1)&255),d=((b.charCodeAt(2)&255)<<8)+(b.charCodeAt(3)&
|
|
255),e=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255),l=((b.charCodeAt(6)&255)<<8)+(b.charCodeAt(7)&255),r=((b.charCodeAt(8)&255)<<8)+(b.charCodeAt(9)&255);b=((b.charCodeAt(10)&255)<<8)+(b.charCodeAt(11)&255);a.Canvas.drawImage(Canvas.canvas,c,d,r,b,e,l,r,b)};a.SendUnPause=function(){a.send(String.fromCharCode(0,8,0,5,0))};a.SendPause=function(){a.send(String.fromCharCode(0,8,0,5,1))};a.SendCompressionLevel=function(b,c,d,e){c&&(a.CompressionLevel=c);d&&(a.ScalingLevel=d);e&&(a.FrameRateTimer=e);
|
|
a.send(String.fromCharCode(0,5,0,10,b,a.CompressionLevel)+a.shortToStr(a.ScalingLevel)+a.shortToStr(a.FrameRateTimer))};a.SendRefresh=function(){a.send(String.fromCharCode(0,6,0,4))};a.ProcessScreenMsg=function(b,c){0<a.debugmode&&console.log("ScreenSize: "+b+" x "+c);a.Canvas.setTransform(1,0,0,1,0,0);a.rotation=0;a.FirstDraw=!0;a.ScreenWidth=a.width=b;a.ScreenHeight=a.height=c;for(a.KillDraw=a.tilesReceived;0<a.PendingOperations.length;)a.PendingOperations.shift();a.SendCompressionLevel(1);a.SendUnPause();
|
|
if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId)};a.ProcessData=function(b){for(var c=0;c<b.length;)c+=a.ProcessDataEx(b.substring(c))};a.ProcessDataEx=function(b){null!=a.accumulator&&(b=a.accumulator+b,a.accumulator=null);1<a.debugmode&&console.log("KRecv("+b.length+"): "+rstr2hex(b.substring(0,Math.min(b.length,40))));if(!(4>b.length)){var c=null,m=0,p=0,l=ReadShort(b,0),x=ReadShort(b,2),B=0;if(27==l&&8==x){if(12>b.length)return;l=ReadShort(b,8);x=ReadInt(b,
|
|
4);if(x+8>b.length){a.accumulator=b;return}b=b.substring(8);B=8}x!=b.length&&0<a.debugmode&&console.log(x,b.length,x==b.length);if(18<=l&&65!=l&&88!=l)console.error("Invalid KVM command "+l+" of size "+x),console.log("Invalid KVM data",b.length,rstr2hex(b.substring(0,40))+"...");else if(x>b.length)a.accumulator=b;else{if(3==l||4==l||7==l)c=b.substring(4,x),m=((c.charCodeAt(0)&255)<<8)+(c.charCodeAt(1)&255),p=((c.charCodeAt(2)&255)<<8)+(c.charCodeAt(3)&255),0<a.debugmode&&console.log("CMD"+l+" at X="+
|
|
m+" Y="+p);switch(l){case 3:if(a.FirstDraw)a.onResize();a.ProcessPictureMsg(c,m,p);break;case 4:if(a.FirstDraw)a.onResize();a.TilesDrawn==a.tilesReceived?a.ProcessCopyRectMsg(c):a.PendingOperations.push([++tilesReceived,1,c]);break;case 7:a.ProcessScreenMsg(m,p);a.SendKeyMsgKC(a.KeyAction.UP,16);a.SendKeyMsgKC(a.KeyAction.UP,17);a.SendKeyMsgKC(a.KeyAction.UP,18);a.SendKeyMsgKC(a.KeyAction.UP,91);a.SendKeyMsgKC(a.KeyAction.UP,92);a.SendKeyMsgKC(a.KeyAction.UP,16);a.send(String.fromCharCode(0,14,0,
|
|
4));break;case 11:c=0;m={};p=((b.charCodeAt(4)&255)<<8)+(b.charCodeAt(5)&255);if(0<p)for(c=((b.charCodeAt(6+2*p)&255)<<8)+(b.charCodeAt(7+2*p)&255),l=0;l<p;l++){var n=((b.charCodeAt(6+2*l)&255)<<8)+(b.charCodeAt(7+2*l)&255);m[n]=65535==n?"All Displays":"Display "+n}if(null!=a.onDisplayinfo)a.onDisplayinfo(a,m,c);break;case 14:a.touchenabled=1;a.TouchArray={};if(null!=a.onTouchEnabledChanged)a.onTouchEnabledChanged(a.touchenabled);break;case 15:a.TouchArray={};break;case 16:a.connectioncount=ReadInt(b,
|
|
4);if(null!=a.onConnectCountChanged)a.onConnectCountChanged(a.connectioncount,a);break;case 17:if(null!=a.onMessage)a.onMessage(b.substring(4,x),a);break;case 65:b=b.substring(4);if("."!=b[0]){if(console.log(b),null!=a.parent&&(a.parent.consoleMessage=b,a.parent.onConsoleMessageChange))a.parent.onConsoleMessageChange(a.parent,b)}else console.log("KVM: "+b.substring(1));break;case 88:if(5!=x)break;b=b.charCodeAt(4);b>r.length&&(b=0);e=r[b];d&&(a.CanvasId.style.cursor=e)}return x+B}}};a.MouseButton=
|
|
{NONE:0,LEFT:2,RIGHT:8,MIDDLE:32};a.KeyAction={NONE:0,DOWN:1,UP:2,SCROLL:3,EXUP:4,EXDOWN:5,DBLCLICK:6};a.InputType={KEY:1,MOUSE:2,CTRLALTDEL:10,TOUCH:15};a.Alternate=0;var p={Pause:19,CapsLock:20,Space:32,Quote:222,Minus:189,NumpadMultiply:106,NumpadAdd:107,PrintScreen:44,Comma:188,NumpadSubtract:109,NumpadDecimal:110,Period:190,Slash:191,NumpadDivide:111,Semicolon:186,Equal:187,OSLeft:91,BracketLeft:219,OSRight:91,Backslash:220,BracketRight:221,ContextMenu:93,Backquote:192,NumLock:144,ScrollLock:145,
|
|
Backspace:8,Tab:9,Enter:13,NumpadEnter:13,Escape:27,Delete:46,Home:36,PageUp:33,PageDown:34,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,End:35,Insert:45,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,ShiftLeft:16,ShiftRight:16,ControlLeft:17,ControlRight:17,AltLeft:18,AltRight:18,MetaLeft:91,MetaRight:92,VolumeMute:181};a.SendKeyMsg=function(b,c){if(null!=b)if(c||(c=window.event),c.code&&0==a.localKeyMap){var d;d=c;d=d.code.startsWith("Key")&&4==d.code.length?
|
|
d.code.charCodeAt(3):d.code.startsWith("Digit")&&6==d.code.length?d.code.charCodeAt(5):d.code.startsWith("Numpad")&&7==d.code.length?d.code.charCodeAt(6)+48:p[d.code];null!=d&&a.SendKeyMsgKC(b,d)}else d=c.keyCode,59==d?d=186:173==d?d=189:61==d&&(d=187),a.SendKeyMsgKC(b,d)};a.SendMessage=function(b){3==a.State&&a.send(String.fromCharCode(0,17)+a.shortToStr(4+b.length)+b)};a.SendKeyMsgKC=function(b,c){if(3==a.State)if("object"==typeof b)for(var d in b)a.SendKeyMsgKC(b[d][0],b[d][1]);else a.send(String.fromCharCode(0,
|
|
a.InputType.KEY,0,6,b-1,c))};a.sendcad=function(){a.SendCtrlAltDelMsg()};a.SendCtrlAltDelMsg=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.CTRLALTDEL,0,4))};a.SendEscKey=function(){3==a.State&&a.send(String.fromCharCode(0,a.InputType.KEY,0,6,0,27,0,a.InputType.KEY,0,6,1,27))};a.SendStartMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendCharmsMsg=function(){a.SendKeyMsgKC(a.KeyAction.EXDOWN,91);a.SendKeyMsgKC(a.KeyAction.DOWN,67);a.SendKeyMsgKC(a.KeyAction.UP,
|
|
67);a.SendKeyMsgKC(a.KeyAction.EXUP,91)};a.SendTouchMsg1=function(b,c,d,e){3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(14)+String.fromCharCode(1,b)+a.intToStr(c)+a.shortToStr(d)+a.shortToStr(e))};a.SendTouchMsg2=function(b,c){var d="",e,l;for(l in a.TouchArray)l==b?e=c:1==a.TouchArray[l].f?(e=65542,a.TouchArray[l].f=3):e=2==a.TouchArray[l].f?262144:131078,d+=String.fromCharCode(l)+a.intToStr(e)+a.shortToStr(a.TouchArray[l].x)+a.shortToStr(a.TouchArray[l].y),2==a.TouchArray[l].f&&
|
|
delete a.TouchArray[l];3==a.State&&a.send(String.fromCharCode(0,a.InputType.TOUCH)+a.shortToStr(5+d.length)+String.fromCharCode(2)+d);0==Object.keys(a.TouchArray).length&&null!=a.touchtimer&&(clearInterval(a.touchtimer),a.touchtimer=null)};a.SendMouseMsg=function(b,c){if(3==a.State&&null!=b&&null!=a.Canvas){c||(c=window.event);var d=a.Canvas.canvas.height/a.CanvasId.clientHeight,e=a.Canvas.canvas.width/a.CanvasId.clientWidth,l=a.GetPositionOfControl(a.Canvas.canvas),e=(c.pageX-l[0])*e,d=(c.pageY-
|
|
l[1])*d;c.addx&&(e+=c.addx);c.addy&&(d+=c.addy);if(0<=e&&e<=a.Canvas.canvas.width&&0<=d&&d<=a.Canvas.canvas.height){var r=l=0;b==a.KeyAction.UP||b==a.KeyAction.DOWN?c.which?1==c.which?l=a.MouseButton.LEFT:2==c.which?l=a.MouseButton.MIDDLE:l=a.MouseButton.RIGHT:c.button&&(0==c.button?l=a.MouseButton.LEFT:1==c.button?l=a.MouseButton.MIDDLE:l=a.MouseButton.RIGHT):b==a.KeyAction.SCROLL&&(c.detail?r=-120*c.detail:c.wheelDelta&&(r=3*c.wheelDelta));var p="",p=b==a.KeyAction.DBLCLICK?String.fromCharCode(0,
|
|
a.InputType.MOUSE,0,10,0,136,e/256&255,e&255,d/256&255,d&255):b==a.KeyAction.SCROLL?String.fromCharCode(0,a.InputType.MOUSE,0,12,0,0,e/256&255,e&255,d/256&255,d&255,r/256&255,r&255):String.fromCharCode(0,a.InputType.MOUSE,0,10,0,b==a.KeyAction.DOWN?l:2*l&255,e/256&255,e&255,d/256&255,d&255);a.Action==a.KeyAction.NONE?0==a.Alternate||a.ipad?(a.send(p),a.Alternate=1):a.Alternate=0:a.send(p)}}};a.GetDisplayNumbers=function(){a.send(String.fromCharCode(0,11,0,4))};a.SetDisplay=function(b){console.log("Set display",
|
|
b);a.send(String.fromCharCode(0,12,0,6,b>>8,b&255))};a.intToStr=function(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)};a.shortToStr=function(a){return String.fromCharCode(a>>8&255,a&255)};a.onResize=function(){if(0!=a.ScreenWidth&&0!=a.ScreenHeight&&(a.Canvas.canvas.width!=a.ScreenWidth||a.Canvas.canvas.height!=a.ScreenHeight)){if(a.FirstDraw&&(a.Canvas.canvas.width=a.ScreenWidth,a.Canvas.canvas.height=a.ScreenHeight,a.Canvas.fillRect(0,0,a.ScreenWidth,a.ScreenHeight),null!=a.onScreenSizeChange))a.onScreenSizeChange(a,
|
|
a.ScreenWidth,a.ScreenHeight,a.CanvasId);a.FirstDraw=!1}};a.xxMouseInputGrab=!1;a.xxKeyInputGrab=!1;a.xxMouseMove=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.NONE,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseUp=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.UP,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDown=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DOWN,b);b.preventDefault&&
|
|
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxMouseDblClick=function(b){3==a.State&&a.SendMouseMsg(a.KeyAction.DBLCLICK,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxDOMMouseScroll=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxMouseWheel=function(b){return 3==a.State?(a.SendMouseMsg(a.KeyAction.SCROLL,b),!1):!0};a.xxKeyUp=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.UP,b);b.preventDefault&&
|
|
b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyDown=function(b){3==a.State&&a.SendKeyMsg(a.KeyAction.DOWN,b);b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1};a.xxKeyPress=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};a.handleKeys=function(b){return 1==a.stopInput||3!=desktop.State?!1:a.xxKeyPress(b)};a.handleKeyUp=function(b){if(1==a.stopInput||3!=desktop.State)return!1;if(5>a.firstUpKeys.length&&
|
|
(a.firstUpKeys.push(b.keyCode),5==a.firstUpKeys.length)){var c=a.firstUpKeys.join(",");if("16,17,91,91,16"==c||"16,17,18,91,92"==c)a.stopInput=!0}16==b.keyCode&&(a.shiftPressed=!1);17==b.keyCode&&(a.ctrlPressed=!1);18==b.keyCode&&(a.altPressed=!1);return a.xxKeyUp(b)};a.handleKeyDown=function(b){if(1==a.stopInput||3!=desktop.State)return!1;16==b.keyCode&&(a.shiftPressed=!0);17==b.keyCode&&(a.ctrlPressed=!0);18==b.keyCode&&(a.altPressed=!0);return a.xxKeyDown(b)};a.handleReleaseKeys=function(){a.shiftPressed&&
|
|
a.SendKeyMsgKC(a.KeyAction.UP,16);a.ctrlPressed&&a.SendKeyMsgKC(a.KeyAction.UP,17);a.altPressed&&a.SendKeyMsgKC(a.KeyAction.UP,18);a.shiftPressed=a.ctrlPressed=a.altPressed=!1};a.mousedblclick=function(b){return 1==a.stopInput?!1:a.xxMouseDblClick(b)};a.mousedown=function(b){return 1==a.stopInput?!1:a.xxMouseDown(b)};a.mouseup=function(b){return 1==a.stopInput?!1:a.xxMouseUp(b)};a.mousemove=function(b){return 1==a.stopInput?!1:a.xxMouseMove(b)};a.mousewheel=function(b){return 1==a.stopInput?!1:a.xxMouseWheel(b)};
|
|
a.xxMsTouchEvent=function(b){if(4!=b.originalEvent.pointerType){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();if("MSPointerDown"==b.type||"MSPointerMove"==b.type||"MSPointerUp"==b.type){var c=0,d=b.originalEvent.pointerId%256,e=Canvas.canvas.width/a.CanvasId.clientWidth*b.offsetX,l=Canvas.canvas.height/a.CanvasId.clientHeight*b.offsetY;"MSPointerDown"==b.type?c=65542:"MSPointerMove"==b.type?c=131078:"MSPointerUp"==b.type&&(c=262144);a.TouchArray[d]||(a.TouchArray[d]=
|
|
{x:e,y:l});a.SendTouchMsg2(d,c);"MSPointerUp"==b.type&&delete a.TouchArray[d]}else alert(b.type);return!0}};a.xxTouchStart=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(KeyAction.DOWN,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var e=
|
|
b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[e]||(a.TouchArray[e]={x:Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),y:Canvas.canvas.height/a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]),f:1})}0<Object.keys(a.TouchArray).length&&null==touchtimer&&(a.touchtimer=setInterval(function(){a.SendTouchMsg2(256,0)},50))}};a.xxTouchMove=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled){if(!(1<
|
|
b.originalEvent.touches.length)){var c=b.originalEvent.touches[0];b.which=1;a.LastX=b.pageX=c.pageX;a.LastY=b.pageY=c.pageY;a.SendMouseMsg(a.KeyAction.NONE,b)}}else{var c=a.GetPositionOfControl(Canvas.canvas),d;for(d in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[d].identifier){var e=b.originalEvent.changedTouches[d].identifier%256;a.TouchArray[e]&&(a.TouchArray[e].x=a.Canvas.canvas.width/a.CanvasId.clientWidth*(b.originalEvent.touches[d].pageX-c[0]),a.TouchArray[e].y=a.Canvas.canvas.height/
|
|
a.CanvasId.clientHeight*(b.originalEvent.touches[d].pageY-c[1]))}}};a.xxTouchEnd=function(b){if(3==a.State)if(b.preventDefault&&b.preventDefault(),0==a.touchenabled||1==a.touchenabled)1<b.originalEvent.touches.length||(b.which=1,b.pageX=LastX,b.pageY=LastY,a.SendMouseMsg(KeyAction.UP,b));else for(var c in b.originalEvent.changedTouches)if(b.originalEvent.changedTouches[c].identifier){var d=b.originalEvent.changedTouches[c].identifier%256;a.TouchArray[d]&&(a.TouchArray[d].f=2)}};a.GrabMouseInput=function(){if(1!=
|
|
a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=a.xxMouseMove;b.onmouseup=a.xxMouseUp;b.onmousedown=a.xxMouseDown;b.touchstart=a.xxTouchStart;b.touchmove=a.xxTouchMove;b.touchend=a.xxTouchEnd;b.MSPointerDown=a.xxMsTouchEvent;b.MSPointerMove=a.xxMsTouchEvent;b.MSPointerUp=a.xxMsTouchEvent;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=a.xxDOMMouseScroll:b.onmousewheel=a.xxMouseWheel;a.xxMouseInputGrab=!0}};a.UnGrabMouseInput=function(){if(0!=a.xxMouseInputGrab){var b=a.CanvasId;b.onmousemove=
|
|
null;b.onmouseup=null;b.onmousedown=null;b.touchstart=null;b.touchmove=null;b.touchend=null;b.MSPointerDown=null;b.MSPointerMove=null;b.MSPointerUp=null;navigator.userAgent.match(/mozilla/i)?b.DOMMouseScroll=null:b.onmousewheel=null;a.xxMouseInputGrab=!1}};a.GrabKeyInput=function(){1!=a.xxKeyInputGrab&&(document.onkeyup=a.xxKeyUp,document.onkeydown=a.xxKeyDown,document.onkeypress=a.xxKeyPress,a.xxKeyInputGrab=!0)};a.UnGrabKeyInput=function(){0!=a.xxKeyInputGrab&&(document.onkeyup=null,document.onkeydown=
|
|
null,document.onkeypress=null,a.xxKeyInputGrab=!1)};a.GetPositionOfControl=function(a){var b=Array(2);for(b[0]=b[1]=0;a;)b[0]+=a.offsetLeft,b[1]+=a.offsetTop,a=a.offsetParent;return b};a.crotX=function(b,c){if(0==a.rotation)return b;if(1==a.rotation)return c;if(2==a.rotation)return a.Canvas.canvas.width-b;if(3==a.rotation)return a.Canvas.canvas.height-c};a.crotY=function(b,c){if(0==a.rotation)return c;if(1==a.rotation)return a.Canvas.canvas.width-b;if(2==a.rotation)return a.Canvas.canvas.height-c;
|
|
if(3==a.rotation)return b};a.rotX=function(b,c){if(0==a.rotation||1==a.rotation)return b;if(2==a.rotation)return b-a.Canvas.canvas.width;if(3==a.rotation)return b-a.Canvas.canvas.height};a.rotY=function(b,c){if(0==a.rotation||3==a.rotation)return c;if(1==a.rotation)return c-a.Canvas.canvas.width;if(2==a.rotation)return c-a.Canvas.canvas.height};a.tcanvas=null;a.setRotation=function(b){for(;0>b;)b+=4;b%=4;if(b==a.rotation)return!0;var c=a.Canvas.canvas.width,d=a.Canvas.canvas.height;if(1==a.rotation||
|
|
3==a.rotation)c=a.Canvas.canvas.height,d=a.Canvas.canvas.width;null==a.tcanvas&&(a.tcanvas=document.createElement("canvas"));var e=a.tcanvas.getContext("2d");e.setTransform(1,0,0,1,0,0);e.canvas.width=c;e.canvas.height=d;e.rotate(-90*a.rotation*Math.PI/180);0==a.rotation&&e.drawImage(a.Canvas.canvas,0,0);1==a.rotation&&e.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,0);2==a.rotation&&e.drawImage(a.Canvas.canvas,-a.Canvas.canvas.width,-a.Canvas.canvas.height);3==a.rotation&&e.drawImage(a.Canvas.canvas,
|
|
0,-a.Canvas.canvas.height);if(0==a.rotation||2==a.rotation)a.Canvas.canvas.height=c,a.Canvas.canvas.width=d;if(1==a.rotation||3==a.rotation)a.Canvas.canvas.height=d,a.Canvas.canvas.width=c;a.Canvas.setTransform(1,0,0,1,0,0);a.Canvas.rotate(90*b*Math.PI/180);a.rotation=b;a.Canvas.drawImage(a.tcanvas,a.rotX(0,0),a.rotY(0,0));a.ScreenWidth=a.Canvas.canvas.width;a.ScreenHeight=a.Canvas.canvas.height;if(null!=a.onScreenSizeChange)a.onScreenSizeChange(a,a.ScreenWidth,a.ScreenHeight,a.CanvasId);return!0};
|
|
a.MuchTheSame=function(a,b){return 4>Math.abs(a-b)};a.Debug=function(a){console.log(a)};a.getIEVersion=function(){var a=-1;"Microsoft Internet Explorer"==navigator.appName&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(a=parseFloat(RegExp.$1));return a};a.haltEvent=function(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};return a},CreateKvmDataChannel=function(b,c,a){var d={};d.m=c;c.parent=d;d.webchannel=b;d.State=0;d.protocol=c.protocol;
|
|
d.onStateChanged=null;d.onControlMsg=null;d.debugmode=0;d.keepalive=a;d.rtcKeepAlive=null;d.Start=function(){1==d.debugmode&&console.log("start");d.xxStateChange(3);d.webchannel.onmessage=d.xxOnMessage;d.rtcKeepAlive=setInterval(d.xxSendRtcKeepAlive,3E4)};var e=new FileReader,r=!1,p=[];e.readAsBinaryString?e.onload=function(a){d.xxOnSocketData(a.target.result);0==p.length?r=!1:e.readAsBinaryString(new Blob([p.shift()]))}:e.readAsArrayBuffer&&(e.onloadend=function(a){d.xxOnSocketData(a.target.result);
|
|
0==p.length?r=!1:e.readAsArrayBuffer(p.shift())});d.xxOnMessage=function(a){if("string"==typeof a.data){if(null!=d.onControlMsg)d.onControlMsg(a.data)}else if("object"==typeof a.data)if(1==r)p.push(a.data);else if(e.readAsBinaryString)r=!0,e.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)r=!0,e.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);for(var c=a.byteLength,w=0;w<c;w++)b+=String.fromCharCode(a[w]);d.xxOnSocketData(b)}else d.xxOnSocketData(a.data)};d.xxOnSocketData=
|
|
function(a){if(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,e=0;e<c;e++)b+=String.fromCharCode(a[e]);a=b}else if("string"!==typeof a)return;return d.m.ProcessData(a)}};d.sendCtrlMsg=function(a){"string"==typeof a&&(d.webchannel.send(a),urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a),null!=d.keepalive&&d.keepalive.sendKeepAlive())};d.send=function(a){if("string"==typeof a){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=
|
|
a.charCodeAt(c);a=b}urlvars&&urlvars.webrtctrace&&console.log("WebRTC-Send("+d.State+"): ",typeof a,a);d.webchannel.send(a)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(){1==d.debugmode&&console.log("stop");null!=d.rtcKeepAlive&&(clearInterval(d.rtcKeepAlive),d.rtcKeepAlive=null);d.xxStateChange(0)};d.xxSendRtcKeepAlive=function(){urlvars&&urlvars.webrtctrace&&console.log("WebRTC-SendKeepAlive()");
|
|
d.sendCtrlMsg(JSON.stringify({action:"ping"}))};return d},CreateAmtRemoteTerminal=function(b,c){function a(b){if("\x00"!=b&&7!=b.charCodeAt()){var c=b.charCodeAt();1==k.terminalEmulation?0!=(c&128)&&(b=String.fromCharCode(u[c&127])):2==k.terminalEmulation&&0!=(c&128)&&(b=String.fromCharCode(R[c&127]));switch(c){case 16:b=" ";break;case 24:b="\u2191";break;case 25:b="\u2193"}B>k.width&&(B=k.width);n>k.height-1&&(n=k.height-1);switch(b){case "\b":0<B&&(B--,O&&d(" "));break;case "\t":b=8-B%8;for(c=0;c<
|
|
b;c++)a(" ");break;case "\n":n++;n>F[1]&&(k.recordLineTobackBuffer(0),p(1),n=F[1]);k.lineFeed="\r";B=0;break;case "\r":B=0;break;default:B>=k.width&&(B=0,x&&n++,n>=k.height-1&&(p(1),n=k.height-1)),d(b),B++}}}function d(a){z[n][B]=a;C[n][B]=(w<<6)+(l<<12)+m}function e(){for(var a=(w<<6)+(l<<12)+m,b=B;b<k.width;b++)z[n][b]=" ",C[n][b]=a}function r(a){for(var b=(w<<6)+(l<<12)+m,c=0;c<k.width;c++)z[a][c]=" ",C[a][c]=b}function p(a){var b;for(b=F[0];b<=F[1]-a;b++)z[b]=z[b+a],C[b]=C[b+a];for(b=F[1]-a+1;b<=
|
|
F[1];b++)for(z[b]=[],C[b]=[],a=0;a<k.width;a++)z[b][a]=" ",C[b][a]=448}var k={};k.DivId=b;k.DivElement=document.getElementById(b);k.protocol=1;c&&c.protocol&&(k.protocol=c.protocol);k.terminalEmulation=1;k.fxEmulation=0;k.lineFeed="\r\n";k.debugmode=0;k.width=80;k.height=25;k.heightLock=0;var q="000000 BB0000 00BB00 BBBB00 0000BB BB00BB 00BBBB BBBBBB 555555 FF5555 55FF55 FFFF55 5555FF FF55FF 55FFFF FFFFFF".split(" "),m=0,w=7,l=0,x=!0,B=0,n=0,g=0,h=0,v=0,J=[],D=0,y=0,C=[],z=[],O=!1,A=!0,F,H=!1,M=[],
|
|
G="";k.title=null;k.onTitleChange=null;k.Start=function(){};k.Init=function(a,b){k.width=a?a:80;k.height=b?b:25;for(var c=0;c<k.height;c++){z[c]=[];C[c]=[];for(var d=0;d<k.width;d++)z[c][d]=" ",C[c][d]=448}k.TermInit();k.TermDraw()};k.xxStateChange=function(a){3==a&&null!=c&&1==c.xterm&&k.TermSendKeys("stty rows "+k.height+" cols "+k.width+"\nclear\n")};k.ProcessData=function(b){2==k.debugmode&&console.log("TRecv("+b.length+"): "+rstr2hex(b));null!=k.capture&&(k.capture+=b);if(0==k.terminalEmulation)try{b=
|
|
decode_utf8(G+b)}catch(c){G+=b;return}G="";for(var d=0;d<b.length;d++){var q=String.fromCharCode(b.charCodeAt(d)),p=b.charCodeAt(d);switch(v){case 0:switch(p){case 27:v=1;J=[];y=D=0;break;default:a(q)}break;case 1:switch(q){case "[":v=2;break;case "(":v=4;break;case ")":v=5;break;case "]":v=6;break;case "=":H=!0;v=0;break;case ">":H=!1;v=0;break;case "7":g=B;h=n;v=0;break;case "8":B=g;n=h;v=0;break;case "M":for(p=F[1];p>=F[0]+1;p--)for(var u=0;u<k.width;u++)z[p][u]=z[p-1][u],C[p][u]=C[p-1][u];for(p=
|
|
F[0]+1-1;p>F[0]-1;p--)for(u=0;u<k.width;u++)z[p][u]=" ",C[p][u]=448;v=0;break;default:console.log("unknown terminal short code",q),v=0}break;case 2:if("0"<=q&&"9">=q){J[D]=J[D]?10*J[D]+(q-0):q-0;break}else if(";"==q){D++;break}else if("?"==q){y=1;break}else{J[0]||(J[0]=0);var p=J,u=D+1,O=y;if(1==O)switch(q){case "l":25==p[0]&&(A=!1);break;case "h":25==p[0]&&(A=!0)}else if(0==O){var K=void 0;switch(q){case "c":k.TermResetScreen();break;case "A":1==u&&(0==p[0]?n--:n-=p[0],0>n&&(n=0));break;case "B":1==
|
|
u&&(0==p[0]?n++:n+=p[0],n>k.height&&(n=k.height));break;case "C":1==u&&(0==p[0]?B++:B+=p[0],B>k.width&&(B=k.width));break;case "D":1==u&&(0==p[0]?B--:B-=p[0],0>B&&(B=0));break;case "d":1==u&&(n=p[0]-1,n>k.height&&(n=k.height),0>n&&(n=0));break;case "G":1==u&&(B=p[0]-1,0>B&&(B=0),B>k.width-1&&(B=k.width-1));break;case "P":q=1;1==u&&(q=p[0]);for(K=B;K<k.width-q;K++)z[n][K]=z[n][K+q],C[n][K]=C[n][K+q];for(K=k.width-q;K<k.width;K++)z[n][K]=" ",C[n][K]=448;break;case "L":K=1;1==u&&(K=p[0]);0==K&&(K=1);
|
|
for(p=F[1];p>=n+K;p--)z[p]=z[p-K],C[p]=C[p-K];for(p=n;p<n+K;p++)for(z[p]=[],C[p]=[],q=0;q<k.width;q++)z[p][q]=" ",C[p][q]=448;break;case "J":if(1==u&&2==p[0])k.TermClear((l<<12)+(w<<6)),n=B=0,M=[];else if(0==u||1==u&&0==p[0])for(e(),K=n+1;K<k.height;K++)r(K);else if(1==u&&1==p[0])for(e(),K=0;K<n-1;K++)r(K);break;case "H":2==u?(1>p[0]&&(p[0]=1),1>p[1]&&(p[1]=1),p[0]>k.height&&(p[0]=k.height),p[1]>k.width&&(p[1]=k.width),n=p[0]-1,B=p[1]-1):B=n=0;break;case "m":for(K=0;K<u;K++)p[K]&&0!=p[K]?1==p[K]?
|
|
8>w&&(w+=8):2==p[K]||22==p[K]?8<=w&&(w-=8):7==p[K]?m=2:27==p[K]?m=0:30<=p[K]&&37>=p[K]?(q=8<=w,w=p[K]-30,q&&8>=w&&(w+=8)):40<=p[K]&&47>=p[K]?l=p[K]-40:90<=p[K]&&99>=p[K]?w=p[K]-82:100<=p[K]&&109>=p[K]&&(l=p[K]-92):(l=0,w=7,m=0);break;case "K":if(0!=u&&(1!=u||p[0]&&0!=p[0])){if(1==u)if(1==p[0])for(p=(w<<6)+(l<<12)+m,u=0;u<B;u++)z[n][u]=" ",C[n][u]=p;else 2==p[0]&&r(n)}else e();break;case "h":x=!0;break;case "l":x=!1;break;case "r":2==u&&(F=[p[0]-1,p[1]-1]);0>F[0]&&(F[0]=0);F[0]>k.height-1&&(F[0]=k.height-
|
|
1);0>F[1]&&(F[1]=0);F[1]>k.height-1&&(F[1]=k.height-1);F[0]>F[1]&&(F[0]=F[1]);break;case "S":q=1;1==u&&(q=p[0]);for(p=F[0];p<=F[1]-q;p++)for(u=0;u<k.width;u++)z[p][u]=z[p+q][u],C[p][u]=C[p+q][u];for(p=F[1]-q+1;p<F[1];p++)for(u=0;u<k.width;u++)z[p][u]=" ",C[p][u]=448;break;case "M":q=1;1==u&&(q=p[0]);for(p=n;p<=F[1]-q;p++)for(u=0;u<k.width;u++)z[p][u]=z[p+q][u],C[p][u]=C[p+q][u];for(p=F[1]-q+1;p<F[1];p++)for(u=0;u<k.width;u++)z[p][u]=" ",C[p][u]=448;break;case "T":q=1;1==u&&(q=p[0]);for(p=F[1];p>F[0]+
|
|
q;p--)for(u=0;u<k.width;u++)z[p][u]=z[p-q][u],C[p][u]=C[p-q][u];for(p=F[0]+q;p>F[0];p--)for(u=0;u<k.width;u++)z[p][u]=" ",C[p][u]=448;break;case "X":q=1;K=B;O=n;for(1==u&&(q=p[0]);0<q&&O<k.height;)z[O][K]=" ",K++,q--,K>=k.width&&(K=0,O++);break;default:console.log("unknown terminal code",q,p,O)}}v=0}break;case 4:v=0;break;case 5:v=0;break;case 6:if(p=q.charCodeAt(0),";"==q)D++;else if(7==p){p=J;if(0!=p.length&&(u=parseInt(p[0]),(0==u||2==u)&&1<p.length&&"?"!=p[1]&&k.onTitleChange))k.onTitleChange(k,
|
|
k.title=p[1]);v=0}else J[D]=J[D]?J[D]+q:q}}k.TermDraw()};k.ProcessVt100String=function(b){for(var c=0;c<b.length;c++)a(String.fromCharCode(b.charCodeAt(c)))};var u=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,171,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,
|
|
9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160],R=[199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402,225,237,243,250,241,209,170,218,191,8976,172,189,188,161,174,187,9619,9618,9617,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,
|
|
9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9576,9560,9554,9555,9579,9578,9496,9484,9608,9604,9611,9616,9600,945,223,915,960,931,963,181,964,966,952,8486,948,8734,248,949,8719,8801,177,8805,8806,8992,8993,247,8776,176,8226,183,8730,8319,178,8718,160];k.TermClear=function(a){for(var b=0;b<k.height;b++)for(var c=0;c<k.width;c++)z[b][c]=" ",C[b][c]=a;M=[]};k.TermResetScreen=function(){m=0;w=7;l=0;x=A=!0;B=n=0;O=!1;F=[0,k.height-1];H=!1;k.TermClear(448);
|
|
G=""};k.TermSendKeys=function(a){2==k.debugmode&&console.log("TSend("+a.length+"): "+rstr2hex(a),a);k.parent&&k.parent.Send(a)};k.TermSendKey=function(a){2==k.debugmode&&console.log("TSend(1): "+rstr2hex(String.fromCharCode(a)),a);k.parent&&k.parent.Send(String.fromCharCode(a))};k.TermHandleKeys=function(a){if(!a.ctrlKey)return 127==a.which?k.TermSendKey(8):13==a.which?k.TermSendKeys(k.lineFeed):0!=a.which&&k.TermSendKey(a.which),!1;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation()};
|
|
k.TermHandleKeyUp=function(a){if(8!=a.which&&32!=a.which&&9!=a.which)return!0;a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1};k.TermHandleKeyDown=function(a){if(65<=a.which&&90>=a.which&&1==a.ctrlKey)k.TermSendKey(a.which-64),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation();else{if(27==a.which)return k.TermSendKeys(String.fromCharCode(27)),!0;if(1==H){if(37==a.which)return k.TermSendKeys(String.fromCharCode(27,79,68)),!0;if(38==a.which)return k.TermSendKeys(String.fromCharCode(27,
|
|
79,65)),!0;if(39==a.which)return k.TermSendKeys(String.fromCharCode(27,79,67)),!0;if(40==a.which)return k.TermSendKeys(String.fromCharCode(27,79,66)),!0}else{if(37==a.which)return k.TermSendKeys(String.fromCharCode(27,91,68)),!0;if(38==a.which)return k.TermSendKeys(String.fromCharCode(27,91,65)),!0;if(39==a.which)return k.TermSendKeys(String.fromCharCode(27,91,67)),!0;if(40==a.which)return k.TermSendKeys(String.fromCharCode(27,91,66)),!0}if(33==a.which)return k.TermSendKeys(String.fromCharCode(27,
|
|
91,53,126)),!0;if(34==a.which)return k.TermSendKeys(String.fromCharCode(27,91,54,126)),!0;if(35==a.which)return k.TermSendKeys(String.fromCharCode(27,91,70)),!0;if(36==a.which)return k.TermSendKeys(String.fromCharCode(27,91,72)),!0;if(45==a.which)return k.TermSendKeys(String.fromCharCode(27,91,50,126)),!0;if(46==a.which)return k.TermSendKeys(String.fromCharCode(27,91,51,126)),!0;if(9==a.which)return k.TermSendKeys("\t"),a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),!0;
|
|
var b=[80,81,119,120,116,117,113,114,112,77],c=[49,50,51,52,53,54,55,56,57,48,33,64],d=[80,81,82,83,84,85,86,87,88,89,90,91];if(111<a.which&124>a.which&&0==a.repeat){if(0==k.fxEmulation&&122>a.which)return k.TermSendKeys(String.fromCharCode(27,91,79,b[a.which-112])),!0;if(1==k.fxEmulation)return k.TermSendKeys(String.fromCharCode(27,c[a.which-112])),!0;if(2==k.fxEmulation)return k.TermSendKeys(String.fromCharCode(27,79,d[a.which-112])),!0}if(8!=a.which&&32!=a.which&&9!=a.which)return!0;k.TermSendKey(a.which);
|
|
a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}};k.recordLineTobackBuffer=function(a){var b;b=k.TermDrawLine("",a,"");a=b[0];b=b[1];M.push(a+b+"<br>")};k.TermDrawLine=function(a,b,c){for(var d,e=1,g,h=0;h<k.width;++h)switch(d=C[b][h],B==h&&n==b&&A&&(d|=2),d!=e&&(a+=c,c="",e=6,g=12,d&2&&(e=12,g=6),a+='<span style="color:#'+q[d>>e&63]+";background-color:#"+q[d>>g&63],d&1&&(a+=";text-decoration:underline"),a+=';">',c="</span>"+c,e=d),d=z[b][h],d){case "&":a+="&";
|
|
break;case "<":a+="<";break;case ">":a+=">";break;case " ":a+=" ";break;default:a+=d}return[a,c]};k.TermDraw=function(){for(var a="",b="",c=0;c<k.height;++c)a=k.TermDrawLine(b,c,a),b=a[0],a=a[1],c!=k.height-1&&(b+="<br>");800<M.length&&(M=M.slice(M.length-800));c=M.join("");k.DivElement.innerHTML='<font size="4"><b>'+c+b+a+"</b></font>";k.DivElement.scrollTop=k.DivElement.scrollHeight};k.TermInit=function(){k.TermResetScreen()};null!=c&&null!=c.width&&null!=c.height?k.Init(c.width,c.height):
|
|
k.Init();return k},ZLIB=ZLIB||{};
|
|
"undefined"===typeof ZLIB.common_initialized&&(ZLIB.Z_NO_FLUSH=0,ZLIB.Z_PARTIAL_FLUSH=1,ZLIB.Z_SYNC_FLUSH=2,ZLIB.Z_FULL_FLUSH=3,ZLIB.Z_FINISH=4,ZLIB.Z_BLOCK=5,ZLIB.Z_TREES=6,ZLIB.Z_OK=0,ZLIB.Z_STREAM_END=1,ZLIB.Z_NEED_DICT=2,ZLIB.Z_ERRNO=-1,ZLIB.Z_STREAM_ERROR=-2,ZLIB.Z_DATA_ERROR=-3,ZLIB.Z_MEM_ERROR=-4,ZLIB.Z_BUF_ERROR=-5,ZLIB.Z_VERSION_ERROR=-6,ZLIB.Z_DEFLATED=8,ZLIB.z_stream=function(){this.total_out=this.avail_out=this.next_out=this.total_in=this.avail_in=this.next_in=0;this.state=this.msg=null;
|
|
this.adler=this.data_type=0;this.output_data=this.input_data="";this.error=0;this.checksum_function=null},ZLIB.gz_header=function(){this.xflags=this.time=this.text=0;this.os=255;this.extra=null;this.extra_max=this.extra_len=0;this.name=null;this.name_max=0;this.comment=null;this.done=this.hcrc=this.comm_max=0},ZLIB.common_initialized=!0);"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js");
|
|
(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,k=a.lens,l=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,q,r,w,x,y,B,C,D,X,I,E,T,aa,da,fa,ga,U,N=Array(16);x=Array(16);for(p=0;15>=p;p++)N[p]=0;for(q=0;q<n;q++)N[k[l+q]]++;w=d;for(r=15;1<=r&&0==N[r];r--);w>r&&(w=r);if(0==r)return E={op:64,bits:1,val:0},m[c++]=E,m[c++]=E,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<r&&0==N[d];d++);w<d&&(w=d);for(p=y=1;15>=p;p++)if(y<<=1,y-=N[p],0>y)return-1;if(0<y&&
|
|
(0==b||1!=r))return a.next=c,-1;x[1]=0;for(p=1;15>p;p++)x[p+1]=x[p]+N[p];for(q=0;q<n;q++)0!=k[l+q]&&(e[x[k[l+q]]++]=q);switch(b){case 0:aa=fa=e;ga=da=0;U=19;break;case 1:aa=g;da=-257;fa=h;ga=-257;U=256;break;default:aa=v,fa=J,ga=da=0,U=-1}q=C=0;p=d;T=c;n=w;x=0;X=-1;B=1<<w;I=B-1;if(1==b&&852<=B||2==b&&592<=B)return a.next=c,1;for(;;){E={op:0,bits:p-x,val:0};e[q]<U?E.val=e[q]:e[q]>U?(E.op=fa[ga+e[q]],E.val=aa[da+e[q]]):E.op=96;y=1<<p-x;d=D=1<<n;do D-=y,m[T+(C>>>x)+D]=E;while(0!=D);for(y=1<<p-1;C&y;)y>>>=
|
|
1;0!=y?(C&=y-1,C+=y):C=0;q++;if(0==--N[p]){if(p==r)break;p=k[l+e[q]]}if(p>w&&(C&I)!=X){0==x&&(x=w);T+=d;n=p-x;for(y=1<<n;n+x<r;){y-=N[n+x];if(0>=y)break;n++;y<<=1}B+=1<<n;if(1==b&&852<=B||2==b&&592<=B)return a.next=c,1;X=C&I;m[c+X]={op:n,bits:w,val:T-c}}}0!=C&&(m[T+C]={op:64,bits:p-x,val:0});a.next=c+B;2==b?a.distbits=w:a.lenbits=w;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function e(){var a;this.total=this.check=
|
|
this.dmax=this.flags=this.havedict=this.wrap=this.last=this.mode=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.next=this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=this.distcode=this.lencode=this.extra=this.offset=this.length=this.bits=this.hold=0;this.lens=c(320);this.work=c(288);this.codes=Array(1444);var b={op:0,bits:0,val:0};for(a=0;1444>a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function r(a,b){a.state.check=a.checksum_function(a.state.check,
|
|
[b&255,b>>>8&255],0,2)}function p(a,b){b.strm=a;b.left=a.avail_out;b.next=a.next_in;b.have=a.avail_in;b.hold=a.state.hold;b.bits=a.state.bits;return b}function k(a){var b=a.strm;b.next_in=a.next;b.avail_out=a.left;b.avail_in=a.have;b.state.hold=a.hold;b.state.bits=a.bits}function q(a){a.hold=0;a.bits=0}function m(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<<a.bits;a.bits+=8;return!0}function w(a,b){for(;a.bits<b;)if(!m(a))return!1;return!0}function l(a,b){return a.hold&
|
|
(1<<b)-1}function x(a,b){a.hold>>>=b;a.bits-=b}function B(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function n(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var g=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69],v=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],J=[16,16,16,
|
|
16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ZLIB.inflate_copyright=" inflate 1.2.6 Copyright 1995-2012 Mark Adler ";ZLIB.inflateResetKeep=function(a){var b;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;b=a.state;a.total_in=a.total_out=b.total=0;a.msg=null;b.wrap&&(a.adler=b.wrap&1);b.mode=0;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=0;b.distcode=0;b.next=0;b.sane=1;b.back=-1;return ZLIB.Z_OK};ZLIB.inflateReset=function(a,b){var c,
|
|
e;if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;e=a.state;"undefined"===typeof b&&(b=15);0>b?(c=0,b=-b):(c=(b>>>4)+1,48>b&&(b&=15));a.checksum_function=1==c&&"function"===typeof ZLIB.adler32?ZLIB.adler32:2==c&&"function"===typeof ZLIB.crc32?ZLIB.crc32:d;if(b&&(8>b||15<b))return ZLIB.Z_STREAM_ERROR;e.window&&e.wbits!=b&&(e.window=null);e.wrap=c;e.wbits=b;e.wsize=0;e.whave=0;e.wnext=0;return ZLIB.inflateResetKeep(a)};ZLIB.inflateInit=function(a){var b=new ZLIB.z_stream;b.state=new e;ZLIB.inflateReset(b,
|
|
a);return b};ZLIB.inflatePrime=function(a,b,c){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a=a.state;if(0>b)return a.hold=0,a.bits=0,ZLIB.Z_OK;if(16<b||32<a.bits+b)return ZLIB.Z_STREAM_ERROR;a.hold+=(c&(1<<b)-1)<<a.bits;a.bits+=b;return ZLIB.Z_OK};var D=null,y=null,C=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];ZLIB.inflate=function(a,c){var d,e,g,h,v,u=-1,J=-1,S;if(!a||!a.state||!a.input_data&&0!=a.avail_in)return ZLIB.Z_STREAM_ERROR;d=a.state;11==d.mode&&(d.mode=12);e={};p(a,e);g=e.have;h=e.left;
|
|
S=ZLIB.Z_OK;a:for(;;)switch(d.mode){case 0:if(0==d.wrap){d.mode=12;break}if(!w(e,16))break a;if(d.wrap&2&&35615==e.hold){d.check=a.checksum_function(0,null,0,0);r(a,e.hold);q(e);d.mode=1;break}d.flags=0;null!==d.head&&(d.head.done=-1);if(!(d.wrap&1)||((l(e,8)<<8)+(e.hold>>>8))%31){a.msg="incorrect header check";d.mode=29;break}if(l(e,4)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}x(e,4);u=l(e,4)+8;if(0==d.wbits)d.wbits=u;else if(u>d.wbits){a.msg="invalid window size";d.mode=
|
|
29;break}d.dmax=1<<u;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=e.hold&512?9:11;q(e);break;case 1:if(!w(e,16))break a;d.flags=e.hold;if((d.flags&255)!=ZLIB.Z_DEFLATED){a.msg="unknown compression method";d.mode=29;break}if(d.flags&57344){a.msg="unknown header flags set";d.mode=29;break}null!==d.head&&(d.head.text=e.hold>>>8&1);d.flags&512&&r(a,e.hold);q(e);d.mode=2;case 2:if(!w(e,32))break a;null!==d.head&&(d.head.time=e.hold);d.flags&512&&(v=e.hold,a.state.check=a.checksum_function(a.state.check,
|
|
[v&255,v>>>8&255,v>>>16&255,v>>>24&255],0,4));q(e);d.mode=3;case 3:if(!w(e,16))break a;null!==d.head&&(d.head.xflags=e.hold&255,d.head.os=e.hold>>>8);d.flags&512&&r(a,e.hold);q(e);d.mode=4;case 4:if(d.flags&1024){if(!w(e,16))break a;d.length=e.hold;null!==d.head&&(d.head.extra_len=e.hold);d.flags&512&&r(a,e.hold);q(e);d.head.extra=""}else null!==d.head&&(d.head.extra=null);d.mode=5;case 5:if(d.flags&1024&&(v=d.length,v>e.have&&(v=e.have),v&&(null!==d.head&&null!==d.head.extra&&(u=d.head.extra_len-
|
|
d.length,d.head.extra+=a.input_data.substring(e.next,e.next+(u+v>d.head.extra_max?d.head.extra_max-u:v))),d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,v)),e.have-=v,e.next+=v,d.length-=v),d.length))break a;d.length=0;d.mode=6;case 6:if(d.flags&2048){if(0==e.have)break a;null!==d.head&&null===d.head.name&&(d.head.name="");v=0;do{u=a.input_data.charAt(e.next+v);v++;if("\x00"===u)break;null!==d.head&&d.length<d.head.name_max&&(d.head.name+=u,d.length++)}while(v<e.have);d.flags&
|
|
512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,v));e.have-=v;e.next+=v;if("\x00"!==u)break a}else null!==d.head&&(d.head.name=null);d.length=0;d.mode=7;case 7:if(d.flags&4096){if(0==e.have)break a;v=0;null!==d.head&&null===d.head.comment&&(d.head.comment="");do{u=a.input_data.charAt(e.next+v);v++;if("\x00"===u)break;null!==d.head&&d.length<d.head.comm_max&&(d.head.comment+=u,d.length++)}while(v<e.have);d.flags&512&&(d.check=a.checksum_function(d.check,a.input_data,e.next,v));e.have-=
|
|
v;e.next+=v;if("\x00"!==u)break a}else null!==d.head&&(d.head.comment=null);d.mode=8;case 8:if(d.flags&512){if(!w(e,16))break a;if(e.hold!=(d.check&65535)){a.msg="header crc mismatch";d.mode=29;break}q(e)}null!==d.head&&(d.head.hcrc=d.flags>>>9&1,d.head.done=1);a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=11;break;case 9:if(!w(e,32))break a;a.adler=d.check=n(e.hold);q(e);d.mode=10;case 10:if(0==d.havedict)return k(e),ZLIB.Z_NEED_DICT;a.adler=d.check=a.checksum_function(0,null,0,0);d.mode=
|
|
11;case 11:if(c==ZLIB.Z_BLOCK||c==ZLIB.Z_TREES)break a;case 12:if(d.last){B(e);d.mode=26;break}if(!w(e,3))break a;d.last=l(e,1);x(e,1);switch(l(e,2)){case 0:d.mode=13;break;case 1:v=d;u=void 0;D||(D=[{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:192},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:160},{op:0,bits:8,val:0},{op:0,bits:8,val:128},
|
|
{op:0,bits:8,val:64},{op:0,bits:9,val:224},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:144},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:208},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:176},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:240},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,
|
|
bits:8,val:116},{op:0,bits:8,val:52},{op:0,bits:9,val:200},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:168},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:232},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:152},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:216},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:184},{op:0,bits:8,
|
|
val:12},{op:0,bits:8,val:140},{op:0,bits:8,val:76},{op:0,bits:9,val:248},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:196},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:164},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:228},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:148},
|
|
{op:20,bits:7,val:67},{op:0,bits:8,val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:212},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:180},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:244},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:204},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,
|
|
bits:9,val:172},{op:0,bits:8,val:6},{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:236},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:156},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:220},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:188},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:252},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,
|
|
val:17},{op:21,bits:8,val:131},{op:18,bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:194},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:162},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:226},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:146},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:210},{op:17,bits:7,val:17},{op:0,bits:8,val:105},
|
|
{op:0,bits:8,val:41},{op:0,bits:9,val:178},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:242},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:202},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:170},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:234},{op:16,bits:7,val:8},{op:0,bits:8,
|
|
val:93},{op:0,bits:8,val:29},{op:0,bits:9,val:154},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:218},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:186},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:250},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:198},{op:17,bits:7,val:11},
|
|
{op:0,bits:8,val:99},{op:0,bits:8,val:35},{op:0,bits:9,val:166},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:230},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:150},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:214},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:182},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:246},{op:16,
|
|
bits:7,val:5},{op:0,bits:8,val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:206},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:174},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:238},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:158},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:222},
|
|
{op:18,bits:7,val:27},{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:190},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:254},{op:96,bits:7,val:0},{op:0,bits:8,val:80},{op:0,bits:8,val:16},{op:20,bits:8,val:115},{op:18,bits:7,val:31},{op:0,bits:8,val:112},{op:0,bits:8,val:48},{op:0,bits:9,val:193},{op:16,bits:7,val:10},{op:0,bits:8,val:96},{op:0,bits:8,val:32},{op:0,bits:9,val:161},{op:0,bits:8,val:0},{op:0,bits:8,val:128},{op:0,bits:8,val:64},{op:0,
|
|
bits:9,val:225},{op:16,bits:7,val:6},{op:0,bits:8,val:88},{op:0,bits:8,val:24},{op:0,bits:9,val:145},{op:19,bits:7,val:59},{op:0,bits:8,val:120},{op:0,bits:8,val:56},{op:0,bits:9,val:209},{op:17,bits:7,val:17},{op:0,bits:8,val:104},{op:0,bits:8,val:40},{op:0,bits:9,val:177},{op:0,bits:8,val:8},{op:0,bits:8,val:136},{op:0,bits:8,val:72},{op:0,bits:9,val:241},{op:16,bits:7,val:4},{op:0,bits:8,val:84},{op:0,bits:8,val:20},{op:21,bits:8,val:227},{op:19,bits:7,val:43},{op:0,bits:8,val:116},{op:0,bits:8,
|
|
val:52},{op:0,bits:9,val:201},{op:17,bits:7,val:13},{op:0,bits:8,val:100},{op:0,bits:8,val:36},{op:0,bits:9,val:169},{op:0,bits:8,val:4},{op:0,bits:8,val:132},{op:0,bits:8,val:68},{op:0,bits:9,val:233},{op:16,bits:7,val:8},{op:0,bits:8,val:92},{op:0,bits:8,val:28},{op:0,bits:9,val:153},{op:20,bits:7,val:83},{op:0,bits:8,val:124},{op:0,bits:8,val:60},{op:0,bits:9,val:217},{op:18,bits:7,val:23},{op:0,bits:8,val:108},{op:0,bits:8,val:44},{op:0,bits:9,val:185},{op:0,bits:8,val:12},{op:0,bits:8,val:140},
|
|
{op:0,bits:8,val:76},{op:0,bits:9,val:249},{op:16,bits:7,val:3},{op:0,bits:8,val:82},{op:0,bits:8,val:18},{op:21,bits:8,val:163},{op:19,bits:7,val:35},{op:0,bits:8,val:114},{op:0,bits:8,val:50},{op:0,bits:9,val:197},{op:17,bits:7,val:11},{op:0,bits:8,val:98},{op:0,bits:8,val:34},{op:0,bits:9,val:165},{op:0,bits:8,val:2},{op:0,bits:8,val:130},{op:0,bits:8,val:66},{op:0,bits:9,val:229},{op:16,bits:7,val:7},{op:0,bits:8,val:90},{op:0,bits:8,val:26},{op:0,bits:9,val:149},{op:20,bits:7,val:67},{op:0,bits:8,
|
|
val:122},{op:0,bits:8,val:58},{op:0,bits:9,val:213},{op:18,bits:7,val:19},{op:0,bits:8,val:106},{op:0,bits:8,val:42},{op:0,bits:9,val:181},{op:0,bits:8,val:10},{op:0,bits:8,val:138},{op:0,bits:8,val:74},{op:0,bits:9,val:245},{op:16,bits:7,val:5},{op:0,bits:8,val:86},{op:0,bits:8,val:22},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:118},{op:0,bits:8,val:54},{op:0,bits:9,val:205},{op:17,bits:7,val:15},{op:0,bits:8,val:102},{op:0,bits:8,val:38},{op:0,bits:9,val:173},{op:0,bits:8,val:6},
|
|
{op:0,bits:8,val:134},{op:0,bits:8,val:70},{op:0,bits:9,val:237},{op:16,bits:7,val:9},{op:0,bits:8,val:94},{op:0,bits:8,val:30},{op:0,bits:9,val:157},{op:20,bits:7,val:99},{op:0,bits:8,val:126},{op:0,bits:8,val:62},{op:0,bits:9,val:221},{op:18,bits:7,val:27},{op:0,bits:8,val:110},{op:0,bits:8,val:46},{op:0,bits:9,val:189},{op:0,bits:8,val:14},{op:0,bits:8,val:142},{op:0,bits:8,val:78},{op:0,bits:9,val:253},{op:96,bits:7,val:0},{op:0,bits:8,val:81},{op:0,bits:8,val:17},{op:21,bits:8,val:131},{op:18,
|
|
bits:7,val:31},{op:0,bits:8,val:113},{op:0,bits:8,val:49},{op:0,bits:9,val:195},{op:16,bits:7,val:10},{op:0,bits:8,val:97},{op:0,bits:8,val:33},{op:0,bits:9,val:163},{op:0,bits:8,val:1},{op:0,bits:8,val:129},{op:0,bits:8,val:65},{op:0,bits:9,val:227},{op:16,bits:7,val:6},{op:0,bits:8,val:89},{op:0,bits:8,val:25},{op:0,bits:9,val:147},{op:19,bits:7,val:59},{op:0,bits:8,val:121},{op:0,bits:8,val:57},{op:0,bits:9,val:211},{op:17,bits:7,val:17},{op:0,bits:8,val:105},{op:0,bits:8,val:41},{op:0,bits:9,
|
|
val:179},{op:0,bits:8,val:9},{op:0,bits:8,val:137},{op:0,bits:8,val:73},{op:0,bits:9,val:243},{op:16,bits:7,val:4},{op:0,bits:8,val:85},{op:0,bits:8,val:21},{op:16,bits:8,val:258},{op:19,bits:7,val:43},{op:0,bits:8,val:117},{op:0,bits:8,val:53},{op:0,bits:9,val:203},{op:17,bits:7,val:13},{op:0,bits:8,val:101},{op:0,bits:8,val:37},{op:0,bits:9,val:171},{op:0,bits:8,val:5},{op:0,bits:8,val:133},{op:0,bits:8,val:69},{op:0,bits:9,val:235},{op:16,bits:7,val:8},{op:0,bits:8,val:93},{op:0,bits:8,val:29},
|
|
{op:0,bits:9,val:155},{op:20,bits:7,val:83},{op:0,bits:8,val:125},{op:0,bits:8,val:61},{op:0,bits:9,val:219},{op:18,bits:7,val:23},{op:0,bits:8,val:109},{op:0,bits:8,val:45},{op:0,bits:9,val:187},{op:0,bits:8,val:13},{op:0,bits:8,val:141},{op:0,bits:8,val:77},{op:0,bits:9,val:251},{op:16,bits:7,val:3},{op:0,bits:8,val:83},{op:0,bits:8,val:19},{op:21,bits:8,val:195},{op:19,bits:7,val:35},{op:0,bits:8,val:115},{op:0,bits:8,val:51},{op:0,bits:9,val:199},{op:17,bits:7,val:11},{op:0,bits:8,val:99},{op:0,
|
|
bits:8,val:35},{op:0,bits:9,val:167},{op:0,bits:8,val:3},{op:0,bits:8,val:131},{op:0,bits:8,val:67},{op:0,bits:9,val:231},{op:16,bits:7,val:7},{op:0,bits:8,val:91},{op:0,bits:8,val:27},{op:0,bits:9,val:151},{op:20,bits:7,val:67},{op:0,bits:8,val:123},{op:0,bits:8,val:59},{op:0,bits:9,val:215},{op:18,bits:7,val:19},{op:0,bits:8,val:107},{op:0,bits:8,val:43},{op:0,bits:9,val:183},{op:0,bits:8,val:11},{op:0,bits:8,val:139},{op:0,bits:8,val:75},{op:0,bits:9,val:247},{op:16,bits:7,val:5},{op:0,bits:8,
|
|
val:87},{op:0,bits:8,val:23},{op:64,bits:8,val:0},{op:19,bits:7,val:51},{op:0,bits:8,val:119},{op:0,bits:8,val:55},{op:0,bits:9,val:207},{op:17,bits:7,val:15},{op:0,bits:8,val:103},{op:0,bits:8,val:39},{op:0,bits:9,val:175},{op:0,bits:8,val:7},{op:0,bits:8,val:135},{op:0,bits:8,val:71},{op:0,bits:9,val:239},{op:16,bits:7,val:9},{op:0,bits:8,val:95},{op:0,bits:8,val:31},{op:0,bits:9,val:159},{op:20,bits:7,val:99},{op:0,bits:8,val:127},{op:0,bits:8,val:63},{op:0,bits:9,val:223},{op:18,bits:7,val:27},
|
|
{op:0,bits:8,val:111},{op:0,bits:8,val:47},{op:0,bits:9,val:191},{op:0,bits:8,val:15},{op:0,bits:8,val:143},{op:0,bits:8,val:79},{op:0,bits:9,val:255}]);y||(y=[{op:16,bits:5,val:1},{op:23,bits:5,val:257},{op:19,bits:5,val:17},{op:27,bits:5,val:4097},{op:17,bits:5,val:5},{op:25,bits:5,val:1025},{op:21,bits:5,val:65},{op:29,bits:5,val:16385},{op:16,bits:5,val:3},{op:24,bits:5,val:513},{op:20,bits:5,val:33},{op:28,bits:5,val:8193},{op:18,bits:5,val:9},{op:26,bits:5,val:2049},{op:22,bits:5,val:129},{op:64,
|
|
bits:5,val:0},{op:16,bits:5,val:2},{op:23,bits:5,val:385},{op:19,bits:5,val:25},{op:27,bits:5,val:6145},{op:17,bits:5,val:7},{op:25,bits:5,val:1537},{op:21,bits:5,val:97},{op:29,bits:5,val:24577},{op:16,bits:5,val:4},{op:24,bits:5,val:769},{op:20,bits:5,val:49},{op:28,bits:5,val:12289},{op:18,bits:5,val:13},{op:26,bits:5,val:3073},{op:22,bits:5,val:193},{op:64,bits:5,val:0}]);v.lencode=0;v.distcode=512;for(u=0;512>u;u++)v.codes[u]=D[u];for(u=0;32>u;u++)v.codes[u+512]=y[u];v.lenbits=9;v.distbits=5;
|
|
d.mode=19;if(c==ZLIB.Z_TREES){x(e,2);break a}break;case 2:d.mode=16;break;case 3:a.msg="invalid block type",d.mode=29}x(e,2);break;case 13:B(e);if(!w(e,32))break a;if((e.hold&65535)!=(e.hold>>>16&65535^65535)){a.msg="invalid stored block lengths";d.mode=29;break}d.length=e.hold&65535;q(e);d.mode=14;if(c==ZLIB.Z_TREES)break a;case 14:d.mode=15;case 15:if(v=d.length){v>e.have&&(v=e.have);v>e.left&&(v=e.left);if(0==v)break a;a.output_data+=a.input_data.substring(e.next,e.next+v);a.next_out+=v;e.have-=
|
|
v;e.next+=v;e.left-=v;d.length-=v;break}d.mode=11;break;case 16:if(!w(e,14))break a;d.nlen=l(e,5)+257;x(e,5);d.ndist=l(e,5)+1;x(e,5);d.ncode=l(e,4)+4;x(e,4);if(286<d.nlen||30<d.ndist){a.msg="too many length or distance symbols";d.mode=29;break}d.have=0;d.mode=17;case 17:for(;d.have<d.ncode;){if(!w(e,3))break a;v=l(e,3);d.lens[C[d.have++]]=v;x(e,3)}for(;19>d.have;)d.lens[C[d.have++]]=0;d.next=0;d.lencode=0;d.lenbits=7;if(S=b(d,0)){a.msg="invalid code lengths set";d.mode=29;break}d.have=0;d.mode=18;
|
|
case 18:for(;d.have<d.nlen+d.ndist;){for(;;){v=d.codes[d.lencode+l(e,d.lenbits)];if(v.bits<=e.bits)break;if(!m(e))break a}if(16>v.val)x(e,v.bits),d.lens[d.have++]=v.val;else{if(16==v.val){if(!w(e,v.bits+2))break a;x(e,v.bits);if(0==d.have){a.msg="invalid bit length repeat";d.mode=29;break}u=d.lens[d.have-1];v=3+l(e,2);x(e,2)}else if(17==v.val){if(!w(e,v.bits+3))break a;x(e,v.bits);u=0;v=3+l(e,3);x(e,3)}else{if(!w(e,v.bits+7))break a;x(e,v.bits);u=0;v=11+l(e,7);x(e,7)}if(d.have+v>d.nlen+d.ndist){a.msg=
|
|
"invalid bit length repeat";d.mode=29;break}for(;v--;)d.lens[d.have++]=u}}if(29==d.mode)break;if(0==d.lens[256]){a.msg="invalid code -- missing end-of-block";d.mode=29;break}d.next=0;d.lencode=d.next;d.lenbits=9;if(S=b(d,1)){a.msg="invalid literal/lengths set";d.mode=29;break}d.distcode=d.next;d.distbits=6;if(S=b(d,2)){a.msg="invalid distances set";d.mode=29;break}d.mode=19;if(c==ZLIB.Z_TREES)break a;case 19:d.mode=20;case 20:if(6<=e.have&&258<=e.left){k(e);v=a;var P=J=u=void 0,Z=void 0,L=void 0,
|
|
W=void 0,V=void 0,K=void 0,ba=void 0,ca=void 0,X=void 0,I=void 0,E=void 0,T=void 0,aa=void 0,da=void 0,fa=void 0,ga=void 0,U=void 0,N=void 0,Y=void 0,ha=void 0,ea=-1,U=-1,u=v.state,J=v.input_data,P=v.next_in,Z=P+v.avail_in-5,L=v.next_out,W=L-(h-v.avail_out),V=L+(v.avail_out-257),K=u.wsize,ba=u.whave,ca=u.wnext,X=u.window,I=u.hold,E=u.bits,T=u.codes,aa=u.lencode,da=u.distcode,fa=(1<<u.lenbits)-1,ga=(1<<u.distbits)-1;b:do c:for(15>E&&(I+=(J.charCodeAt(P++)&255)<<E,E+=8,I+=(J.charCodeAt(P++)&255)<<E,
|
|
E+=8),U=T[aa+(I&fa)];;){N=U.bits;I>>>=N;E-=N;N=U.op;if(0==N)v.output_data+=String.fromCharCode(U.val),L++;else if(N&16){Y=U.val;if(N&=15)E<N&&(I+=(J.charCodeAt(P++)&255)<<E,E+=8),Y+=I&(1<<N)-1,I>>>=N,E-=N;15>E&&(I+=(J.charCodeAt(P++)&255)<<E,E+=8,I+=(J.charCodeAt(P++)&255)<<E,E+=8);U=T[da+(I&ga)];d:for(;;){N=U.bits;I>>>=N;E-=N;N=U.op;if(N&16){ha=U.val;N&=15;E<N&&(I+=(J.charCodeAt(P++)&255)<<E,E+=8,E<N&&(I+=(J.charCodeAt(P++)&255)<<E,E+=8));ha+=I&(1<<N)-1;I>>>=N;E-=N;N=L-W;if(ha>N){N=ha-N;if(N>ba&&
|
|
u.sane){v.msg="invalid distance too far back";u.mode=29;break b}ea=0;U=-1;ea=0==ca?ea+(K-N):ea+(ca-N);N<Y&&(Y-=N,v.output_data+=X.substring(ea,ea+N),L+=N,ea=-1,U=L-ha)}else ea=-1,U=L-ha;if(0<=ea)v.output_data+=X.substring(ea,ea+Y),L+=Y;else{N=Y;N>L-U&&(N=L-U);v.output_data+=v.output_data.substring(U,U+N);L+=N;Y-=N;U+=N;for(L+=Y;2<Y;)v.output_data+=v.output_data.charAt(U++),v.output_data+=v.output_data.charAt(U++),v.output_data+=v.output_data.charAt(U++),Y-=3;Y&&(v.output_data+=v.output_data.charAt(U++),
|
|
1<Y&&(v.output_data+=v.output_data.charAt(U++)))}}else if(0==(N&64)){U=T[da+(U.val+(I&(1<<N)-1))];continue d}else{v.msg="invalid distance code";u.mode=29;break b}break d}}else if(0==(N&64)){U=T[aa+(U.val+(I&(1<<N)-1))];continue c}else{N&32?u.mode=11:(v.msg="invalid literal/length code",u.mode=29);break b}break c}while(P<Z&&L<V);Y=E>>>3;P-=Y;E-=Y<<3;I&=(1<<E)-1;v.next_in=P;v.next_out=L;v.avail_in=P<Z?5+(Z-P):5-(P-Z);v.avail_out=L<V?257+(V-L):257-(L-V);u.hold=I;u.bits=E;p(a,e);11==d.mode&&(d.back=-1);
|
|
break}for(d.back=0;;){v=d.codes[d.lencode+l(e,d.lenbits)];if(v.bits<=e.bits)break;if(!m(e))break a}if(v.op&&0==(v.op&240)){for(u=v;;){v=d.codes[d.lencode+u.val+(l(e,u.bits+u.op)>>>u.bits)];if(u.bits+v.bits<=e.bits)break;if(!m(e))break a}x(e,u.bits);d.back+=u.bits}x(e,v.bits);d.back+=v.bits;d.length=v.val;if(0==v.op){d.mode=25;break}if(v.op&32){d.back=-1;d.mode=11;break}if(v.op&64){a.msg="invalid literal/length code";d.mode=29;break}d.extra=v.op&15;d.mode=21;case 21:if(d.extra){if(!w(e,d.extra))break a;
|
|
d.length+=l(e,d.extra);x(e,d.extra);d.back+=d.extra}d.was=d.length;d.mode=22;case 22:for(;;){v=d.codes[d.distcode+l(e,d.distbits)];if(v.bits<=e.bits)break;if(!m(e))break a}if(0==(v.op&240)){for(u=v;;){v=d.codes[d.distcode+u.val+(l(e,u.bits+u.op)>>>u.bits)];if(u.bits+v.bits<=e.bits)break;if(!m(e))break a}x(e,u.bits);d.back+=u.bits}x(e,v.bits);d.back+=v.bits;if(v.op&64){a.msg="invalid distance code";d.mode=29;break}d.offset=v.val;d.extra=v.op&15;d.mode=23;case 23:if(d.extra){if(!w(e,d.extra))break a;
|
|
d.offset+=l(e,d.extra);x(e,d.extra);d.back+=d.extra}d.mode=24;case 24:if(0==e.left)break a;v=h-e.left;if(d.offset>v){v=d.offset-v;if(v>d.whave&&d.sane){a.msg="invalid distance too far back";d.mode=29;break}v>d.wnext?(v-=d.wnext,u=d.wsize-v):u=d.wnext-v;J=-1;v>d.length&&(v=d.length)}else u=-1,J=a.next_out-d.offset,v=d.length;v>e.left&&(v=e.left);e.left-=v;d.length-=v;if(0<=u)a.output_data+=d.window.substring(u,u+v),a.next_out+=v;else{a.next_out+=v;do a.output_data+=a.output_data.charAt(J++);while(--v)}0==
|
|
d.length&&(d.mode=20);break;case 25:if(0==e.left)break a;a.output_data+=String.fromCharCode(d.length);a.next_out++;e.left--;d.mode=20;break;case 26:if(d.wrap){if(!w(e,32))break a;h-=e.left;a.total_out+=h;d.total+=h;h&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,a.output_data.length-h,h));h=e.left;if((d.flags?e.hold:n(e.hold))!=d.check){a.msg="incorrect data check";d.mode=29;break}q(e)}d.mode=27;case 27:if(d.wrap&&d.flags){if(!w(e,32))break a;if(e.hold!=(d.total&4294967295)){a.msg="incorrect length check";
|
|
d.mode=29;break}q(e)}d.mode=28;case 28:S=ZLIB.Z_STREAM_END;break a;case 29:S=ZLIB.Z_DATA_ERROR;break a;case 30:return ZLIB.Z_MEM_ERROR;default:return ZLIB.Z_STREAM_ERROR}k(e);if(d.wsize||h!=a.avail_out&&29>d.mode&&(26>d.mode||c!=ZLIB.Z_FINISH))e=a.state,v=a.output_data.length,null===e.window&&(e.window=""),0==e.wsize&&(e.wsize=1<<e.wbits),e.window=v>=e.wsize?a.output_data.substring(v-e.wsize):e.whave+v<e.wsize?e.window+a.output_data:e.window.substring(e.whave-(e.wsize-v))+a.output_data,e.whave=e.window.length,
|
|
e.wnext=e.whave<e.wsize?e.whave:0;g-=a.avail_in;h-=a.avail_out;a.total_in+=g;a.total_out+=h;d.total+=h;d.wrap&&h&&(a.adler=d.check=a.checksum_function(d.check,a.output_data,0,a.output_data.length));a.data_type=d.bits+(d.last?64:0)+(11==d.mode?128:0)+(19==d.mode||14==d.mode?256:0);(0==g&&0==h||c==ZLIB.Z_FINISH)&&S==ZLIB.Z_OK&&(S=ZLIB.Z_BUF_ERROR);return S};ZLIB.inflateEnd=function(a){if(!a||!a.state)return ZLIB.Z_STREAM_ERROR;a.state.window=null;a.state=null;return ZLIB.Z_OK};ZLIB.z_stream.prototype.inflate=
|
|
function(b,c){var d,e;this.input_data=b;this.next_in=a(c,"next_in",0);this.avail_in=a(c,"avail_in",b.length-this.next_in);d=a(c,"flush",ZLIB.Z_SYNC_FLUSH);e=a(c,"avail_out",-1);var g="";do{this.avail_out=0<=e?e:16384;this.output_data="";this.next_out=0;this.error=ZLIB.inflate(this,d);if(0<=e)return this.output_data;g+=this.output_data;if(0<this.avail_out)break}while(this.error==ZLIB.Z_OK);return g};ZLIB.z_stream.prototype.inflateReset=function(a){return ZLIB.inflateReset(this,a)}})();
|
|
"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-adler32.js");
|
|
(function(){function b(a,b,c,r){var p,k;p=a>>>16&65535;a&=65535;if(1==r)return a+=b.charCodeAt(c)&255,65521<=a&&(a-=65521),p+=a,65521<=p&&(p-=65521),a|p<<16;if(null===b)return 1;if(16>r){for(;r--;)a+=b.charCodeAt(c++)&255,p+=a;65521<=a&&(a-=65521);return a|p%65521<<16}for(;5552<=r;){r-=5552;k=347;do a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&
|
|
255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a;while(--k);a%=65521;p%=65521}if(r){for(;16<=r;)r-=16,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&
|
|
255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a,a+=b.charCodeAt(c++)&255,p+=a;for(;r--;)a+=b.charCodeAt(c++)&255,p+=a;a%=65521;p%=65521}return a|p<<16}function c(a,b,c,r){var p,k;p=a>>>16&65535;a&=65535;if(1==r)return a+=b[c],65521<=a&&(a-=65521),p+=a,65521<=p&&(p-=65521),
|
|
a|p<<16;if(null===b)return 1;if(16>r){for(;r--;)a+=b[c++],p+=a;65521<=a&&(a-=65521);return a|p%65521<<16}for(;5552<=r;){r-=5552;k=347;do a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a;while(--k);a%=65521;p%=65521}if(r){for(;16<=r;)r-=16,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=
|
|
a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a,a+=b[c++],p+=a;for(;r--;)a+=b[c++],p+=a;a%=65521;p%=65521}return a|p<<16}ZLIB.adler32=function(a,d,e,r){return"string"===typeof d?b(a,d,e,r):c(a,d,e,r)};ZLIB.adler32_combine=function(a,b,c){var r,p;if(0>c)return 4294967295;p=c%65521;c=a&65535;r=p*c%65521;c+=(b&65535)+65521-1;r+=(a>>16&65535)+(b>>16&65535)+65521-p;65521<=c&&(c-=65521);65521<=c&&(c-=
|
|
65521);131042<=r&&(r-=131042);65521<=r&&(r-=65521);return c|r<<16}})();"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-crc32.js");
|
|
(function(){function b(a,b){var c,p=0;for(c=0;b;)b&1&&(c^=a[p]),b>>=1,p++;return c}function c(a,c){var r;for(r=0;32>r;r++)a[r]=b(c,c[r])}var a=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,
|
|
3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,
|
|
476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,
|
|
3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,
|
|
1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,
|
|
1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];ZLIB.crc32=function(b,c,r,p){if("string"===typeof c){if(null==c)c=0;else{for(b^=4294967295;8<=p;)b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=
|
|
a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,b=a[(b^c.charCodeAt(r++))&255]^b>>>8,p-=8;if(p){do b=a[(b^c.charCodeAt(r++))&255]^b>>>8;while(--p)}c=b^4294967295}return c}if(null==c)c=0;else{for(b^=4294967295;8<=p;)b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&
|
|
255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,b=a[(b^c[r++])&255]^b>>>8,p-=8;if(p){do b=a[(b^c[r++])&255]^b>>>8;while(--p)}c=b^4294967295}return c};ZLIB.crc32_combine=function(a,e,r){var p,k,q,m;if(0>=r)return a;q=Array(32);m=Array(32);m[0]=3988292384;for(p=k=1;32>p;p++)m[p]=k,k<<=1;c(q,m);c(m,q);do{c(q,m);r&1&&(a=b(q,a));r>>=1;if(0==r)break;c(m,q);r&1&&(a=b(m,a));r>>=1}while(0!=r);return a^e}})();
|
|
var saveAs=saveAs||function(b){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var c=b.document.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in c,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),e=b.webkitRequestFileSystem,r=b.requestFileSystem||e||b.mozRequestFileSystem,p=function(a){(b.setImmediate||b.setTimeout)(function(){throw a;},0)},k=0,q=function(a){var c=function(){"string"===typeof a?(b.URL||b.webkitURL||b).revokeObjectURL(a):a.remove()};
|
|
b.chrome?c():setTimeout(c,500)},m=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(k){p(k)}}},w=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},l=function(l,n,g){g||(l=w(l));var h=this;g=l.type;var p=!1,x,D,y=function(){m(h,["writestart","progress","write","writeend"])},C=function(){if(D&&d&&"undefined"!==typeof FileReader){var a=
|
|
new FileReader;a.onloadend=function(){var b=a.result;D.location.href="data:attachment/file"+b.slice(b.search(/[,;]/));h.readyState=h.DONE;y()};a.readAsDataURL(l);h.readyState=h.INIT}else{if(p||!x)x=(b.URL||b.webkitURL||b).createObjectURL(l);D?D.location.href=x:void 0==b.open(x,"_blank")&&d&&(b.location.href=x);h.readyState=h.DONE;y();q(x)}},z=function(a){return function(){if(h.readyState!==h.DONE)return a.apply(this,arguments)}},O={create:!0,exclusive:!1},A;h.readyState=h.INIT;n||(n="download");if(a)x=
|
|
(b.URL||b.webkitURL||b).createObjectURL(l),c.href=x,c.download=n,setTimeout(function(){var a=new MouseEvent("click");c.dispatchEvent(a);y();q(x);h.readyState=h.DONE});else{b.chrome&&g&&"application/octet-stream"!==g&&(A=l.slice||l.webkitSlice,l=A.call(l,0,l.size,"application/octet-stream"),p=!0);e&&"download"!==n&&(n+=".download");if("application/octet-stream"===g||e)D=b;r?(k+=l.size,r(b.TEMPORARY,k,z(function(a){a.root.getDirectory("saved",O,z(function(a){var b=function(){a.getFile(n,O,z(function(a){a.createWriter(z(function(b){b.onwriteend=
|
|
function(b){D.location.href=a.toURL();h.readyState=h.DONE;m(h,"writeend",b);q(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&C()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=h["on"+a]});b.write(l);h.abort=function(){b.abort();h.readyState=h.DONE};h.readyState=h.WRITING}),C)}),C)};a.getFile(n,{create:!1},z(function(a){a.remove();b()}),z(function(a){a.code===a.NOT_FOUND_ERR?b():C()}))}),C)}),C)):C()}},x=l.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
|
|
b,c){c||(a=w(a));return navigator.msSaveOrOpenBlob(a,b||"download")};x.abort=function(){this.readyState=this.DONE;m(this,"abort")};x.readyState=x.INIT=0;x.WRITING=1;x.DONE=2;x.error=x.onwritestart=x.onprogress=x.onwrite=x.onabort=x.onerror=x.onwriteend=null;return function(a,b,c){return new l(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
|
|
"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
|
|
var version="0.8.8",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_PowerManagementService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
|
|
null,terminal,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Loading...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,desktop,desktopsettings={encflags:1,showfocus:!1,showmouse:!0,showcad:!0,limitFrameRate:!1,noMouseRotate:!1},currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar Desktop DesktopInband DesktopInbandFiles Desktop-Multi DesktopRotation Desktop-Settings DesktopType EventLog EventSubscriptions FileSaver HardwareInfo IDER IDERDebug IDERStats Inflate Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense Terminal Terminal-Enumation-All Terminal-FxEnumation-All TerminalSize VersionWarning Wireless WsmanBrowser".split(" "),
|
|
StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null;
|
|
function startup(){var b=document.getElementsByTagName("input");for(t=0;t<b.length;t++)b[t].id&&(window[b[t].id]=b[t]);urlvars=getUrlVars();for(var c in AllWsman)b=document.createElement("option"),b.text=AllWsman[c],b.id="WSB-"+AllWsman[c],Q(24).add(b);desktop=CreateAmtRedirect(CreateAmtRemoteDesktop("Desk",Q(8)));desktop.onStateChanged=onDesktopStateChange;QE("c10",!0);try{t=localStorage.getItem("desktopsettings")}catch(a){}t&&(desktopsettings=JSON.parse(t));
|
|
applyDesktopSettings();terminal=CreateAmtRedirect(CreateAmtRemoteTerminal("Term"));terminal.onStateChanged=onTerminalStateChange;Q(35).value=terminalEmulations[terminal.m.terminalEmulation];Q(32).value="\r\n"==terminal.m.lineFeed?"CR+LF":"LF";QE("c4",!0);Q("p13").addEventListener("dragover",haltEvent,!1);Q("p13").addEventListener("dragleave",haltEvent,!1);Q("p13").addEventListener("drop",terminal_FileSelectHandler,!1);document.addEventListener("dragover",
|
|
haltEvent,!1);document.addEventListener("dragleave",haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",haltEvent,!1);Q("p16").addEventListener("drop",cert_FileSelectHandler,!1);Q("Desk").toBlob||QV("c6",!1);document.onkeyup=handleKeyUp;document.onkeydown=handleKeyDown;document.onkeypress=handleKeyPress;window.onresize=center;center();scriptLoadStartingBlocks();Q("p24filetable").addEventListener("drop",
|
|
p24fileDragDrop,!1);Q("p24filetable").addEventListener("dragover",p24fileDragOver,!1);Q("p24filetable").addEventListener("dragleave",p24fileDragLeave,!1)}
|
|
function documentFileSelectHandler(b){haltEvent(b);for(var c=!0,a=0;a<b.dataTransfer.files.length;a++)0==b.dataTransfer.files[a].name.toLowerCase().endsWith(".img")&&0==b.dataTransfer.files[a].name.toLowerCase().endsWith(".iso")&&(c=!1);1==c&&null!=b.dataTransfer&&0<currentView&&100>currentView&&(1==b.dataTransfer.files.length||2==b.dataTransfer.files.length)?(a=c=null,b.dataTransfer.files[0].name.toLowerCase().endsWith(".iso")&&(a=b.dataTransfer.files[0]),b.dataTransfer.files[0].name.toLowerCase().endsWith(".img")&&
|
|
(c=b.dataTransfer.files[0]),2==b.dataTransfer.files.length&&(b.dataTransfer.files[1].name.toLowerCase().endsWith(".iso")&&(a=b.dataTransfer.files[1]),b.dataTransfer.files[1].name.toLowerCase().endsWith(".img")&&(c=b.dataTransfer.files[1])),null==c&&null==a||iderStart3(c,a,1)):null!=b.dataTransfer&&1==b.dataTransfer.files.length&&(c=null,a=b.dataTransfer.files[0].name.toLowerCase(),21==currentView?UploadToStorage(b.dataTransfer.files[0],a):(null!=wsstack&&(a.endsWith(".mescript")||a.endsWith(".meblocks"))&&
|
|
(c=script_onScriptRead),null!=c&&(a=new FileReader,a.onload=c,a.readAsBinaryString(b.dataTransfer.files[0]))))}function connectButtonfunction(){wsstack&&0!=wsstack.socketState?disconnect():meshcentral2credCallback()}function connectButtonfunctionEx(){currentMeshNode=parent.getCurrentNode();connect(currentMeshNode._id,16992,null,null,0);Q("xconnectbutton1").value="Disconnect"}function getCurrentMeshNode(){return currentMeshNode}
|
|
function setConnectionState(b){QE("xconnectbutton1",b);0==b&&disconnect()}function setFrameHeight(b){}function setAuthCallback(b){meshcentral2credCallback=b}function setUrlVar(b,c){urlvars||(urlvars={});urlvars[b]=c}function cleanup(){c3.value="Start Capture";terminal.m.capture&&delete terminal.m.capture;terminal.Stop();desktop.disconnectCode=0;desktop.Stop()}
|
|
function handleKeyUp(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(54).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyUp(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyUp(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyUp(b)}}
|
|
function handleKeyDown(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(54).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeyDown(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeyDown(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeyDown(b)}}
|
|
function handleKeyPress(b){if(!xxdialogMode){if(14==currentView&&3==desktop.State){if(Q(54).checked)return;if(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop)webRtcDesktop.softdesktop.m.handleKeys(b),desktop.m.sendKeepAlive();else return desktop.m.handleKeys(b)}if(13==currentView&&3==terminal.State)return terminal.m.TermHandleKeys(b)}}var connectFunc=null,connectFuncTag=null;
|
|
function connect(b,c,a,d,e,r,p){go(0);fullscreenonly=!1;connectFunc=r;connectFuncTag=p;1==urlvars.kvm&&go(14);if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),deskToggleFull(1==urlvars.kvmonly);1==urlvars.sol&&go(13);wsstack=WsmanStackCreateService(b,c,a,d,e);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(b=2;25>b;b++)QV("go"+b,!1);QV("go8",!0);QV("go13",!1);QV("go12",!0);QV("go20",!0);QH(30,"");QH(45,"");amtversion=amtversionmin=amtFirstPull=
|
|
0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(17,LoadingHtml);QH(21,LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(22,"");QH(18,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(23,LoadingHtml);eventmessages=null;QH(19,"");QH(20,LoadingHtml);auditLog=null;QH(55,"");
|
|
QH(56,LoadingHtml);xxCertificates=null;QH(57,LoadingHtml);QH(26,"");iderStop();xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=xxEnvironementDetection=xxRemoteAccess=null;QH(58,LoadingHtml);QH(60,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive=
|
|
!1;QH(59,LoadingHtml);QE(49,!1);QE("DeskWD",!1);QE("deskkeys",!1);urlvars.kvmviewonly&&(QE(54,!1),Q(54).checked=!0);QE(50,!1);desktopScreenInfo=null;amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(13,!1);fupdatescript()}
|
|
function disconnect(){null!=desktopPollTimer&&(clearInterval(desktopPollTimer),desktopPollTimer=null);fullscreen&&deskToggleFull();iderStop();StopDefenseStatsTimer();script_Stop();breakScriptButton();dialogclose(0);amtstack&&(amtstack.onProcessChanged=null,amtstack.CancelAllQueries(999),amtstack=null);cleanup();wsstack=null;delete amtstack;onProcessChanged(0,1);go(101);Q("xconnectbutton1").value="Connect";QH(5,"Disconnected");go(100)}
|
|
function onProcessChanged(b,c){QS(3).width=100*b/c+"%";0==b&&refreshButtons(!0);0==b&&amtstack&&(0<amtversion&&0==(amtFirstPull&64)?(amtFirstPull|=64,PullPowerPolicy(),subscriptionsFilters=null,PullEventSubscriptions(),PullWatchdog(),scriptViewButton(script_BuildingBlocks?1:0),5<amtversion&&(PullCertificates(),PullRemoteAccess())):0==(amtFirstPull&1)?PullHardware():0==(amtFirstPull&16)?PullEventLog():0==(amtFirstPull&32)&&PullAuditLog())}
|
|
function checkAmtVersion(b){var c=b.split(".");b=parseInt(c[0]);var a=parseInt(c[1]),c=parseInt(c[2]),c=1E3*a+c,d=0;5>=b||12<=b?d=1:6==b&&2061<=c?d=1:7==b&&1091<=c?d=1:8==b&&1071<=c?d=1:9==b?5>a&&1041<=c?d=1:5061<=c&&(d=1):10==b&&55<=c?d=1:11==b&&(5>a&&25<=c?d=1:6027<=c&&(d=1));return 0==d}
|
|
function processSystemVersion(b,c,a,d){if(200==d||400==d){if(200==d){amtlogicalelements=[];null!=a&&null!=a.CIM_SoftwareIdentity&&null!=a.CIM_SoftwareIdentity.responses&&(amtlogicalelements=a.CIM_SoftwareIdentity.responses,null!=a.AMT_SetupAndConfigurationService&&null!=a.AMT_SetupAndConfigurationService.response&&amtlogicalelements.push(a.AMT_SetupAndConfigurationService.response));if(0==amtlogicalelements.length){console.error("ERROR: Could not get Intel AMT version.");disconnect();return}c=getInstance(amtlogicalelements,
|
|
"AMT").VersionString}else if(c=b.wsman.comm.amtVersion,!c){errcheck(400,b);return}amtversion=parseInt(c.split(".")[0]);amtversionmin=parseInt(c.split(".")[1]);QV(13,checkAmtVersion(c));PullSystemStatus();updateSystemStatus();1!=urlvars.kvmonly&&0==fullscreenonly&&(PullUserInfo(),8<=amtversion&&PullAlarms());connectFunc&&(connectFunc(connectFuncTag),connectFuncTag=connectFunc=null);1==urlvars.kvm&&(go(14),connectDesktop());if(1==urlvars.kvmfull||1==urlvars.kvmonly)go(14),connectDesktop();
|
|
1==urlvars.sol&&(go(13),connectTerminal())}else errcheck(d,b)}var refreshButtonsState=!0;function refreshButtons(b){if(refreshButtonsState!=b){refreshButtonsState=b;for(var c=0,a=document.getElementsByTagName("input");c<a.length;c++)"refreshbtn"==a[c].name&&(a[c].disabled=!b)}}
|
|
function PullPowerState(){amtstack&&0==amtstack.GetPendingActions()&&amtsysstate&&amtsysstate.CIM_ServiceAvailableToElement&&amtstack.Enum("CIM_ServiceAvailableToElement",function(b,c,a,d){200==d&&(amtsysstate.CIM_ServiceAvailableToElement.responses=a,9<amtversion&&null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?
|
|
amtstack.Get("IPS_PowerManagementService",function(a,b,c,d){200==d&&(amtsysstate.IPS_PowerManagementService.response=c.Body,updateSystemStatus())}):updateSystemStatus())})}
|
|
function PullSystemStatus(b){refreshButtons(!1);amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime);var c=["CIM_ServiceAvailableToElement","*AMT_GeneralSettings","AMT_EthernetPortSettings","*AMT_RedirectionService","CIM_ElementSettingData"];5<amtversion&&c.push("IPS_IPv6PortSettings","*CIM_KVMRedirectionSAP","*IPS_OptInService","*IPS_KVMRedirectionSettingData");9<amtversion&&c.push("*IPS_ScreenConfigurationService","*IPS_PowerManagementService");amtstack.BatchEnum("",
|
|
c,processSystemStatus,!0);1==b&&PullWireless()}function processSystemTime(b,c,a,d){errcheck(d,b)||200!=d||(b=new Date,c=new Date,b.setTime(1E3*a.Body.Ta0+6E4*b.getTimezoneOffset()),amtdeltatime=b-c,updateSystemStatus())}var amtdeltatime,amtsysstate,amtlogicalelements,amtfeatures={};
|
|
function processSystemStatus(b,c,a,d){if(void 0==a.IPS_ScreenConfigurationService||400==a.IPS_ScreenConfigurationService.status)a.IPS_ScreenConfigurationService=null;if(void 0==a.IPS_KVMRedirectionSettingData||400==a.IPS_KVMRedirectionSettingData.status)a.IPS_KVMRedirectionSettingData=null;if(void 0==a.CIM_KVMRedirectionSAP||400==a.CIM_KVMRedirectionSAP.status)a.CIM_KVMRedirectionSAP=null;if(void 0==a.IPS_OptInService||400==a.IPS_OptInService.status)a.IPS_OptInService=null;void 0!=a.AMT_RedirectionService&&
|
|
200==a.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var e in a)null!=a[e]&&a[e].status>d&&(d=a[e].status);400!=d&&errcheck(d,b)||(amtsysstate=a,updateSystemStatus())}function syncClock(){xxdialogMode||setDialogMode(11,"Synchronize Clock",3,syncClockEx,"Synchronize Intel AMT clock with this computer?")}
|
|
function syncClockEx(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(b,c,a,d){200!=d?messagebox("","Failed to set time, status = "+d):0!=a.Body.ReturnValue?messagebox("","Failed to set time, error: "+a.Body.ReturnValueStr):(b=new Date,b=Math.round((b.getTime()-6E4*b.getTimezoneOffset())/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(a.Body.Ta0,b,b,function(){amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}))})}
|
|
var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Main bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
|
|
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var b=0,c,a,d=TableStart(),e="",r=amtsysstate.AMT_GeneralSettings.response;a="<i>Unknown</i>";null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(a=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState],9<amtversion&&"Power on"==a&&amtsysstate.IPS_PowerManagementService&&amtsysstate.IPS_PowerManagementService.response&&
|
|
3==amtsysstate.IPS_PowerManagementService.response.OSPowerSavingState&&(a="Standby (Connected)"),QH(30,a),QH(45,a));r.PowerSource&&(a+=[", Plugged-in",", On Battery"][r.PowerSource]);d+=TableEntry("Power",addLink(a,"showPowerActionDlg()"));c=r.HostName;a=r.DomainName;null!=a&&0<a.length&&(c+="."+a);c=0==c.length?"<i>None</i>":EscapeHtml(c);d+=TableEntry("Name & Domain",addLinkConditional(c,"showEditNameDlg()",xxAccountAdminName));amtstack.amtauth&&amtstack.amtauth.uuidStr?d+=
|
|
TableEntry("System ID",amtstack.amtauth.uuidStr):HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var p="",k=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==k.ProvisioningState&&5<amtversion&&(p=" activated in Admin Control Mode (ACM)",4==k.ProvisioningMode&&(p=" activated in Client Control Mode (CCM)",b=9));d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,
|
|
"InstanceID","AMT").VersionString+p)}null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&(QV(29,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState),QV(44,2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState));if(200==amtsysstate.AMT_RedirectionService.status){var q=amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,
|
|
m=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),p=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),w=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(QV("go14",!0),w=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);
|
|
q&&(e+=", Redirection Port");m&&(e+=", Serial-over-LAN");p&&(e+=", IDE-Redirect");w&&(e+=", KVM");""==e&&(e=" None");d+=TableEntry("Active Features",addLinkConditional(e.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&(p=amtsysstate.IPS_KVMRedirectionSettingData.response,e="Primary display",7<amtversion&&void 0!==p.DefaultScreen&&255>p.DefaultScreen&&(e=["Primary display","Secondary display",
|
|
"3rd display"][p.DefaultScreen]),e='<span title="'+format("The default remote display is {0}",e.toLowerCase())+'">'+e+"</span>",1==p.Is5900PortEnabled&&(e+=", Port 5900 enabled"),1==p.OptInPolicy&&(e+=", "+p.OptInPolicyTimeout+" "+(0<p.OptInPolicyTimeout?"seconds opt-in":"second opt-in")),e+=", "+p.SessionTimeout+" minute"+(0<p.SessionTimeout?"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService?((p=0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&
|
|
1))&&(e+=", Blanking Allowed"),QV(51,p),Q(52).checked=!1):QV(51,!1),d+=TableEntry("Remote Desktop",addLinkConditional(e,"showDesktopSettingsDlg()",xxAccountAdminName)));QV(27,!q||!m);QV(28,xxAccountAdminName);QV(42,!q||!w);QV(43,xxAccountAdminName);5<amtversion&&null!=amtsysstate&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(e="Unknown state",q=amtsysstate.IPS_OptInService.response.OptInRequired,
|
|
0==q&&(e="Not Required"),1==q&&(e="Required for KVM only"),4294967295==q&&(e="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&(e=addLinkConditional(e,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",e));if(null!=AmtSystemPowerSchemes)for(var e=amtsysstate.CIM_ElementSettingData.responses,l=0;l<e.length;l++)if(e[l].SettingData&&1==e[l].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==e[l].SettingData.ReferenceParameters.ResourceURI)for(q=
|
|
e[l].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,m=0;m<AmtSystemPowerSchemes.length;m++)AmtSystemPowerSchemes[m].SchemeGUID==q&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[m].Description.split(":")[1],'showPowerPolicyDlg("'+q+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",addLinkConditional((new Date((new Date).getTime()+amtdeltatime)).toLocaleString(),"syncClock()",xxAccountAdminName)));e=AddRefreshButton("PullSystemStatus()")+" ";
|
|
e+=AddButton("Power Actions...","showPowerActionDlg()")+" ";e+=AddButton("Save State...","saveEntireAmtState()")+" ";e+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(e);amtstack.amtauth&&(d+="<div style=position:absolute;top:10px;right:20px;cursor:pointer onclick=showAuthCsme()><img src=authcsme.png width=100 height=100 /></div>");QH(17,d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+
|
|
" Changing network settings may cause this page to becaume unavailable.");d=d+"<br><h2>General Settings</h2>"+TableStart();e="";"<i>None</i>"!=c&&(1==r.SharedFQDN&&(e=", shared with OS"),0==r.SharedFQDN&&(e=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(c+e,"showEditNameDlg(1)",xxAccountAdminName));c="Disabled";1==r.DDNSUpdateEnabled?c="Enabled each "+r.DDNSPeriodicUpdateInterval+" minutes, TTL is "+r.DDNSTTL+" minutes":1==r.DDNSUpdateByDHCPServerEnabled&&(c="Update by DHCP server");
|
|
d+=TableEntry("Dynamic DNS",addLinkConditional(c,"showEditDnsDlg()",xxAccountAdminName));d+=TableEnd();for(a in amtsysstate.AMT_EthernetPortSettings.responses){c=amtsysstate.AMT_EthernetPortSettings.responses[a];if(c.WLANLinkProtectionLevel||1==a)amtwirelessif=a;if(0!=a||amtwirelessif==a||"00-00-00-00-00-00"!=c.MACAddress){0==a&&b++;d+="<br><h2>"+(amtwirelessif==a?"Wireless Interface":"Wired Interface")+"</h2>";d+=TableStart();d+=TableEntry("Link state",1==c.LinkIsUp?"Link is up":"Link is down");
|
|
if(c.LinkPolicy){c.LinkPolicy=MakeToArray(c.LinkPolicy);e=[];for(l in c.LinkPolicy)1==c.LinkPolicy[l]&&e.push("S0/AC"),14==c.LinkPolicy[l]&&e.push("Sx/AC"),16==c.LinkPolicy[l]&&e.push("S0/DC"),224==c.LinkPolicy[l]&&e.push("Sx/DC");0==e.length&&e.push("");d+=TableEntry("Link policy",addLinkConditional(0==e.length?"Not available":"Available in: "+e.join(", "),"showLinkPolicyDlg("+a+")",xxAccountAdminName))}"00-00-00-00-00-00"!=c.MACAddress&&(d+=TableEntry("MAC address",c.MACAddress));amtwirelessif==
|
|
a&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Radio State",xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>None</i>")));amtwirelessif!=a&&(d+=TableEntry("Respond to ping",addLinkConditional(["Disabled","ICMP response","RMCP response","ICMP & RMCP response"][r.PingResponseEnabled+
|
|
(r.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),e=1==c.DHCPEnabled?"Automatic using DHCP server":"Static IP address",1==c.IpSyncEnabled&&(e+=", IP sync with OS"),d+=TableEntry("IPv4 state",addLinkConditional(e,"showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 address",isIpAddress(c.IPAddress,"None"));isIpAddress(c.DefaultGateway)&&(d+=TableEntry("IPv4 gateway / Mask",c.DefaultGateway+" / "+isIpAddress(c.SubnetMask,"None")));e=c.PrimaryDNS;isIpAddress(e)&&(c.SecondaryDNS&&
|
|
(e+=" / "+c.SecondaryDNS),d+=TableEntry("IPv4 domain name server",e));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){c=amtsysstate.IPS_IPv6PortSettings.responses[a];for(var q="Disabled",x,e=amtsysstate.CIM_ElementSettingData.responses,l=0;l<e.length;l++)e[l].SettingData&&e[l].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+a&&(x=1==e[l].IsCurrent);1==x&&(q=(e=isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||
|
|
isIpAddress(c.SecondaryDNS))?"Enabled, Automatic & manual addresses":"Enabled, Automatic addresses");d+=TableEntry("IPv6 state",addLinkConditional(q,"showIPv6StateDlg("+a+","+x+")",xxAccountAdminName));if(1==x){if(c.CurrentAddressInfo&&0<c.CurrentAddressInfo.length){c.CurrentAddressInfo=MakeToArray(c.CurrentAddressInfo);ipv6addr="";for(l=0;l<c.CurrentAddressInfo.length;l++)0<ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=c.CurrentAddressInfo[l].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,
|
|
"showIPv6AddrDlg("+a+',"'+c.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(c.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",c.CurrentDefaultRouter));isIpAddress(c.CurrentPrimaryDNS)&&(e=c.CurrentPrimaryDNS,isIpAddress(c.CurrentSecondaryDNS)&&(e+=" / "+c.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",e))}}d+=TableEnd()}}1!=urlvars.kvmonly&&0==fullscreenonly&&(-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless(),QH(21,
|
|
d),1==b&&0==(amtFirstPull&4)&&PullSystemDefense(),0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage());0==currentView&&go(1,1)}}function isIpAddress(b,c){return b&&null!=b&&0<b.length&&"::"!=b&&"::0"!=b?b:c}
|
|
function showLinkPolicyDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_EthernetPortSettings.responses[b],a;a=""+("<label><input type=checkbox id=d11p1 value=1 "+(0<=c.LinkPolicy.indexOf(1)?"checked":"")+">Available in S0/AC - Powered on & plugged in</label><br>");a+="<label><input type=checkbox id=d11p2 value=14 "+(0<=c.LinkPolicy.indexOf(14)?"checked":"")+">Available in Sx/AC - Sleeping & plugged in</label><br>";a+="<label><input type=checkbox id=d11p3 value=16 "+(0<=c.LinkPolicy.indexOf(16)?"checked":
|
|
"")+">Available in S0/DC - Powered on & on battery</label><br>";a+="<label><input type=checkbox id=d11p4 value=224 "+(0<=c.LinkPolicy.indexOf(224)?"checked":"")+">Available in Sx/DC - Sleeping & on battery</label><br>";setDialogMode(11,"Link Policy",3,showLinkPolicyDlgEx,a,b)}}
|
|
function showLinkPolicyDlgEx(b,c){var a=Clone(amtsysstate.AMT_EthernetPortSettings.responses[c]);a.DHCPEnabled&&(delete a.IPAddress,delete a.SubnetMask,delete a.DefaultGateway,delete a.PrimaryDNS,delete a.SecondaryDNS);a.LinkPolicy=[];Q("d11p1").checked&&a.LinkPolicy.push(1);Q("d11p2").checked&&a.LinkPolicy.push(14);Q("d11p3").checked&&a.LinkPolicy.push(16);Q("d11p4").checked&&a.LinkPolicy.push(224);amtstack.Put("AMT_EthernetPortSettings",a,showLinkPolicyDlgExDone,0,1,a)}
|
|
function showLinkPolicyDlgExDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("Link Policy",format("Unable to set new link policy, error {0}",d))}
|
|
function showAuthCsme(){if(!xxdialogMode){var b;b="<div style=margin-top:8px>Intel® AMT supports authentic CSME feature, however MeshCommander cannot verify the authenticity yet.</div><hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray />"+addHtmlValue("FW Version",amtstack.amtauth.FWVersion);b+=addHtmlValue("FQDN",amtstack.amtauth.FQDN?amtstack.amtauth.FQDN:"<i>None</i>");b+="<hr style=margin-top:8px;margin-bottom:8px;height:2px;border-width:0;color:gray;background-color:gray /><div style=max-height:200px;overflow-y:auto><table>";
|
|
for(var c in amtstack.amtauth.Certificates){var a=amtstack.amtauth.Certificates[c];b+="<tr><td style=width:32px;vertical-align:top><img src=images-commander/cert1.png height=32 width=32 />";b+="<td style=padding-bottom:6px><b>"+EscapeHtml(a.subject.getField("CN").value)+(!0===a.xTrusted?", <span style=color:#080>Trusted</span>":"")+"</b><br />";a.subject.getField("OU")&&(b+=EscapeHtml(a.subject.getField("OU").value)+"<br />");b+=amtstack.amtauth.CertificatesDer[c].length+" bytes, <a style=cursor:pointer;color:blue onclick=downloadAuthCert("+
|
|
c+")>Download</a>";a.xCrl&&(b+="<br />CRL "+a.xCrl.length+" bytes, <a style=cursor:pointer;color:blue onclick=downloadCertCrl("+c+")>Download</a>")}setDialogMode(11,"Authentic CSME",1,null,b+"</table><div>")}}function downloadCertCrl(b){b=parseInt(b);saveAs(data2blob(amtstack.amtauth.Certificates[b].xCrl),amtstack.amtauth.Certificates[b].subject.getField("CN").value+".crl")}
|
|
function downloadAuthCert(b){b=parseInt(b);saveAs(data2blob(amtstack.amtauth.CertificatesDer[b]),amtstack.amtauth.Certificates[b].subject.getField("CN").value+".cer")}var IntelAmtEntireState,IntelAmtEntireStateCalls;
|
|
function saveEntireAmtState(){if(!xxdialogMode){var b="",c=new Date;amtsysstate&&(b="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);c29.value="amtstate"+b+".json";setDialogMode(19,"Save Entire Intel® AMT State",3,saveEntireAmtStateOk)}}
|
|
function saveEntireAmtStateOk(){IntelAmtEntireState={webappversion:version,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()};QH(66,"Fetching entire state, please wait...");setDialogMode(1,"Save Entire Intel® AMT State",0,null);IntelAmtEntireStateCalls=3;amtstack.BatchEnum(null,AllWsman,saveEntireAmtStateOk2,null,!0);amtstack.GetAuditLog(saveEntireAmtStateOk3);amtstack.GetMessageLog(saveEntireAmtStateOk4)}
|
|
function saveEntireAmtStateOk2(b,c,a,d){IntelAmtEntireState.wsmanenums=a;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(b,c){IntelAmtEntireState.auditlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(b,c){IntelAmtEntireState.eventlog=c;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c29.value))}
|
|
function showDesktopSettingsDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_KVMRedirectionSettingData.response,c;c="<div style=text-align:left><div style=height:26px;margin-top:4px><select id=subddisplay style=float:right;width:200px><option value=0>Primary display</option><option value=1>Secondary display</option>";9<amtversion&&(c+="<option value=2>3rd display</option>");c+='</select><div style=padding-top:4px>Default display</div></div><div style=height:26px;margin-top:4px><input id=subsessiontimeout style=float:right;width:200px maxlength=5 onkeypress="return numbersOnly(event)"><div style=padding-top:4px>Session timeout (Minutes)</div></div>';
|
|
1==b.OptInPolicy&&(c+='<div style=height:26px;margin-top:4px><input id=suboptintimeout style=float:right;width:200px maxlength=5 onkeypress="return numbersOnly(event)"><div style=padding-top:4px>Opt-in timeout (Seconds)</div></div>');c+="<div style=height:26px;margin-top:4px><select id=subdlegacy style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Disabled, Recommended</option><option value=1>Enabled, Legacy KVM viewers</option></select><div style=padding-top:4px>Port 5900</div></div>";
|
|
c+="<div style=height:26px;margin-top:4px id=subspassx><input id=subspass type=password autocomplete=off style=float:right;width:200px maxlength=8 onkeyup=showDesktopSettingsDlgUpdate()><div style=padding-top:4px>5900 password (8 chars)</div></div>";9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(c+='<div style=height:26px;margin-top:4px><select id=subsb style=float:right;width:200px onchange=showDesktopSettingsDlgUpdate()><option value=0>Disabled</option><option value=1>Enabled</option></select><div style=padding-top:4px title="This feature is not often supported">Screen Blanking</div></div>');
|
|
c+="</div>";setDialogMode(11,"Remote Desktop Settings",3,showDesktopSettingsDlgOk,c);Q("subddisplay").value=b.DefaultScreen;Q("subsessiontimeout").value=b.SessionTimeout;1==b.OptInPolicy&&(Q("suboptintimeout").value=b.OptInPolicyTimeout);Q("subdlegacy").value=1==b.Is5900PortEnabled?1:0;9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&(Q("subsb").value=amtsysstate.IPS_ScreenConfigurationService.response.EnabledState);showDesktopSettingsDlgUpdate()}}
|
|
function showDesktopSettingsDlgUpdate(){QV("subspassx",1==Q("subdlegacy").value);var b=(0==Q("subdlegacy").value||8==Q("subspass").value.length||0==Q("subspass").value.length)&&0<Q("subsessiontimeout").value.length;1==amtsysstate.IPS_KVMRedirectionSettingData.response.OptInPolicy&&0==Q("suboptintimeout").value.length&&(b=!1);QE("c49",b)}
|
|
function showDesktopSettingsDlgOk(){var b=Clone(amtsysstate.IPS_KVMRedirectionSettingData.response);b.DefaultScreen=Q("subddisplay").value;b.SessionTimeout=Q("subsessiontimeout").value;b.Is5900PortEnabled=1==Q("subdlegacy").value;1==b.OptInPolicy&&(b.OptInPolicyTimeout=Q("suboptintimeout").value);1==b.Is5900PortEnabled&&(b.RFBPassword=Q("subspass").value);amtstack.Put("IPS_KVMRedirectionSettingData",b,showDesktopSettingsDlgOk2);b=Clone(amtsysstate.IPS_ScreenConfigurationService.response);b.EnabledState=
|
|
parseInt(Q("subsb").value);amtstack.Put("IPS_ScreenConfigurationService",b,showDesktopSettingsDlgOk3)}function showDesktopSettingsDlgOk2(b,c,a,d){200==d?PullSystemStatus():messagebox("Remote Desktop Settings",format("Error {0}, unable to set values.",d))}
|
|
function showDesktopSettingsDlgOk3(b,c,a,d){200!=d?messagebox("Error",format("Screen Blanking could not be set, blanking may not be supported on this system ({0}).",d)):amtstack.Get("IPS_ScreenConfigurationService",function(a,b,c,d){200==d&&(amtsysstate.IPS_ScreenConfigurationService.response=c.Body,updateSystemStatus())},0,1)}function PullEventLog(b){1==b&&xxdialogMode||(amtFirstPull|=16,amtstack.Enum("AMT_MessageLog",processMessageLog0),amtstack.GetMessageLog(processMessageLog1))}
|
|
var processMessageLog0responses=null;
|
|
function processMessageLog0(b,c,a,d){200==d&&(d&&QV("go6",!0),a&&(processMessageLog0responses=a),b="",c="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>",null!=processMessageLog0responses&&(b=1==processMessageLog0responses[0].IsFrozen?AddButton("Un-freeze Log","FreezeLog(0)"):AddButton("Freeze Log","FreezeLog(1)")),c+=TableEnd('<div style=float:right><input id=eventFilter placeholder="Filter" style=margin:4px onkeyup=eventFilter()> </div><div> '+AddRefreshButton("PullEventLog(1)")+
|
|
AddButton("Clear Log","ClearLog()")+AddButton("Save...","SaveEventLog()")+b),QH(19,c+"<br>"))}function SaveEventLog(){xxdialogMode||null==eventmessages||SaveJsonFile("IntelAmtEventlog","events","Intel AMT Event Log",eventmessages)}var eventmessages=null;
|
|
function processMessageLog1(b,c){eventmessages=c;var a,d=0,e;e="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:90px><b> Event</b><td class=r1 style=width:110px><b>Time</b><td class=r1 style=width:160px><b>Source</b><td class=r1><b>Description</b>";for(a in c){d++;var r=1,p=c[a];8<=p.EventSeverity&&(r=2);16<=p.EventSeverity&&(r=3);e+="<tr id=xamtevent"+a+" class=r3 onclick=showEventDetails("+
|
|
a+")><td class=r1><p><div class=icon"+r+" style=display:block;float:left;margin-left:5px;margin-right:5px></div>"+(parseInt(a)+1)+'<td class=r1 title="'+p.Time.toLocaleString()+'">'+p.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>"+p.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+p.EntityStr.replace("(r)","®")+"<td class=r1>"+p.Desc}e+=TableEnd(0==d?" ":"");QH(20,e+"<br>");processMessageLog0()}
|
|
function FreezeLog(b){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(b,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(b){xxdialogMode||(QH(66,"Clear event log?"),setDialogMode(1,"Event Log",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(b,c,a,d){200!=d?messagebox("Event Log","Unable to clear, Error: "+d):PullEventLog()})}
|
|
function showEventDetails(b){if(!xxdialogMode){var c=eventmessages[b],a;a="<div style=text-align:left>"+addHtmlValue("Time",c.Time.toLocaleString());a+=addHtmlValue("Source",c.EntityStr.replace("(r)","®"));a+=addHtmlValue("Description",c.Desc);a+=MoreStart();a+=addHtmlValue("Device Address",c.DeviceAddress);a+=addHtmlValue("Entity",c.Entity);a+=addHtmlValue("Entity Instance",c.EntityInstance);var d="",e;for(e in c.EventData)0<d.length&&(d+=","),d+=c.EventData[e];a+=addHtmlValue("Data",d);a+=addHtmlValue("Offset",
|
|
c.EventOffset);a+=addHtmlValue("Sensor Type",c.EventSensorType);a+=addHtmlValue("Severity",c.EventSeverity);a+=addHtmlValue("Source Type",c.EventSourceType);a+=addHtmlValue("Type",c.EventType);a+=addHtmlValue("Sensor Number",c.SensorNumber);a+=MoreEnd();a+="</div>";messagebox(format("Event #{0} Details",b+1),a)}}
|
|
function eventFilter(){var b=Q("eventFilter").value.toLowerCase(),c;for(c in eventmessages)QV("xamtevent"+c,""==b||0<=eventmessages[c].Desc.toLowerCase().indexOf(b)||0<=eventmessages[c].EntityStr.toLowerCase().indexOf(b))}var subscriptionsFilters=null,subscriptionsListeners=null;
|
|
function PullEventSubscriptions(){null==subscriptionsFilters&&amtstack.Enum("CIM_FilterCollection",processEventSubscriptions0);amtstack.BatchEnum(null,["CIM_ListenerDestination","CIM_FilterCollectionSubscription"],processEventSubscriptions1)}function processEventSubscriptions0(b,c,a,d){408!=d&&400!=d&&(d&&errcheck(d,b)||(subscriptionsFilters=a))}
|
|
function processEventSubscriptions1(b,c,a,d){if(!(408==d||400==d||d&&errcheck(d,b))){d&&QV("go22",!0);a&&(subscriptionsListeners=a);c=0;b=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage event subscribers.<br><br>";for(var e in subscriptionsListeners.CIM_ListenerDestination.responses)a=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[e].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),d=subscriptionsListeners.CIM_ListenerDestination.responses[e],
|
|
b+='<div class=itemBar onclick="showSubscriptionDetails('+e+')"><div style=float:right></div><div style=padding-top:3px;overflow-x:hidden title="'+a+" - "+d.Destination+'"><b>'+a+"</b> - "+d.Destination+"</div><div style=padding-top:3px></div></div>",c++;0==c&&(b+="<div style=padding-left:15px><br><i>No subscriptions found.</i></div><br>");e="<div> "+AddRefreshButton("PullEventSubscriptions()");xxAccountAdminName&&(e+=AddButton("New Subscription","newSubscriptionButton()"));b+="<br><td class=r1>"+
|
|
TableEnd(e+"</div>");QH(62,b)}}var subscriptionDeliveryModes={2:"Push",3:"Push with ACK",4:"Events",5:"Pull"};
|
|
function showSubscriptionDetails(b){if(!xxdialogMode){var c=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[b].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),a=subscriptionsListeners.CIM_ListenerDestination.responses[b],d;d="<div style=text-align:left>"+addHtmlValue("Destination",a.Destination);d+=addHtmlValue("Filter",c);d+=addHtmlValue("Delivery Mode",subscriptionDeliveryModes[a.DeliveryMode]);setDialogMode(11,"Subscription "+(b+1),xxAccountAdminName?
|
|
5:1,deleteSubscriptionButton,d+"</div>",b)}}
|
|
function deleteSubscriptionButton(b,c){2==b&&amtstack.UnSubscribe("CIM_FilterCollectionSubscription",PullEventSubscriptions,null,1,{Filter:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_FilterCollection</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+subscriptionsListeners.CIM_FilterCollectionSubscription.responses[c].Filter.ReferenceParameters.SelectorSet.Selector.Value+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>",
|
|
Handler:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ListenerDestinationWSManagement</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_ListenerDestinationWSMAN</w:Selector><w:Selector Name="Name">'+subscriptionsListeners.CIM_ListenerDestination.responses[c].Name+'</w:Selector><w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector><w:Selector Name="SystemName">Intel(r) AMT</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>'})}
|
|
function newSubscriptionButton(){if(!xxdialogMode&&null!=subscriptionsFilters){var b;b="<div style=height:26px;margin-top:4px><select id=subtype style=float:right;width:260px><option value=Push>Push</option><option value=PushWithAck>Push with ACK</option></select><div style=padding-top:4px>Type</div></div><div style=height:26px;margin-top:4px><select id=subfilter style=float:right;width:260px>";for(var c in subscriptionsFilters)b+='<option value="'+subscriptionsFilters[c].InstanceID+'">'+subscriptionsFilters[c].CollectionName.substring(13)+
|
|
"</option>";b+="</select><div style=padding-top:4px>Filter</div></div>";b+='<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value="http://"><div style=padding-top:4px>URL</div></div>';b+="<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>None</option><option value=1>Digest</option></select><div style=padding-top:4px>Authentication</div></div>";
|
|
b+="<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Username</div></div>";b+="<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Password</div></div>";b+="<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>Arguments</div></div>";
|
|
setDialogMode(11,"Add Event Subscription",3,newSubscriptionButtonOk,b);newSubscriptionUpdate()}}function newSubscriptionUpdate(){QE("c49",0<Q("suburl").value.length&&Q("suburl").value.startsWith("http://")&&(0==Q("subauth").value||0<Q("subuser").value.length&&0<Q("subpass").value.length));QV("subxuser",1==Q("subauth").value);QV("subxpass",1==Q("subauth").value)}
|
|
function newSubscriptionButtonOk(){var b=0==Q("subuser").value.length?void 0:Q("subuser").value,c=0==Q("subpass").value.length?void 0:Q("subpass").value;amtstack.Subscribe("CIM_FilterCollection",Q("subtype").value,Q("suburl").value,newSubscriptionButtonOk2,null,1,{InstanceID:Q("subfilter").value},0<Q("subargs").value.length?Q("subargs").value:null,b,c)}function newSubscriptionButtonOk2(b,c,a,d){200==d&&PullEventSubscriptions()}
|
|
function PullAuditLog(b){1==b&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";");
|
|
function processAuditLog0(b,c,a,d){200==d&&(QV("go15",!0),c=a[0].AuditState,b=c&1?"Disabled":"Enabled",c&2&&(b+=", Locked"),c&4&&(b+=", Almost Full"),c&8&&(b+=", Full"),c&16&&(b+=", NoKey"),c="<h1>Audit Log Settings</h1>"+TableStart(),c+=TableEntry("State",b),c+=TableEntry("Storage",a[0].CurrentNumberOfRecords+" record(s), "+a[0].PercentageFree+"% free"),c+=TableEntry("Overwrite policy",2==a[0].OverwritePolicy?"Wraps when full":"Never overwrites"),c+=TableEnd(),QH(55,c),amtstack.GetAuditLog(processAuditLog1))}
|
|
function processAuditLog1(b,c){auditLog=c;var a,d;d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+(TableEnd('<div style=float:right><input id=auditFilter placeholder="Filter" style=margin:4px onkeyup=auditFilter()> </div><div> '+AddRefreshButton("PullAuditLog(1)")+AddButton("Save...","SaveAuditLog()")+AddButton("Clear Log","ClearAuditLog()"))+"<br>");if(0==c.length)d="No audit log events found.";else{var e=0;d+="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:110px> <b>Time</b><td class=r1 style=width:260px><b>Initiator</b><td class=r1><b>Action</b>";
|
|
for(a in c){var r=c[a],p=r.AuditApp,k=r.Initiator;e++;var q="";0<r.NetAddress.length&&(q=r.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));r.Event&&(p+=", "+r.Event);null!=r.ExStr&&(p+=", "+r.ExStr);""!=k&&""!=q&&(k+=", ");d+="<tr id=xamtaudit"+a+" class=r3 onclick=showAuditDetails("+a+')><td class=r1 title="'+r.Time.toLocaleString()+'"> '+r.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br> "+r.Time.toLocaleTimeString("en",
|
|
{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+k+q+"<td class=r1>"+p}d+=TableEnd(0==e?" ":"")+"<br>"}QH(56,d)}function auditFilter(){var b=Q("auditFilter").value.toLowerCase(),c;for(c in auditLog)QV("xamtaudit"+c,""==b||0<=JSON.stringify(auditLog[c]).toLowerCase().indexOf(b))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
|
|
function ClearAuditLog(b){QH(66,"Clear audit log?");setDialogMode(1,"Audit Log",3,ClearAuditLogEx)}function ClearAuditLogEx(){var b=amtstack.AMT_AuditLog_SetAuditLock(1,0,b,function(){amtstack.AMT_AuditLog_ClearLog(function(){amtstack.AMT_AuditLog_SetAuditLock(0,2,b,function(){setTimeout(PullAuditLog,1E3)})})})}function ShowAuditLogSettings(){xxdialogMode||amtstack.AMT_AuditLog_RequestStateChange(2,0,AuditLogSettingsCompleted)}
|
|
function AuditLogSettingsCompleted(b,c,a,d){200==d?PullAuditLog():messagebox("Audit Log","Error: "+d)}
|
|
function showAuditDetails(b){if(!xxdialogMode){var c,a=auditLog[b],d;d="<div style=text-align:left>"+addHtmlValue("Time",a.Time.toLocaleString());""!=a.Initiator&&(d+=addHtmlValue("Initiator",a.Initiator));""!=a.NetAddress&&(d+=addHtmlValue("Address",a.NetAddress));d+=addHtmlValue("Application",a.AuditApp);d+=addHtmlValue("Event",a.Event);if(null!=a.ExStr)d+=addHtmlValue("Extended Data",a.ExStr);else if(0<a.Ex.length){var e="";for(c in a.Ex)0<e.length&&(e+=","),e+=a.Ex.charCodeAt(c);""!=e&&(d+=addHtmlValue("Data Values",
|
|
e));2<a.Ex.length&&ReadShort(a.Ex,0)==a.Ex.length-2&&(d+=addHtmlValue("Data String",a.Ex.substring(2)))}messagebox("Audit Event #"+(b+1)+" Details",d+"</div>")}}var xxCertificates=null,xxCertPrivateKeys=null,xxTlsSettings=null,xxTlsCurrentCert=null,xxTLSCredentialContext=null,xxCaPrivateKey=null,xxCaSubjectAttributes=null;function PullCertificates(){amtstack.BatchEnum(null,["AMT_PublicKeyCertificate","AMT_PublicPrivateKeyPair","AMT_TLSSettingData","AMT_TLSCredentialContext"],processCerts1)}
|
|
function processCerts1(b,c,a,d){if(400!=d&&!errcheck(d,b)){QV("go16",!0);xxCertificates=a.AMT_PublicKeyCertificate.responses;xxCertPrivateKeys=a.AMT_PublicPrivateKeyPair.responses;xxTlsSettings=a.AMT_TLSSettingData.responses;xxTLSCredentialContext=a.AMT_TLSCredentialContext.responses;xxTlsCurrentCert=null;if(0<xxTLSCredentialContext.length){b=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value;for(var e in xxCertificates)xxCertificates[e].InstanceID==b&&(xxTlsCurrentCert=
|
|
e)}for(e in xxCertificates)xxCertificates[e].TrustedRootCertficate=1==xxCertificates[e].TrustedRootCertficate,xxCertificates[e].X509Certificate=window.atob(xxCertificates[e].X509Certificate),xxCertificates[e].XIssuer=parseCertName(xxCertificates[e].Issuer),xxCertificates[e].XSubject=parseCertName(xxCertificates[e].Subject);amtcert_linkCertPrivateKey(xxCertificates,xxCertPrivateKeys);updateCertificates()}}
|
|
function parseCertName(b){var c={},a=b.split(","),d;for(d in a)b=a[d].indexOf("="),c[a[d].substring(0,b)]=a[d].substring(b+1);return c}
|
|
function getTlsSecurityState(b){if(0==xxTlsSettings[b].Enabled)return"Disabled";var c=(1==xxTlsSettings[b].MutualAuthentication?"Mutual-auth TLS":"Server-auth TLS")+(1==xxTlsSettings[b].AcceptNonSecureConnections?" and non-TLS":"");1==xxTlsSettings[b].MutualAuthentication&&xxTlsSettings[b].TrustedCN&&(b=MakeToArray(xxTlsSettings[b].TrustedCN),0<b.length&&(c+=", "+(1<b.length?"Trusted names":"Trusted name")+": "+b.join(", ")+"."));return c}
|
|
function updateCertificates(){if(null!=xxCertificates){var b="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,c=1-b,a=TableStart(),a=a+TableEntry("Remote TLS security",addLinkConditional(getTlsSecurityState(c),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEntry("Local TLS security",addLinkConditional(getTlsSecurityState(b),"showSetTlsSecurityDlg()",xxAccountAdminName)),a=a+TableEnd(),a=a+("<br>"+TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT certificates for this computer.<br><br>");
|
|
if(0==xxCertificates.length&&0==xxCertPrivateKeys.length)a+="<div style=padding-left:15px><br><i>No certificates found.</i></div><br>";else{for(var d in xxCertificates)b="",xxCertificates[d].TrustedRootCertficate&&(b=", Trusted Root"),xxCertificates[d].XPrivateKey&&(b=", Private Key"),d==xxTlsCurrentCert&&(b+=", TLS cert"),a+="<div class=itemBar onclick=showCertDetails("+d+")><div style=padding-top:3px><b>"+EscapeHtml(xxCertificates[d].XSubject.CN)+"</b><i>"+b+"</i></div></div>";for(d in xxCertPrivateKeys)xxCertPrivateKeys[d].XCert||
|
|
(a+="<div class=itemBar onclick=showKeyPairDetails("+d+")><div style=padding-top:3px><i>Unassigned Private Key Pair #"+d+"</i></div></div>")}d=AddRefreshButton("PullCertificates()");xxAccountAdminName&&(d+=AddButton("Add Certificate...","addCertButton()")+AddButton("Issue Certificate...","issueCertButton()"));a+="<br><td class=r1>"+TableEnd(d);QH(57,a)}}
|
|
function showKeyPairDetails(b){setDialogMode(11,"Key Pair #"+b,5,function(c){2==c&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertPrivateKeys[b].InstanceID},PullCertificates,0,1)},"This is a public/private certificate key pair that does not belong to any certificates. This entry should be temporary.")}var xxCertSubjectNames={CN:"Common Name",O:"Organization",OU:"Org Unit",S:"State/Province",ST:"State/Province",L:"Locality",C:"Country",SN:"Surname",GN:"Given name"};
|
|
function showCertDetails(b){if(!xxdialogMode){var c=xxCertificates[b],a;a="<br>"+addHtmlValue("Certificate",c.X509Certificate.length+" bytes, <a style=cursor:pointer;color:blue onclick=downloadCert("+b+")>Download</a>");a+=addHtmlValue("Trusted root",c.TrustedRootCertficate?"Yes":"No");0==c.TrustedRootCertficate&&c.XPrivateKey&&(a+=addHtmlValue("Private key","Present"));a+='<br><div style="border-bottom:1px solid gray"><i>Certificate Subject</i></div><br>';for(var d in c.XSubject)c.XSubject[d]&&(a+=
|
|
addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XSubject[d])));a+='<br><div style="border-bottom:1px solid gray"><i>Issuer Certificate</i></div><br>';for(d in c.XIssuer)c.XIssuer[d]&&(a+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(c.XIssuer[d])));setDialogMode(11,"Certificate - "+EscapeHtml(c.XSubject.CN),5,function(a){2==a&&(xxCertificates[b].XPrivateKey&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertificates[b].XPrivateKey.InstanceID},
|
|
function(){},0,1),amtstack.Delete("AMT_PublicKeyCertificate",xxCertificates[b],certificateRemoved,0,1))},a)}}function downloadCert(b){saveAs(data2blob(xxCertificates[b].X509Certificate),xxCertificates[b].XSubject.CN+".cer")}function cert_FileSelectHandler(b){haltEvent(b);1==b.dataTransfer.files.length&&(b.dataTransfer.files[0].name.toLowerCase().endsWith(".p12")?issueCertButton(b.dataTransfer.files):addCertButton(b.dataTransfer.files))}var xxDragDropCertFiles=null;
|
|
function addCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b='<input id=certopen onchange=addCertButtonUpdate() type=file style=float:right;width:260px accept=".cer,.pem">',xxDragDropCertFiles&&(b='<input style=float:right;width:260px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b="<div style=height:10px></div>"+("<div style=height:26px;margin-top:4px>"+b+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><select id=certtype style=float:right;width:260px><option value=1>Trusted Root Certificate</option><option value=0>Chain Certificate</option></select><div style=padding-top:4px>Certificate type</div></div>",
|
|
setDialogMode(11,"Add Certificate",3,addCertButtonOk,b),addCertButtonUpdate())}function addCertButtonUpdate(){var b=getInputElement("certopen");QE("c49",!b||1==b.files.length||2==Q("certoptype").value)}function addCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length&&(b=new FileReader,b.onload=addCertButtonOk2,b.readAsBinaryString(c[0]))}
|
|
function addCertButtonOk2(b){b=b.target.result;var c=b.indexOf("-----BEGIN CERTIFICATE-----");0<=c?(b=b.substring(c+27),c=b.indexOf("-----END CERTIFICATE-----"),0<=c&&(b=b.substring(0,c)),b=b.replace(/\r\n/g,"")):b=btoa(b);1==getSelectElement("certtype").value?amtstack.AMT_PublicKeyManagementService_AddTrustedRootCertificate(b,certificateAdded):amtstack.AMT_PublicKeyManagementService_AddCertificate(b,certificateAdded)}
|
|
function issueCertButton(b){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=b,b='<input id=certopen type=file style=float:right;width:230px onchange=issueCertButtonUpdate() accept=".p12">',xxDragDropCertFiles&&(b='<input style=float:right;width:230px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),b=""+("<div styleheight:26px;margin-top:14px>"+b+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certopenpass type=password autocomplete=off style=float:right;width:230px><div style=padding-top:4px>Certificate password</div></div>",
|
|
b+='<br><div style="border-bottom:1px solid gray"><i>Intel® AMT Certificate</i></div>',b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certcn style=float:right;width:230px><div style=padding-top:4px>Common Name</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certo style=float:right;width:230px><div style=padding-top:4px>Organization</div></div>",b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certst style=float:right;width:230px><div style=padding-top:4px>State/Province</div></div>",
|
|
b+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certc style=float:right;width:230px><div style=padding-top:4px>Country</div></div>",b+='<div>Certificate Usages</div><ul style="list-style-type:none;height:100px;overflow:auto;width:100%;border: 1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">',b+="<li><label><input type=checkbox id=d11_cu4 checked>TLS Server (HTTPS)</label></li>",b+="<li><label><input type=checkbox id=d11_cu5>TLS Client (HTTPS)</label></li>",
|
|
b+="<li><label><input type=checkbox id=d11_cu6>Email Protection</label></li>",b+="<li><label><input type=checkbox id=d11_cu7>Code Signing</label></li>",b+="<li><label><input type=checkbox id=d11_cu8>Time Stamp</label></li>",b+="</ul>",setDialogMode(11,"Issue Certificate",3,issueCertButtonOk,b),issueCertButtonUpdate())}
|
|
function issueCertButtonUpdate(){var b=getInputElement("certopen");QE("certopenpass",!b||b&&1==b.files.length);var c=!b||2>b.files.length;1==(!b||b&&b.files.length)&&""==Q("certopenpass").value&&(c=!1);if(""==getInputElement("certcn").value||""==getInputElement("certo").value||""==getInputElement("certst").value||""==getInputElement("certc").value)c=!1;QE("c49",c)}
|
|
function issueCertButtonOk(){var b=getInputElement("certopen"),c=xxDragDropCertFiles;b&&(c=b.files);c&&1==c.length?(b=new FileReader,b.onload=issueCertButtonOk2,b.readAsBinaryString(c[0])):issueCertButtonOk3(null)}function issueCertButtonOk2(b){0==amtcert_loadP12File(b.target.result,Q("certopenpass").value,issueCertButtonOk3)&&messagebox("Issue Certificate","Unable to decrypt/decode certificate.")}
|
|
function issueCertButtonOk3(b,c,a){xxCaPrivateKey=b;xxCaSubjectAttributes=c;amtstack.AMT_PublicKeyManagementService_GenerateKeyPair(0,2048,GenerateKeyPairResponse)}
|
|
function GenerateKeyPairResponse(b,c,a,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):0!=a.Body.ReturnValue?messagebox("Issue Certificate","Failed to generate key pair, "+a.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,a.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)}
|
|
function GenerateKeyPairResponse2(b,c,a,d,e){if(200!=d)messagebox("Issue Certificate","Failed to generate key pair. Status: "+d);else{b=null;for(var r in a)a[r].InstanceID==e&&(b=a[r].DERKey);a={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};e={CN:"Untrusted Root Certificate"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(r in e={},xxCaSubjectAttributes)e[xxCaSubjectAttributes[r].shortName]=xxCaSubjectAttributes[r].value;
|
|
r={name:"extKeyUsage"};Q("d11_cu4").checked&&(r.serverAuth=!0);Q("d11_cu5").checked&&(r.clientAuth=!0);Q("d11_cu6").checked&&(r.emailProtection=!0);Q("d11_cu7").checked&&(r.codeSigning=!0);Q("d11_cu8").checked&&(r.timeStamping=!0);r=amtcert_signWithCaKey(b,xxCaPrivateKey,a,e,r);null==r?messagebox("Issue Certificate","Unable to sign certificate."):(r=forge.pki.certificateToPem(r).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(r.substring(27,r.length-25),GenerateKeyPairResponse4))}}
|
|
function GenerateKeyPairResponse4(b,c,a,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):PullCertificates()}function certificateAdded(b,c,a,d){200!=d||0!=a.Body.ReturnValue?messagebox("Add Certificate","Unable to add certificate, error "+(200!=d?d:a.Body.ReturnValueStr)):PullCertificates()}function certificateRemoved(b,c,a,d){200!=d?messagebox("Remove Certificate","Unable to remove certificate, error "+d):PullCertificates()}
|
|
function getInputElement(b){var c=document.getElementsByTagName("input");for(t=0;t<c.length;t++)if(c[t].id==b)return c[t]}function getSelectElement(b){var c=document.getElementsByTagName("select");for(t=0;t<c.length;t++)if(c[t].id==b)return c[t]}
|
|
function showSetTlsSecurityDlg(b){if(!xxdialogMode){b="<div style=height:26px;margin-top:4px><select onchange=showSetTlsSecurityDlgUpdate() id=tlscert style=float:right;width:260px><option value=-1>No Certificate, TLS Disabled</option>";for(var c in xxCertificates)0!=xxCertificates[c].TrustedRootCertficate||!xxCertificates[c].XPrivateKey||null!=xxTlsCurrentCert&&xxTlsCurrentCert!=c||(b+="<option value="+c+">"+xxCertificates[c].XSubject.CN+"</option>");b+="</select><div style=padding-top:4px>Certificate</div></div><div style=height:26px;margin-top:4px><select id=tlsremote style=float:right;width:260px onchange=showSetTlsSecurityDlgUpdate()><option value=0>Server-auth TLS only</option><option value=1>Server-auth, non-TLS allowed</option>";
|
|
b+="<option value=2>Mutual-auth TLS only</option><option value=3>Mutual-auth, non-TLS allowed</option>";b+='</select><div style=padding-top:4px>Security</div></div><div style=height:26px id=d11rcn title="Comma seperated list of certificate common names that will be allowed to connect remotely."><input id=d11_rcn style=float:right;width:260px onkeyup=showSetTlsSecurityDlgUpdate() placeholder="name1, name2"><div style=padding-top:4px>Remote CN\'s</div></div>';setDialogMode(11,"TLS Settings",3,showSetTlsSecurityDlgOk,
|
|
b);if(0==xxTLSCredentialContext.length||0==xxTlsSettings[0].Enabled||0==xxTlsSettings[1].Enabled)getSelectElement("tlscert").value=-1;else for(c in b=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,xxCertificates)xxCertificates[c].InstanceID==b&&(getSelectElement("tlscert").value=c);c=1-("Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1);getSelectElement("tlsremote").value=(1==xxTlsSettings[c].MutualAuthentication?2:0)+(1==xxTlsSettings[c].AcceptNonSecureConnections?
|
|
1:0);xxTlsSettings[c].TrustedCN&&(Q("d11_rcn").value=MakeToArray(xxTlsSettings[c].TrustedCN).join(", "));showSetTlsSecurityDlgUpdate()}}function showSetTlsSecurityDlgUpdate(){var b=getSelectElement("tlscert").value;QE("tlsremote",-1!=b);QV("d11rcn",-1!=b&&1<getSelectElement("tlsremote").value);b=!0;1<getSelectElement("tlsremote").value&&!splitDomains(Q("d11_rcn").value)&&(b=!1);QE("c49",b)}var setTlsSecurityPendingCalls,setTlsSecurityDeleteCredentialContext;
|
|
function showSetTlsSecurityDlgOk(){var b=getSelectElement("tlscert").value,c=getSelectElement("tlsremote").value,a=Clone(xxTlsSettings);setTlsSecurityPendingCalls=0;setTlsSecurityDeleteCredentialContext=null;if(-1!=b){if(0<xxTLSCredentialContext.length){var d=Clone(xxTLSCredentialContext[0]);d.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value=xxCertificates[b].InstanceID;amtstack.Put("AMT_TLSCredentialContext",d,setTlsSecurityResponse,0,1)}else amtstack.Create("AMT_TLSCredentialContext",
|
|
{ElementInContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_PublicKeyCertificate")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+xxCertificates[b].InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",ElementProvidingContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_TLSProtocolEndpointCollection")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="ElementName">TLSProtocolEndpointInstances Collection</w:Selector></w:SelectorSet></a:ReferenceParameters>'},
|
|
setTlsSecurityResponse);setTlsSecurityPendingCalls++}else 0<xxTLSCredentialContext.length&&(setTlsSecurityDeleteCredentialContext=Clone(xxTLSCredentialContext[0]));var d="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,e=1-d;a[e].Enabled=-1!=b;a[e].MutualAuthentication=2<=c;a[e].AcceptNonSecureConnections=1==c%2;a[e].TrustedCN=splitDomains(Q("d11_rcn").value);a[d].Enabled=-1!=b;a[d].TrustedCN=splitDomains(Q("d11_rcn").value);2<=c&&(setTlsSecurityPendingCalls++,amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(function(a,
|
|
b,c,d){200!=d?messagebox("","Failed to set time, status = "+d):0!=c.Body.ReturnValue?messagebox("","Failed to set time, error: "+c.Body.ReturnValueStr):(a=new Date,a=Math.round((a.getTime()-6E4*a.getTimezoneOffset())/1E3),amtstack.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch(c.Body.Ta0,a,a,function(){setTlsSecurityResponse()}))}));setTlsSecurityPendingCalls+=2;amtstack.Put("AMT_TLSSettingData",a[0],setTlsSecurityResponse,0,1,a[0]);amtstack.Put("AMT_TLSSettingData",a[1],setTlsSecurityResponse,
|
|
0,1,a[1]);statusbox("TLS Settings","Applying new security settings...")}function splitDomains(b){b=b.split(",");if(0!=b.length){for(var c in b)if(b[c]=b[c].trim(),0<=b[c].indexOf(" ")||0==b[c].length)return;if(!(4<b.length))return b}}
|
|
function setTlsSecurityResponse(b,c,a,d){if(b){if(200!=d){messagebox("","Failed to set TLS security, status = "+d);return}if(a.Body.ReturnValueStr&&!methodcheck(a))return}0==--setTlsSecurityPendingCalls&&amtstack.AMT_SetupAndConfigurationService_CommitChanges(null,setTlsSecurityResponse2)}
|
|
function setTlsSecurityResponse2(b,c,a,d){200!=d?messagebox("","Failed to set TLS security, status = "+d):0!=a.Body.ReturnValue?messagebox("","Failed to set TLS security, error: "+a.Body.ReturnValueStr):setTimeout(setTlsSecurityResponse3,2E3)}
|
|
function setTlsSecurityResponse3(){null!=setTlsSecurityDeleteCredentialContext&&amtstack.Delete("AMT_TLSCredentialContext",setTlsSecurityDeleteCredentialContext,function(){});PullCertificates();setDialogMode();amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime)}var xxWatchdog=null;
|
|
function PullWatchdog(){amtstack.BatchEnum(null,["*AMT_AgentPresenceCapabilities","AMT_AgentPresenceWatchdog","AMT_AgentPresenceWatchdogAction","AMT_StateTransitionCondition","CIM_ConcreteDependency"],PullWatchdogResponse)}
|
|
function PullWatchdogResponse(b,c,a,d){if(200==d&&200==a.AMT_AgentPresenceCapabilities.status){xxWatchdog=a;for(var e in xxWatchdog.CIM_ConcreteDependency.responses)b=xxWatchdog.CIM_ConcreteDependency.responses[e],(c=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","CreationClassName"))&&"AMT_AgentPresenceWatchdog"==c.Value&&(d=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value,a=getItem(b.Dependent.ReferenceParameters.SelectorSet.Selector,
|
|
"@Name","PolicyConditionName").Value,d=getItem(xxWatchdog.AMT_AgentPresenceWatchdog.responses,"DeviceID",d),a=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,"PolicyConditionName",a),d.transitions||(d.transitions=[]),d.transitions.push(a)),c&&"AMT_StateTransitionCondition"==c.Value&&(a=getItem(b.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyConditionName").Value,b=getItem(b.Dependent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyActionName").Value,a=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,
|
|
"PolicyConditionName",a),b=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",b),a.actions||(a.actions=[]),a.actions.push(b));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";"),watchdogMonitoredEntity="Unknown;Other;Operating System;Operating System Boot Process;Operating System Shutdown Process;Firmware Boot Process;BIOS Boot Process;Application;Service Processor".split(";");
|
|
function updateWatchdog(){if(null!=xxWatchdog){var b;b=""+TableStart();b+=TableEntry("Maximum Watchdogs",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" watchdogs");b+=TableEntry("Maximum Total Actions",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" actions");b+=TableEnd()+"<br>";b+=TableStart2();b+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT agent presence watchdogs.<br><br>";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||
|
|
0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)b+="<div style=padding-left:15px><i>No agent presence watchdog found.</i></div><br>";else for(var c in xxWatchdog.AMT_AgentPresenceWatchdog.responses){var a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[c],d=guidToStr(rstr2hex(atob(a.DeviceID)));a.MonitoredEntityDescription&&""!=a.MonitoredEntityDescription&&(d=EscapeHtml(a.MonitoredEntityDescription));b+="<div class=itemBar onclick=showWatchdogDetails("+c+')><input type=button style=float:right value="Add Action..." onclick=addWatchdogAction(event,'+
|
|
c+")>";a.transitions&&(b+='<input type=button style=float:right value="Delete Actions..." onclick=deleteWatchdogActions(event,'+c+")>");b+="<div style=padding-top:3px><b>"+d+"</b>, "+amtstack.WatchdogCurrentStates[a.CurrentState]+"</div>";var d="",e;for(e in a.transitions){var r=a.transitions[e];""!=d&&(d+="<br>");d+=getWatchdogTransitionStr(r.OldState)+" → "+getWatchdogTransitionStr(r.NewState);r.actions&&1==r.actions[0].EventOnTransition&&(d+=" : Event to log")}""!=d&&(b+="<div style=padding:12px>"+
|
|
d+"</div>");b+="</div>"}b=b+"<br>"+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Add Watchdog...","AddWatchdog()"));b+="<br>";QH(60,b)}}function getWatchdogTransitionStr(b){if(31==b)return"Any State";var c="",a;for(a in amtstack.WatchdogCurrentStates)0!=(b&a)&&(c+=", "+amtstack.WatchdogCurrentStates[a]);return c.substring(2)}
|
|
function showWatchdogDetails(b){b=xxWatchdog.AMT_AgentPresenceWatchdog.responses[b];var c="";b.MonitoredEntityDescription&&""!=b.MonitoredEntityDescription&&(c+=addHtmlValue("Description",EscapeHtml(b.MonitoredEntityDescription)));c+=addHtmlValue("Monitored Entity",watchdogMonitoredEntity[b.MonitoredEntity]);c+=addHtmlValue("Current State",amtstack.WatchdogCurrentStates[b.CurrentState]);c+=addHtmlValue("Enabled State",watchdogEnabledStates[b.EnabledState]);c+=addHtmlValue("Startup Interval",b.StartupInterval+
|
|
" second(s)");c+=addHtmlValue("Timeout Interval",b.TimeoutInterval+" second(s)");setDialogMode(11,format("Watchdog {0}",guidToStr(rstr2hex(atob(b.DeviceID)))),5,showWatchdogDetailsOk,c,b)}function showWatchdogDetailsOk(b,c){2==b&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:c.DeviceID},PullWatchdog)}
|
|
function AddWatchdog(){var b;b="<div style=height:26px;margin-top:4px><input id=wgname style=float:right;width:240px maxlength=16 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Name</div></div>"+('<div style=height:26px;margin-top:4px><input id=wgguid style=float:right;width:240px maxlength=36 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px title="Generate random DeviceID">'+addLink("DeviceID","GenerateWatchdogGuid()")+"</div></div>");b+="<div style=height:26px;margin-top:4px><input id=wgstart style=float:right;width:240px maxlength=8 placeholder=3600 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Startup (seconds)</div></div>";
|
|
b+="<div style=height:26px;margin-top:4px><input id=wgtimeout style=float:right;width:240px maxlength=8 placeholder=60 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Timeout (seconds)</div></div>";setDialogMode(11,"Add Watchdog",3,AddWatchdogOk,b);AddWatchdogUpdate()}function GenerateWatchdogGuid(){var b,c="";for(b=0;16>b;b++)c+=String.fromCharCode(random(255));Q("wgguid").value=guidToStr(rstr2hex(c));AddWatchdogUpdate()}
|
|
function AddWatchdogUpdate(){for(var b=(""==Q("wgstart").value||0<parseInt(Q("wgstart").value))&&(""==Q("wgtimeout").value||0<parseInt(Q("wgtimeout").value)),c=0,a=Q("wgguid").value.toLowerCase(),d=0;d<a.length;d++){var e=a.charCodeAt(d);45!=e&&(48<=e&&57>=e||97<=e&&102>=e?c++:b=!1)}32!=c&&(b=!1);QE("dlgOkButton",b)}
|
|
function AddWatchdogOk(){var b=Q("wgtimeout").value,c=Q("wgstart").value;""==b&&(b=60);""==c&&(c=3600);b={CreationClassName:0,DeviceID:btoa(hex2rstr(guidToStr(Q("wgguid").value.replace(/-/g,"")).replace(/-/g,""))),StartupInterval:c,SystemCreationClassName:0,SystemName:0,TimeoutInterval:b,MonitoredEntityDescription:Q("wgname").value};amtstack.Create("AMT_AgentPresenceWatchdog",b,AddWatchdogOk2)}
|
|
function AddWatchdogOk2(b,c,a,d){200!=d?messagebox("Watchdog","Unable to add watchdog, error #"+d):PullWatchdog()}
|
|
function addWatchdogAction(b,c){var a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[c],d;d="<table><td style=width:180px>From<br>";for(c in amtstack.WatchdogCurrentStates)d+="<input id=wgsa"+c+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br />";d+="<td>To<br>";for(c in amtstack.WatchdogCurrentStates)d+="<input id=wgsb"+c+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[c]+"<br />";setDialogMode(11,"Add Watchdog Action",
|
|
3,addWatchdogActionOk,d+"</table><br>Perform Action<br><input id=wgsevent type=checkbox checked onclick=addWatchdogActionUpdate()>Write to event log<br />",a);addWatchdogActionUpdate();haltEvent(b)}function addWatchdogActionUpdate(){var b=0,c=0,a;for(a in amtstack.WatchdogCurrentStates)1==Q("wgsa"+a).checked&&(b+=parseInt(a)),1==Q("wgsb"+a).checked&&(c+=parseInt(a));QE("dlgOkButton",0<b&&0<c&&1==Q("wgsevent").checked)}
|
|
function addWatchdogActionOk(b,c){var a=0,d=0,e;for(e in amtstack.WatchdogCurrentStates)1==Q("wgsa"+e).checked&&(a+=parseInt(e)),1==Q("wgsb"+e).checked&&(d+=parseInt(e));amtstack.AMT_AgentPresenceWatchdog_AddAction(a,d,Q("wgsevent").checked,null,null,AddWatchdogActionResponse,null,0,{DeviceID:c.DeviceID})}function AddWatchdogActionResponse(b,c,a,d){200!=d?messagebox("Watchdog Action","Unable to add watchdog action, error #"+d):PullWatchdog()}
|
|
function deleteWatchdogActions(b,c){setDialogMode(11,"Delete Watchdog Actions",3,deleteWatchdogActionsOk,"Delete all actions for this watchdog?",xxWatchdog.AMT_AgentPresenceWatchdog.responses[c]);haltEvent(b)}function deleteWatchdogActionsOk(b,c){amtstack.AMT_AgentPresenceWatchdog_DeleteAllActions(deleteWatchdogActionResponse,null,0,{DeviceID:c.DeviceID})}
|
|
function deleteWatchdogActionResponse(b,c,a,d){200!=d?messagebox("Watchdog Action","Unable to remove watchdog actions, error #"+d):PullWatchdog()}
|
|
var xxSystemDefense=null,xxSystemDefenceLinkedPolicy={},xxUpdatingDefenseStats=!1,xxFilterStatistics=[{},{}],xxFilterStatisticsTimer=null,xxFilterStatisticsTimerActive=!1,xxSystemDefenceFilterEthernetTypes={2048:"All IP Packets",2054:"All ARP Packets"},xxSystemDefenceFilterIPTypes={4:"IPv4",6:"IPv6"},xxSystemDefenceFilterDesc={0:"Allow, Count",1:"Drop, Count",2:"Rate limit",3:"Allow",4:"Drop"},xxSystemDefenceFilters={HdrProtocolID:1,HdrDestAddress:2,HdrDestMask:2,HdrSrcAddress:2,HdrSrcMask:2,HdrSrcPortStart:1,
|
|
HdrSrcPortEnd:1,HdrDestPortStart:1,HdrDestPortEnd:1,HdrSrcAddressEndOfRange:2,"HdrDestAddressEndOfRange ":2,TCPFlagsOn:3,TCPFlagsOff:3};function PullSystemDefense(){amtFirstPull|=4;amtstack.BatchEnum(null,["AMT_SystemDefensePolicy","AMT_NetworkPortSystemDefensePolicy","AMT_Hdr8021Filter","AMT_IPHeadersFilter","AMT_NetworkFilter"],PullSystemDefenseResponse)}
|
|
function PullSystemDefenseResponse(b,c,a,d){200==d&&(xxSystemDefense=a,updateSystemDefense(),QV("go18",!0),urlvars.norefresh&&UpdateDefenseStats())}
|
|
function updateSystemDefense(){if(null!=xxSystemDefense){var b="";xxSystemDefenceLinkedPolicy={};for(var c in xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses){var a=xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses[c],d=+getItem(a.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value.substring(27),a=getItem(xxSystemDefense.AMT_SystemDefensePolicy.responses,"InstanceID",a.Dependent.ReferenceParameters.SelectorSet.Selector.Value);xxSystemDefenceLinkedPolicy[d]=
|
|
a}b+=TableStart();c="<i>None</i>";xxSystemDefenceLinkedPolicy[0]&&(c=xxSystemDefenceLinkedPolicy[0].PolicyName);b+=TableEntry("Default Wired Policy",addLink(c,"changeDefaultPolicy(0)"));for(c=0;2>c;c++){var a=xxFilterStatistics[c],e;for(e in a)d=a[e],d=1==d?d+" packet":d+" packets",b+=TableEntry((0==c?"Wired ":"Wireless ")+e,d)}b+=TableEnd();b=b+"<br>"+TableStart2();b+="<tr><td class=r1 style=padding-left:15px;border:0><br>Manage Intel® AMT system defense policies.<br><br>";if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)b+=
|
|
"<div style=padding-left:15px><i>No system defense policies found.</i></div><br>";else for(c in xxSystemDefense.AMT_SystemDefensePolicy.responses)a=xxSystemDefense.AMT_SystemDefensePolicy.responses[c],d="",a.FilterCreationHandles&&(a.FilterCreationHandles=MakeToArray(a.FilterCreationHandles),d=a.FilterCreationHandles.length,d=", "+d+" filter"+(1<d?"s":"")),b+="<div class=itemBar onclick=showPolicyDetails("+c+")><div style=padding-top:3px><b>"+EscapeHtml(a.PolicyName)+"</b>"+d+"</div></div>";b+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT system defense filters.<br><br>";
|
|
if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)b+="<div style=padding-left:15px><i>No system defense filters found.</i></div><br>";else{for(c in xxSystemDefense.AMT_Hdr8021Filter.responses)a=xxSystemDefense.AMT_Hdr8021Filter.responses[c],(d=xxSystemDefenceFilterEthernetTypes[a.HdrProtocolID8021])||(d="All Ethernet Protocol "+a.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile],2==a.FilterProfile&&(d+=" at "+a.FilterProfileData+
|
|
" packet / sec"),1==a.ActionEventOnMatch&&(d+=", Event on match"),b+="<div class=itemBar onclick=showFilterDetails(0,"+c+")><div style=padding-top:3px><b>"+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+"</b>, "+d+"</div></div>";for(c in xxSystemDefense.AMT_IPHeadersFilter.responses){a=xxSystemDefense.AMT_IPHeadersFilter.responses[c];(d=xxSystemDefenceFilterIPTypes[a.HdrIPVersion])||(d="All Ethernet Protocol "+a.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[a.FilterProfile];2==
|
|
a.FilterProfile&&(d+=" at "+a.FilterProfileData+" packet / sec");1==a.ActionEventOnMatch&&(d+=", Event on match");var r=0;for(e in xxSystemDefenceFilters)a[e]&&r++;0<r&&(d+=", "+r+" filter"+(1<r?"s":""));b+="<div class=itemBar onclick=showFilterDetails(1,"+c+")><div style=padding-top:3px><b>"+(0==a.FilterDirection?"← ":"→ ")+EscapeHtml(a.Name)+"</b>, "+d+"</div></div>"}}b+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Add Filter...","AddDefenseFilter()")+
|
|
AddButton("Add Policy...","AddDefensePolicy()"));QH(59,b);null==xxFilterStatisticsTimer&&(xxFilterStatisticsTimerActive=!1,urlvars.norefresh||(UpdateDefenseStats(),xxFilterStatisticsTimer=setInterval(UpdateDefenseStats,5E3)))}}function StopDefenseStatsTimer(){null!=xxFilterStatisticsTimer&&(clearInterval(xxFilterStatisticsTimer),xxFilterStatisticsTimer=null);xxFilterStatisticsTimerActive=!1}
|
|
function UpdateDefenseStats(b){if(b||1!=xxFilterStatisticsTimerActive)xxFilterStatisticsTimerActive=!0,b=b?b:0,xxSystemDefenceLinkedPolicy[b]?amtstack.AMT_SystemDefensePolicy_UpdateStatistics('<a:Address></a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+b+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",!1,UpdateDefenseStats2,b,0,{InstanceID:xxSystemDefenceLinkedPolicy[b].InstanceID}):
|
|
(xxFilterStatistics[b]={},StopDefenseStatsTimer())}function UpdateDefenseStats2(b,c,a,d,e){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,e):StopDefenseStatsTimer()}
|
|
function UpdateDefenseStats3(b,c,a,d,e){b=0;if(200==d){xxFilterStatistics[e]={};for(var r in a)d=a[r].ReadCount,c=getItem(a[r].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[e][c]=d,b++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==b&&StopDefenseStatsTimer()}
|
|
function changeDefaultPolicy(b){if(!xxdialogMode){var c;c="<div style=height:26px;margin-top:4px><select id=policySelection style=float:right;width:266px><option value=-1>None";for(var a in xxSystemDefense.AMT_SystemDefensePolicy.responses)c+="<option value="+a+(xxSystemDefenceLinkedPolicy[b]&&xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID==xxSystemDefenceLinkedPolicy[b].InstanceID?" selected":"")+">"+xxSystemDefense.AMT_SystemDefensePolicy.responses[a].PolicyName;setDialogMode(11,
|
|
"Default System Defense Policy",3,changeDefaultPolicyOk,c+"</select><div style=padding-top:4px>Default Policy</div></div>",b)}}
|
|
function changeDefaultPolicyOk(b,c){var a=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[c];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'<w:SelectorSet><w:Selector Name="Antecedent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_EthernetPort</w:Selector><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+c+
|
|
'</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector><w:Selector Name="Dependent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+
|
|
d.InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector></w:SelectorSet>",-1==a?PullSystemDefense:function(){});0<=a&&amtstack.Create("AMT_NetworkPortSystemDefensePolicy",{Antecedent:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+
|
|
c+"</Selector></SelectorSet></ReferenceParameters>",Dependent:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">'+
|
|
xxSystemDefense.AMT_SystemDefensePolicy.responses[a].InstanceID+"</Selector></SelectorSet></ReferenceParameters>"},changeDefaultPolicyOk2)}function changeDefaultPolicyOk2(b,c,a,d){200!=d?messagebox("Default System Defense Policy","Unable to set policy, error "+d):PullSystemDefense()}
|
|
function AddDefenseFilter(){if(!xxdialogMode){var b;b="<div style=height:26px;margin-top:4px><input id=filtername style=float:right;width:260px maxlength=16 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=filtertype style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Ethernet IP Packet Filter<option value=1>Ethernet ARP Packet Filter<option value=2>IPv4 Packet Filter<option value=3>IPv6 Packet Filter</select><div style=padding-top:4px>Type</div></div>";b+=
|
|
'<div style=height:26px;margin-top:4px id=ipfilterdiv><input id=ipfilter style=float:right;width:260px placeholder="Optional Rules" onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Matching Rules</div></div>';b+="<div style=height:26px;margin-top:4px><select id=filterdir style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Outbound / Transmit<option value=1>Inbound / Receive</select><div style=padding-top:4px>Direction</div></div>";b+="<div style=height:26px;margin-top:4px><select id=filterprofile style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Allow, Count<option value=1>Drop, Count<option value=2>Rate Limit<option value=3>Allow<option value=4>Drop</select><div style=padding-top:4px>Action</div></div>";
|
|
b+="<div style=height:26px;margin-top:4px id=filterdatadiv><input id=filterdata style=float:right;width:260px maxlength=8 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Packets / second</div></div>";b+="<div style=height:26px;margin-top:4px><select id=filteraction style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=false>Do Nothing<option value=1>Event on match</select><div style=padding-top:4px>Event Log</div></div>";setDialogMode(11,"Add System Defense Filter",
|
|
3,AddDefenseFilterOk,b);AddDefenseFilterUpdate()}}
|
|
function AddDefenseFilterOk(){if(1>=Q("filtertype").value){var b=0==Q("filtertype").value?2048:2054,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrProtocolID8021:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value};2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_Hdr8021Filter",c,AddDefenseFilterOk2)}else{var b=2==Q("filtertype").value?
|
|
4:6,c={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:b,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},a=Q("ipfilter").value.split(","),d;for(d in a){var e=a[d].indexOf("="),r=a[d].substring(0,e),e=a[d].substring(e+1),p=xxSystemDefenceFilters[r];p||(r="Hdr"+r,p=xxSystemDefenceFilters[r]);p&&(2==p&&4==b?(e=e.split("."),4==e.length&&(c[r]=rstr2hex(String.fromCharCode(parseInt(e[0]),
|
|
parseInt(e[1]),parseInt(e[2]),parseInt(e[3]))))):c[r]=e)}2==Q("filterprofile").value&&(c.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",c,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var b=0<Q("filtername").value.length;b&&2==Q("filterprofile").value&&(b=parseInt(Q("filterdata").value),b=0<b&&4294967295>b);QE("c49",b);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
|
|
function AddDefenseFilterOk2(b,c,a,d){200!=d?messagebox("Add System Defense Filter","Unable to add filter, error #"+d):PullSystemDefense()}
|
|
function showFilterDetails(b,c){if(!xxdialogMode){var a,d,e,r;0==b?(r="AMT_Hdr8021Filter",e="Ethernet Traffic",d=xxSystemDefense[r].responses[c],(a=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(a="All Ethernet Protocol "+d.HdrProtocolID8021)):(r="AMT_IPHeadersFilter",e="IP Traffic",d=xxSystemDefense[r].responses[c],(a=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(a="All IP Protocol "+d.HdrIPVersion));var p;p=""+addHtmlValue("Name",EscapeHtml(d.Name));p+=addHtmlValue("Type",e);p+=addHtmlValue("Matching Traffic",
|
|
a);p+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==b)for(var k in xxSystemDefenceFilters)d[k]&&(a=k,e=d[k],b=xxSystemDefenceFilters[k],2==b&&4==e.length&&(e=hex2rstr(e),e=e.charCodeAt(0)+"."+e.charCodeAt(1)+"."+e.charCodeAt(2)+"."+e.charCodeAt(3)),a.startsWith("Hdr")&&(a=a.substring(3)),p+=addHtmlValue("Filter "+a,e));p+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
|
|
p,[r,d])}}function showFilterDetailsOk(b,c){2==b&&amtstack.Delete(c[0],c[1],deleteDefenseFilter)}function deleteDefenseFilter(b,c,a,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
|
|
function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var b;b='<div style=height:26px;margin-top:4px><input id=policyname title="<policy name>:<policy precedence number>" style=float:right;width:260px maxlength=16 onkeyup=AddDefensePolicyUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=policytx title="Default action to take for outbound traffic" style=float:right;width:133px><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><select id=policyrx style=float:right;width:133px title="Default action to take for inbound traffic"><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><div style=padding-top:4px>Default TX / RX</div></div>';b+=
|
|
"<div id=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){b+="<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>";for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];b+="<option value="+a.InstanceID+">"+a.Name}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],
|
|
b+="<option value="+a.InstanceID+">"+a.Name;b+="</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>Add Filter</div></div>"}setDialogMode(11,"Add System Defense Policy",3,AddDefensePolicyOk,b);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())}
|
|
function removeFilterButton(b){xxAddDefensePolicyFilters.splice(b,1);AddDefensePolicyUpdate()}
|
|
function AddDefensePolicyUpdate(){var b=0<Q("policyname").value.split(":")[0].length;QE("c49",b);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>This policy contains no filters.</i><br><br>");else{var b="",c;for(c in xxAddDefensePolicyFilters)b+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","removeFilterButton("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden><b>"+GetFilterById(xxAddDefensePolicyFilters[c]).Name+
|
|
"</b></div></div>";QH("policyFilters",b)}}function GetFilterById(b){for(var c in xxSystemDefense.AMT_Hdr8021Filter.responses){var a=xxSystemDefense.AMT_Hdr8021Filter.responses[c];if(a.InstanceID==b)return a}for(c in xxSystemDefense.AMT_IPHeadersFilter.responses)if(a=xxSystemDefense.AMT_IPHeadersFilter.responses[c],a.InstanceID==b)return a}
|
|
function AddDefensePolicyOk(){var b=Q("policytx").value,c=Q("policyrx").value,a=0,d=Q("policyname").value.split(":");2==d.length&&(a=parseInt(d[1]));b={"InstanceID ":0,PolicyName:d[0],PolicyPrecedence:a,TxDefaultCount:1<b,TxDefaultDrop:1==b%2,TxDefaultMatchEvent:3<b,RxDefaultCount:1<c,RxDefaultDrop:1==c%2,RxDefaultMatchEvent:3<c};0<xxAddDefensePolicyFilters.length&&(b.FilterCreationHandles=xxAddDefensePolicyFilters);amtstack.Create("AMT_SystemDefensePolicy",b,AddDefensePolicyOk2)}
|
|
function AddDefensePolicyOk2(b,c,a,d){200!=d?messagebox("Add System Defense Policy","Unable to add policy, error #"+d):PullSystemDefense()}
|
|
function showPolicyDetails(b){if(!xxdialogMode){var c=xxSystemDefense.AMT_SystemDefensePolicy.responses[b],a;a=""+addHtmlValue("Name",EscapeHtml(c.PolicyName));0!=c.PolicyPrecedence&&(a+=addHtmlValue("Precedence",c.PolicyPrecedence));var d=1==c.TxDefaultDrop?"Drop":"Allow";1==c.TxDefaultCount&&(d+=", Count");1==c.TxDefaultMatchEvent&&(d+=", Event");a+=addHtmlValue("Default TX Action",d);d=1==c.RxDefaultDrop?"Drop":"Allow";1==c.RxDefaultCount&&(d+=", Count");1==c.RxDefaultMatchEvent&&(d+=", Event");
|
|
a+=addHtmlValue("Default RX Action",d);if(c.FilterCreationHandles)for(b in c.FilterCreationHandles)a+=addHtmlValue("Filter #"+(+b+1),GetFilterById(c.FilterCreationHandles[b]).Name);setDialogMode(11,format("Policy #",c.InstanceID.substring(20)),5,showPolicyDetailsOk,a,c)}}function showPolicyDetailsOk(b,c){2==b&&amtstack.Delete("AMT_SystemDefensePolicy",c,deleteDefensePolicy)}
|
|
function deleteDefensePolicy(b,c,a,d){200!=d?messagebox("Remove Policy","Unable to remove policy, make sure it's not in use."):PullSystemDefense()}var xxWireless;function PullWireless(){amtFirstPull|=2;-1!=amtwirelessif&&amtstack.BatchEnum("",["*CIM_WiFiPortCapabilities","*CIM_WiFiPort","*CIM_WiFiEndpoint","CIM_WiFiEndpointSettings"],processWireless)}function wifiRefresh(){xxdialogMode||PullWireless()}
|
|
var xxWifiState={3:"Disabled",32768:"Enabled in S0",32769:"Enabled in S0, Sx/AC"},xxRadioState={2:"On, Connected",3:"Off",6:"On, Disconnected"},xxWifiAuthenticationMethod={1:"Other",2:"Open",3:"Shared Key",4:"WPA PSK",5:"WPA IEEE 802.1x",6:"WPA2 PSK",7:"WPA2 IEEE 802.1x"},xxWifiEncryptionMethod={1:"Other",2:"WEP",3:"TKIP-RC4",4:"CCMP-AES",5:"None"};function processWireless(b,c,a,d){xxWireless=200==d?a:void 0;updateSystemStatus();showWirelessInfo()}
|
|
function showWirelessInfo(){if(xxWireless){var b,c,a="",d,e;if(xxWireless.CIM_WiFiPortCapabilities.response){e="<br><h2>Wireless Profiles</h2>"+TableStart2();e+="<tr><td class=r2 style=padding-left:15px><br>Wireless profiles that Intel® AMT will use for network connectivity.<br><br>";for(b=a=0;256>b;b++)for(c in xxWireless.CIM_WiFiEndpointSettings.responses)d=xxWireless.CIM_WiFiEndpointSettings.responses[c],1!=d.AuthenticationMethod&&d.Priority==b&&(e+="<div class=itemBar onclick=showWifiDetails("+
|
|
c+")><div style=float:right>"+EscapeHtml(d.SSID)+", "+xxWifiAuthenticationMethod[d.AuthenticationMethod]+", "+xxWifiEncryptionMethod[d.EncryptionMethod]+" ",xxAccountAdminName&&(e+=AddButton2("Remove",'wifiRemoveButton("'+c+'")')),e+="</div><div style=padding-top:3px><b>"+EscapeHtml(d.ElementName)+"</b></div></div>",a++);0==a&&(e+="<i>No Wireless Profiles Present</i><br>");e+="<br><td class=r2>";e=xxAccountAdminName?e+TableEnd(AddButton("New Profile","showWifiNewProfile()")):e+TableEnd("");
|
|
QH(22,e+"<br>")}}}function showWifiStateDlg(){if(!xxdialogMode){var b="",c;for(c in xxWifiState)b+="<label><input type=radio name=d11 id=wl"+c+" value="+c+" "+(xxWireless.CIM_WiFiPort.response.EnabledState==c?"checked":"")+">"+xxWifiState[c]+"</label><br>";setDialogMode(11,"Wireless State",3,wifiStateDlg,b)}}
|
|
function wifiStateDlg(){amtstack.CIM_WiFiPort_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,function(){amtstack.Get("CIM_WiFiPort",function(b,c,a,d){200==d&&(xxWireless.CIM_WiFiPort.response=a.Body,showWirelessInfo())})})}
|
|
function showWifiDetails(b){if(!xxdialogMode){b=xxWireless.CIM_WiFiEndpointSettings.responses[b];var c;c="<div style=text-align:left>"+addHtmlValue("Profile Name",EscapeHtml(b.ElementName));c+=addHtmlValue("SSID",b.SSID);c+=addHtmlValue("Authentication",xxWifiAuthenticationMethod[b.AuthenticationMethod]);c+=addHtmlValue("Encryption",xxWifiEncryptionMethod[b.EncryptionMethod]);c+=addHtmlValue("Priority",b.Priority);messagebox("Wireless Profile",c+"</div>")}}
|
|
function wifiRemoveButton(b){xxdialogMode||(QH(66,format('Remove wireless profile "{0}"?',xxWireless.CIM_WiFiEndpointSettings.responses[b].ElementName)),setDialogMode(1,"Wireless Profile",3,function(){removeWifiButtonEx(b)}))}function removeWifiButtonEx(b){amtstack.Delete("CIM_WiFiEndpointSettings",{InstanceID:xxWireless.CIM_WiFiEndpointSettings.responses[b].InstanceID},removeWifiEntryResponse,0,1)}
|
|
function removeWifiEntryResponse(b,c,a,d,e){methodcheck(a)||amtstack.Enum("CIM_WiFiEndpointSettings",function(a,b,c,d){200==d&&(xxWireless.CIM_WiFiEndpointSettings.responses=c,showWirelessInfo())})}
|
|
function showWifiNewProfile(){if(!xxdialogMode){var b="";for(i=1;256>i;i++){var c=1;for(j in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[j].Priority==i&&(c=0);c&&(b+="<option value="+i+">"+i)}QH("c24",b);c25.value=6;c26.value=4;c22.value=c23.value=c27.value=c28.value="";setDialogMode(12,"Add Wireless Profile",3,function(){addWifiProfile()});updateWifiDialog()}}
|
|
function addWifiProfile(){amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings({__parameterType:"reference",__resourceUri:amtstack.CompleteName("CIM_WiFiEndpoint"),Name:"WiFi Endpoint 0"},{__parameterType:"instance",__namespace:amtstack.CompleteName("CIM_WiFiEndpointSettings"),ElementName:c22.value,InstanceID:"Intel(r) AMT:WiFi Endpoint Settings "+c22.value,AuthenticationMethod:c25.value,EncryptionMethod:c26.value,SSID:c23.value,Priority:c24.value,
|
|
PSKPassPhrase:c27.value},null,null,null,removeWifiEntryResponse)}
|
|
function updateWifiDialog(){var b=!0,c=c25.value,a=c26.value;QV(72,4>c);QV(71,3<c);QV(70,3<c);QV(73,4>c);4>c&&(3==a||4==a)&&(c26.value=2);3<c&&(2==a||5==a)&&(c26.value=3);for(var d in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c22.value&&(b=!1);QE("c49",1==b&&0<c22.value.length&&0<c23.value.length&&7<c27.value.length&&c27.value==
|
|
c28.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_ComputerSystemPackage CIM_SystemPackaging *CIM_Chassis CIM_Chip *CIM_Card *CIM_BIOSElement CIM_Processor CIM_PhysicalMemory CIM_MediaAccessDevice CIM_PhysicalPackage".split(" "),processHardware);amtFirstPull|=1}
|
|
var DMTFCPUStatus="Unknown;Enabled;Disabled by User;Disabled By BIOS (POST Error);Idle;Other".split(";"),DMTFMemType="Unknown;Other;DRAM;Synchronous DRAM;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Flash;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Other;Unknown;SIMM;SIP;Chip;DIP;ZIP;Proprietary Card;DIMM;TSOP;Row of chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"),DMTFProcFamilly={191:"Intel® Core™ 2 Duo Processor",
|
|
192:"Intel® Core™ 2 Solo processor",193:"Intel® Core™ 2 Extreme processor",194:"Intel® Core™ 2 Quad processor",195:"Intel® Core™ 2 Extreme mobile processor",196:"Intel® Core™ 2 Duo mobile processor",197:"Intel® Core™ 2 Solo mobile processor",198:"Intel® Core™ i7 processor",199:"Dual-Core Intel® Celeron® processor"},HardwareInventory;
|
|
function processHardware(b,c,a,d){if(200==d){var e;b="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>";HardwareInventory=a;QV("go2",!0);b+=TableEnd("<div> "+AddRefreshButton("PullHardware(1)")+AddButton("Save...","SaveHardwareLog()")+" Hardware information is gathered at system boot time.");c=a.CIM_Chassis.response;d=a.CIM_Card.response;var r=a.CIM_BIOSElement.response.SoftwareElementID;b=b+"<br><h2>Platform</h2>"+FullTable({"Computer model":c.Model,Manufacturer:c.Manufacturer,
|
|
Version:c.Version,"Serial number":c.SerialNumber,"System ID":guidToStr(a.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");b+="<br><h2>Baseboard</h2>";b+=FullTable({Manufacturer:d.Manufacturer,"Product name":d.Model,Version:d.Version,"Serial number":d.SerialNumber,"Asset tag":d.Tag,"Replaceable?":1==d.CanBeFRUed?"Yes":"No"},"");b+="<br><h2>BIOS</h2>";b+=FullTable({Vendor:a.CIM_BIOSElement.response.Manufacturer,Version:r,"Release date":(new Date(a.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",
|
|
{timeZone:"UTC"})},"");b+="<br>";for(e in a.CIM_Processor.responses)c=a.CIM_Processor.responses[e],d=a.CIM_Chip.responses[e],b+="<h2>Processor "+(parseInt(e)+1)+"</h2>",b+=FullTable({Manufacturer:trademarks(d.Manufacturer),Family:DMTFProcFamilly[c.Family],Version:trademarks(d.Version),"Maximum socket speed":c.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[c.CPUStatus]},"");b+="<br>";for(e in a.CIM_PhysicalMemory.responses)c=a.CIM_PhysicalMemory.responses[e],b+="<h2>Memory Module "+(+e+1)+"</h2>",b+=FullTable({"Bank Label":c.BankLabel,
|
|
Manufacturer:c.Manufacturer,"Serial Number":c.SerialNumber,Size:parseInt(c.Capacity/1048576)+" MB","Form factor":DMTFMemFormFactor[c.FormFactor],Type:DMTFMemType[c.MemoryType],"Asset tag":c.Tag,"Part number":c.PartNumber},"");b+="<br>";for(e in a.CIM_MediaAccessDevice.responses)c=a.CIM_MediaAccessDevice.responses[e],d=a.CIM_PhysicalPackage.responses[+e+1],b+="<h2>Storage Media "+(parseInt(e)+1)+"</h2>",b+=FullTable({Model:d.Model,"Serial number":""==d.SerialNumber?"Unknown":d.SerialNumber,Size:parseInt(Math.round(1E3*
|
|
c.MaxMediaSize/1048576))+" MB"},"");b+="<br>";QH(18,b);updateSystemStatus()}}function SaveHardwareLog(){!xxdialogMode&&HardwareInventory&&SaveJsonFile("IntelAmtHardware","hardware","Intel AMT Hardware Information",HardwareInventory)}var AmtSystemPowerSchemes=null;function PullPowerPolicy(){amtstack.Enum("AMT_SystemPowerScheme",powerPolicyResponse)}function powerPolicyResponse(b,c,a,d){AmtSystemPowerSchemes=a;updateSystemStatus()}
|
|
function showPowerPolicyDlg(b){if(!xxdialogMode){for(var c="",a=0;a<AmtSystemPowerSchemes.length;a++)c+='<input type=radio name=powerpolicy value="'+AmtSystemPowerSchemes[a].InstanceID+'" '+(AmtSystemPowerSchemes[a].SchemeGUID==b?" checked":"")+">"+AmtSystemPowerSchemes[a].Description+"<br>";setDialogMode(11,"Intel® AMT Power Policy",3,showPowerPolicyDlgOk,c)}}
|
|
function showPowerPolicyDlgOk(){for(var b=null,c=0,a=document.getElementsByTagName("input");c<a.length;c++)"powerpolicy"==a[c].name&&a[c].checked&&(b=a[c].value);amtstack.AMT_SystemPowerScheme_SetPowerScheme(showPowerPolicyDlgOkDone,b)}function showPowerPolicyDlgOkDone(b,c,a,d){200==d&&PullSystemStatus()}var xxAccountAdminName,xxAccountRealmInfo,xxAccountEnabledInfo={},xxAccountFetch,showHiddenAccounts=!1;
|
|
function PullUserInfo(){xxAccountFetch=1;delete xxAccountAdminName;xxAccountRealmInfo={};amtstack.AMT_AuthorizationService_GetAdminAclEntry(getAdminAclEntryResponse);amtstack.AMT_AuthorizationService_EnumerateUserAclEntries(1,enumerateUserAclEntriesResponse)}function getAdminAclEntryResponse(b,c,a,d){200==d&&(xxAccountRealmInfo[-1]={AccessPermission:999,DigestUsername:a.Body.Username,Realms:null},xxAccountAdminName=a.Body.Username,updateAccounts())}
|
|
function enumerateUserAclEntriesResponse(b,c,a,d){if(200==d){methodcheck(a);QV("go11",!0);xxAccountFetch=a.Body.Handles.length;for(var e in a.Body.Handles)b=a.Body.Handles[e],amtstack.AMT_AuthorizationService_GetAclEnabledState(b,getAclEnabledStateResponse,b),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(b,getUserAclEntryExResponse,b);updateAccounts()}}
|
|
function getUserAclEntryExResponse(b,c,a,d,e){xxAccountFetch--;200==d&&(a.Body.Handle=e,a.Body.Realms?Array.isArray(a.Body.Realms)||(a.Body.Realms=[a.Body.Realms]):a.Body.Realms=[],xxAccountRealmInfo[e]=a.Body,updateAccounts())}function getAclEnabledStateResponse(b,c,a,d,e){200==d&&(xxAccountEnabledInfo[e]=a.Body,updateAccounts())}function setAclEnabledStateResponse(b,c,a,d,e){errcheck(d,b)||(methodcheck(a),amtstack.AMT_AuthorizationService_GetAclEnabledState(e,getAclEnabledStateResponse,e))}
|
|
function updateAccounts(){if(!(0<xxAccountFetch)){var b=TableStart2(),b=b+"<tr><td class=r1 style=padding-left:15px><br>Manage the Intel® AMT user accounts for this computer.<br><br>",c;for(c in xxAccountRealmInfo){var a=xxAccountRealmInfo[c],d,e=!1,r=0;a.DigestUsername?(d=a.DigestUsername,e="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(a.KerberosUserSid));xxAccountEnabledInfo[c]&&"$$OsAdmin"!=d&&(r=1==xxAccountEnabledInfo[c].Enabled?1:2);if(showHiddenAccounts||!e){var p="";if(999!=a.AccessPermission){2==
|
|
r&&(p+="Disabled, ");var k=0;for(c in a.Realms)""!=amtstack.RealmNames[a.Realms[c]]&&k++;0<=a.Realms.indexOf(20)&&(p+="Auditor, ");p=0<=a.Realms.indexOf(3)?p+"Administrator":1==k?p+"1 realm":p+(k+" realms")}else p+="Administrator",a.Handle=-1;b+="<div class=itemBar onclick=showUserDetails("+a.Handle+")><div style=float:right>";0<r&&xxAccountAdminName&&(b+=" "+AddButton2(1==r?"Disable":"Enable","changeAccountStateButton(event,"+a.Handle+","+r+")"));!e&&xxAccountAdminName&&(b+=" "+AddButton2("Edit...",
|
|
"changeAccountButton(event,"+a.Handle+")"));b+='</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="'+d+'"><b>'+d+"</b></div><div style=padding-top:3px>"+p+"</div></div>"}}c='<div style=float:right;margin-right:8px><a title="Toggle hidden accounts" style=color:gray;cursor:pointer onclick=toggleAccountButton()>'+(showHiddenAccounts?"▲":"▼")+"</a></div><div> "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(c+=AddButton("New Account",
|
|
"newAccountButton()"));b+="<br><td class=r1>"+TableEnd(c+"</div>");QH(23,b)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}function changeAccountStateButton(b,c,a){haltEvent(b);xxdialogMode||amtstack.AMT_AuthorizationService_SetAclEnabledState(c,1==a?!1:!0,setAclEnabledStateResponse,c)}
|
|
function changeAccountButton(b,c){haltEvent(b);xxdialogMode||(updateRealms(xxAccountRealmInfo[c].Realms),d2username.value=xxAccountRealmInfo[c].DigestUsername?xxAccountRealmInfo[c].DigestUsername:GetSidString(atob(xxAccountRealmInfo[c].KerberosUserSid)),d2password1.value=d2password2.value="",d2permission.value=xxAccountRealmInfo[c].AccessPermission,setDialogMode(2,"Edit Account",-1==c?3:7,function(a){changeAccountButtonEx(c,a)}),updateAccountDialog())}
|
|
function newAccountButton(){xxdialogMode||(updateRealms([]),d2username.value=d2password1.value=d2password2.value="",d2permission.value=2,setDialogMode(2,"New Account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
|
|
function changeAccountButtonEx(b,c){if(1==c){var a=[],d=d2username.value,e=d2permission.value,r=d2password1.value,p=GetSidByteArray(Q("d2username").value),k=null;if(0==d.length||r!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==p?k=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+r)):(d=null,p=btoa(p));if(-1!=b)for(var q in amtstack.RealmNames)(amtstack.RealmNames[q]||3==q)&&Q("rx"+q).checked&&a.push(q);null==b?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
|
|
k,p,e,a,userAclEntryExResponse):-1==b?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,k,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(b,d,k,p,e,a,userAclEntryExResponse)}2==c&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(b,removeUserAclEntryResponse)}function userAclEntryExResponse(b,c,a,d,e){methodcheck(a)||PullUserInfo()}
|
|
function updateRealms(b){QV(67,null!=b);if(null!=b){var c="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3"+(0<=b.indexOf(3)?" checked":"")+">Administrator</label></li><hr />",a;for(a in amtstack.RealmNames){var d="";0<=b.indexOf(parseInt(a))&&(d=" checked");amtstack.RealmNames[a]&&(c+="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx"+a+d+">"+amtstack.RealmNames[a]+"</label></li>")}QH(68,c)}}
|
|
function updateAccountDialog(){var b=!0;if("none"!=Q(67).style.display){var b=!1,c;for(c in amtstack.RealmNames)(amtstack.RealmNames[c]||3==c)&&Q("rx"+c).checked&&(b=!0)}b&&(b=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value);QE("c49",b)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
|
|
function showUserDetails(b){if(!xxdialogMode){var c=xxAccountRealmInfo[b],a="<div style=text-align:left>",d,e=c.DigestUsername;e||(e=GetSidString(atob(c.KerberosUserSid)));a+=addHtmlValue("Name",e);xxAccountEnabledInfo[b]&&(a+=addHtmlValue("State",1==xxAccountEnabledInfo[b].Enabled?"Enabled":"Disabled"));if(e==xxAccountAdminName)a+=addHtmlValue("Permission","Administrator");else{var a=a+addHtmlValue("Permission",xxUserPermissions[c.AccessPermission]),r="";if(0<=c.Realms.indexOf(3))r="Administrator",
|
|
0<=c.Realms.indexOf(20)&&(r+=", Auditor");else for(d in xxAccountRealmInfo[b].Realms)""!=amtstack.RealmNames[c.Realms[d]]&&(0<r.length&&(r+=", "),r+=amtstack.RealmNames[c.Realms[d]]);0==r.length&&(r="None");a+=addHtmlValue("Realms","")+"<b>"+r+"</b>"}messagebox("Account "+e,a+"</div>")}}
|
|
function wsmanQuery(){QH(26,"");var b=getSelectedOptions(Q(24)),c=[],a;for(a in b)""==QS("WSB-"+b[a]).display&&c.push(b[a]);0!=c.length&&(QE(25,!1),c&&0<c.length&&amtstack.BatchEnum("Browser",c,browserResponse,null,!0))}
|
|
function browserResponse(b,c,a,d){QE(25,!0);b="";for(var e in a)c=a[e],b+="<h2>"+e+"</h2><div style=margin-left:20px>",b=200==c.status?0==c.responses.length?b+"<br>(Empty)":b+ObjectToString(c.responses).replace(/Intel\(r\)/g,"Intel®"):b+("<br><div style=color:red>Error #"+c.status+"</div>"),b+="</div><br>";QH(26,b)}
|
|
function wsmanFilter(){var b=c0.value.toLowerCase(),c;for(c in AllWsman)QV("WSB-"+AllWsman[c],""==b||0<=AllWsman[c].toLowerCase().indexOf(b))}function connectTerminal(){terminal&&(0==terminal.State?(terminal.tlsv1only=amtstack.wsman.comm.tlsv1only,terminal.Start(currentMeshNode._id,16994,"*","*",0)):terminal.Stop())}
|
|
function onTerminalStateChange(b,c){c4.value=0==c?"Connect":"Disconnect";Q(31).textContent=StatusStrs[c];QE(40,3==c);switch(c){case 0:b.m.TermResetScreen();b.m.TermDraw();3==xxdialogMode&&setDialogMode();QV("termRecordIcon",!1);2==b.disconnectCode?messagebox("Remote Terminal","The remote device is busy, a session may already be open."):3==b.disconnectCode&&messagebox("Remote Terminal","The device indicated that this type of connection of not supported.");
|
|
break;case 3:1==b.serverIsRecording&&QV("termRecordIcon",!0)}}function termPaste(){terminal.m.TermSendKeys(d3pastetextarea.value);return!1}function termSendKey(b){terminal.m.TermSendKey(b);return!1}function termToggleSize(){80==terminal.m.width?(Q(33).value="100x30",terminal.m.Init(100,30)):(Q(33).value="80x25",terminal.m.Init(80,25))}var terminalEmulations=["UTF8 Terminal","Extended ASCII","Intel ASCII"];
|
|
function termToggleType(){terminal.m.terminalEmulation=(terminal.m.terminalEmulation+1)%3;Q(35).value=terminalEmulations[terminal.m.terminalEmulation]}function termToggleFx(){Q(34).value=["Intel (F10 = ESC+[OM)","Alternate (F10 = ESC+0)","VT100+ (F10 = ESC+[OY)"][terminal.m.fxEmulation=(terminal.m.fxEmulation+1)%3]}
|
|
function termToggleCr(){"\r\n"==terminal.m.lineFeed?(Q(32).value="LF",terminal.m.lineFeed="\n"):(Q(32).value="CR+LF",terminal.m.lineFeed="\r\n")}
|
|
function terminalCaptureToggle(b){if(!xxdialogMode)if(void 0==terminal.m.capture)terminal.m.capture="",c3.value="Stop Capture";else{if(0<terminal.m.capture.length){b="TerminalCapture";var c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);saveAs(data2blob(terminal.m.capture),b+".txt")}delete terminal.m.capture;
|
|
c3.value="Start Capture"}}function terminal_FileSelectHandler(b){haltEvent(b);if(3==terminal.State&&null!=b.dataTransfer&&1==b.dataTransfer.files.length){var c=new FileReader;c.onload=terminal_onSetupBinRead;c.readAsText(b.dataTransfer.files[0])}}function terminal_onSetupBinRead(b){d3pastetextarea.value=b.target.result;setDialogMode(3,"Paste",3,termPaste)}var desktopScreenInfo=null,desktopPollTimer=null,webRtcDesktop=null;
|
|
function webRtcDesktopReset(){if(null!=webRtcDesktop){null!=webRtcDesktop.softdesktop&&(webRtcDesktop.softdesktop.Stop(),webRtcDesktop.softdesktop=null);if(null!=webRtcDesktop.webchannel){try{webRtcDesktop.webchannel.close()}catch(b){}webRtcDesktop.webchannel=null}if(null!=webRtcDesktop.webrtc){try{webRtcDesktop.webrtc.close()}catch(b){}webRtcDesktop.webrtc=null}webRtcDesktop=null;desktop.m.hold(!1);updateDesktopState();p24files=null;p24downloadFileCancel();p24uploadFileCancel();QV("go24",!1);24==
|
|
currentView&&go(14)}}function connectDesktopButton(b){desktop.disconnectCode=0;connectDesktop(b)}var connectDesktopConsent=!1;
|
|
function connectDesktop(b){desktop&&!xxdialogMode&&(connectDesktopConsent=!1,0==desktop.State?!0!==b&&5<amtversion&&null!=amtsysstate&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&4294967295==amtsysstate.IPS_OptInService.response.OptInRequired?(connectDesktopConsent=!0,amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)):(desktop.m.useRLE=0!=(desktopsettings.encflags&1),desktop.m.bpp=desktopsettings.encflags&2?2:1,desktop.m.graymode=0!=(desktopsettings.encflags&
|
|
4),desktop.m.useZLib=0!=(desktopsettings.encflags&8),desktop.m.showmouse=desktopsettings.showmouse,desktop.m.onScreenSizeChange=center,desktop.m.onKvmData=function(b){var a=null;try{a=JSON.parse(b)}catch(d){}null!=a&&null!=a.action&&("restart"==a.action?(webRtcDesktopReset(),desktop.m.sendKvmData(JSON.stringify({action:"present",ver:1}))):"present"==a.action&&null==webRtcDesktop?(webRtcDesktop={platform:a.platform},"undefined"!==typeof RTCPeerConnection?webRtcDesktop.webrtc=new RTCPeerConnection(null):
|
|
"undefined"!==typeof webkitRTCPeerConnection&&(webRtcDesktop.webrtc=new webkitRTCPeerConnection(null)),webRtcDesktop.webchannel=webRtcDesktop.webrtc.createDataChannel("DataChannel",{}),webRtcDesktop.webchannel.onopen=function(){urlvars&&urlvars.kvmdatatrace&&console.log("WebRTC Data Channel Open");desktop.m.hold(!0);webRtcDesktop.webRtcActive=!0;webRtcDesktop.softdesktop=CreateKvmDataChannel(webRtcDesktop.webchannel,CreateAgentRemoteDesktop("Desk",Q(8)),desktop.m);webRtcDesktop.softdesktop.m.setRotation(desktop.m.rotation);
|
|
desktopsettings.quality&&(webRtcDesktop.softdesktop.m.CompressionLevel=desktopsettings.quality);desktopsettings.scaling&&(webRtcDesktop.softdesktop.m.ScalingLevel=desktopsettings.scaling);webRtcDesktop.softdesktop.Start();updateDesktopState();QV("go24",!0);downloadFile=null;p24files=webRtcDesktop.softdesktop;p24targetpath="";webRtcDesktop.softdesktop.onControlMsg=onFilesControlData;webRtcDesktop.softdesktop.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:""}))},webRtcDesktop.webchannel.onclose=
|
|
function(a){urlvars.kvmdatatrace&&console.log("WebRTC Data Channel Closed");webRtcDesktopReset()},webRtcDesktop.webrtc.onicecandidate=function(a){null==a.candidate?desktop.m.sendKvmData(JSON.stringify({action:"offer",ver:1,sdp:webRtcDesktop.webrtcoffer.sdp})):webRtcDesktop.webrtcoffer.sdp+="a="+a.candidate.candidate+"\r\n"},webRtcDesktop.webrtc.oniceconnectionstatechange=function(){null==webRtcDesktop||null==webRtcDesktop.webrtc||"disconnected"!=webRtcDesktop.webrtc.iceConnectionState&&"failed"!=
|
|
webRtcDesktop.webrtc.iceConnectionState||webRtcDesktopReset()},webRtcDesktop.webrtc.createOffer(function(a){webRtcDesktop.webrtcoffer=a;webRtcDesktop.webrtc.setLocalDescription(a,function(){},webRtcDesktopReset)},webRtcDesktopReset,{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}})):"answer"==a.action&&null!=webRtcDesktop&&webRtcDesktop.webrtc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:a.sdp}),function(){},webRtcDesktopReset))},desktop.m.kvmExtChanged=15<amtversion||
|
|
urlvars.kvmext?updateDesktopState:null,desktop.m.frameRateDelay=1==desktopsettings.limitFrameRate?200:0,desktop.m.noMouseRotate=desktopsettings.noMouseRotate,desktop.tlsv1only=amtstack.wsman.comm.tlsv1only,desktop.Start(currentMeshNode._id,16994,"*","*",0),PullDesktopDisplayInfo(),urlvars.norefresh||(desktopPollTimer=setInterval(PullDesktopDisplayInfo,5E3))):(desktop.Stop(),clearInterval(desktopPollTimer),desktopPollTimer=null,PullDesktopDisplayInfo(),webRtcDesktopReset()))}
|
|
function PullDesktopDisplayInfo(){7<amtversion&&0<desktop.State?amtstack.BatchEnum("",["*IPS_ScreenSettingData","*IPS_KVMRedirectionSettingData"],ProcessDesktopDisplayInfo):(desktopScreenInfo=null,Q(48).innerHTML="")}function ProcessDesktopDisplayInfo(b,c,a,d){200!=d?desktopScreenInfo=null:(desktopScreenInfo=a.IPS_ScreenSettingData.responses.Body,desktopScreenInfo.KVMRSD=a.IPS_KVMRedirectionSettingData.responses.Body,UpdateDesktopDisplayInfo())}
|
|
function UpdateDesktopDisplayInfo(){for(var b="",c=0,a=0;3>a;a++)1==desktopScreenInfo.IsActive[a]&&(c++,b+='<input type="button" '+(a==desktopScreenInfo.KVMRSD.DefaultScreen?'style="background-color:DodgerBlue"':"")+' value="'+(a+1)+'" title="Switch to screen '+(a+1)+'" onkeypress="return false" onkeydown="return false" onclick="desktopSwitchScreen('+a+')"> ');1<c?Q(48).innerHTML=b+" ":Q(48).innerHTML=""}
|
|
function desktopSwitchScreen(b){var c=Clone(desktopScreenInfo.KVMRSD);c.DefaultScreen=b;amtstack.Put("IPS_KVMRedirectionSettingData",c,desktopSwitchScreenEx)}function desktopSwitchScreenEx(b,c,a,d){200==d&&(desktopScreenInfo.KVMRSD=a.Body,UpdateDesktopDisplayInfo())}
|
|
function onDesktopStateChange(b,c){var a=!1;c10.value=0==c?"Connect":"Disconnect";var d=3==c&&!urlvars.kvmviewonly;QE(49,d);QE("deskkeys",d);QE("DeskWD",d);QE(50,d);switch(c){case 0:webRtcDesktopReset();QV("deskRecordIcon",!1);2==b.disconnectCode?messagebox("Remote Desktop","The remote device is busy, a session may already be open."):3==b.disconnectCode?messagebox("Remote Desktop","The device indicated that this type of connection of not supported."):5E4==b.disconnectCode?
|
|
messagebox("Remote Desktop","KVM disconnection, they may indicate that Intel AMT is unable to capture the display (Try RLE8 encoding), or unsupported GPU."):50001==b.disconnectCode&&(a=!0);break;case 3:12<=amtversion&&b.m.sendKvmData(JSON.stringify({action:"present",ver:1})),1==b.serverIsRecording&&QV("deskRecordIcon",!0)}center();updateDesktopState();a&&setTimeout(connectDesktop,200)}
|
|
function updateDesktopState(){var b="";3==desktop.State&&(webRtcDesktop&&1==webRtcDesktop.webRtcActive?b=", Soft-KVM":desktop.m&&desktop.m.kvmExt&&(2==desktop.m.kvmExt.decimation&&(b+=", Gray"),1==desktop.m.kvmExt.compression&&(b+=", ZLib")));Q(46).textContent=StatusStrs[desktop.State]+b}function showDesktopSettings(){xxdialogMode||(applyDesktopSettings(),setDialogMode(7,"Remote Desktop Settings",3,showDesktopSettingsChanged))}
|
|
function showDesktopSettingsChanged(){desktopsettings.encflags=parseInt(c11.value);desktopsettings.showmouse=d7showcursor.checked;desktopsettings.showcad=d7showcad.checked;desktopsettings.limitFrameRate=d7limitFrameRate.checked;desktopsettings.noMouseRotate=d7noMouseRotate.checked;desktopsettings.quality=d7bitmapquality.value;desktopsettings.scaling=d7bitmapscaling.value;try{localStorage.setItem("desktopsettings",JSON.stringify(desktopsettings))}catch(b){}applyDesktopSettings();desktop.m.frameRateDelay=
|
|
1==desktopsettings.limitFrameRate?200:0;0!=desktop.State&&(desktop.disconnectCode=0,desktop.Stop(),setTimeout(connectDesktop,50))}
|
|
function applyDesktopSettings(){15>amtversion&&(desktopsettings.encflags&=3);c11.value=desktopsettings.encflags;d7showcursor.checked=desktopsettings.showmouse;d7showcad.checked=desktopsettings.showcad;d7limitFrameRate.checked=desktopsettings.limitFrameRate;d7noMouseRotate.checked=desktopsettings.noMouseRotate;desktopsettings.quality&&(d7bitmapquality.value=desktopsettings.quality);desktopsettings.scaling&&(d7bitmapscaling.value=desktopsettings.scaling);QV("d7softkvmsettings",12<=amtversion);
|
|
QV("d7exm1",15<amtversion||urlvars.kvmext);QV("d7exm2",15<amtversion||urlvars.kvmext);QV("d7exm3",15<amtversion||urlvars.kvmext);QV("d7exm4",15<amtversion||urlvars.kvmext);QV("d7exm5",15<amtversion||urlvars.kvmext);QV("d7exm6",15<amtversion||urlvars.kvmext);QV(49,desktopsettings.showcad)}var fullscreen=!1,fullscreenonly=!1;
|
|
function deskToggleFull(b){xxdialogMode||(1==fullscreenonly?(console.log("deskToggleFull1",fullscreenonly,urlvars.kvmonly),fullscreenonly=!1,1==urlvars.kvmonly?console.log("deskToggleFull2"):disconnect()):(fullscreenonly=b,fullscreen=!fullscreen,QV(7,!fullscreen),QV(41,!fullscreen),QV("c5",!fullscreen),QV("c9",fullscreen),fullscreen?(QS(8).left=0,QS(16).padding=0):(QS(8).left="156px",QS(16).padding=
|
|
"8px"),center()))}function deskShowTypeDialog(){xxdialogMode||3!=desktop.State||(Q(50).blur(),setDialogMode(11,"Remote Keyboard Entry",3,showDeskTypeEx,'<div>Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding.<div><textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>'),Q("d2typeText").focus())}
|
|
var AmtDeskTypeTimer=null,AmtDeskTypeContent=null,DeskTypeTranslate={39:222,42:106,43:107,44:188,45:189,46:190,47:191,59:186,61:187,91:219,92:220,93:221,96:192,191:111},DeskTypeShiftTranslate={33:49,34:222,35:51,36:52,37:53,38:55,40:57,41:48,58:186,60:188,62:190,63:191,64:50,94:54,95:189,106:56,107:187,123:219,124:220,125:221,126:192};
|
|
function showDeskTypeEx(){var b=Q("d2typeText").value;Q("d2typeText").value.toUpperCase();var c=[],a;for(a in b){var d=b.charCodeAt(a);c.push([d,1],[d,0])}AmtDeskTypeContent=c;AmtDeskTypeTimer=setInterval(function(){var a=AmtDeskTypeContent.shift();desktop&&desktop.m.sendkey(a[0],a[1]);if(null==desktop||0==AmtDeskTypeContent.length)clearInterval(AmtDeskTypeTimer),AmtDeskTypeContent=null},10)}function sendCAD(){Q(54).checked||desktop.m.sendcad()}
|
|
var deskkeysset={0:[[65511,1],[65511,0]],1:[[65511,1],[65364,1],[65364,0],[65511,0]],2:[[65511,1],[65362,1],[65362,0],[65511,0]],3:[[65511,1],[108,1],[108,0],[65511,0]],4:[[65511,1],[109,1],[109,0],[65511,0]],5:[[65505,1],[65511,1],[109,1],[109,0],[65511,0],[65505,0]],6:[[65470,1],[65470,0]],7:[[65471,1],[65471,0]],8:[[65472,1],[65472,0]],9:[[65473,1],[65473,0]],10:[[65474,1],[65474,0]],11:[[65475,1],[65475,0]],12:[[65476,1],[65476,0]],13:[[65477,1],[65477,0]],14:[[65478,1],[65478,0]],15:[[65479,
|
|
1],[65479,0]],16:[[65480,1],[65480,0]],17:[[65481,1],[65481,0]],19:[[65513,1],[65289,1],[65289,0],[65513,0]],20:[[65511,1],[114,1],[114,0],[65511,0]],21:[[65513,1],[65473,1],[65473,0],[65513,0]],22:[[65507,1],[119,1],[119,0],[65507,0]],23:[[65511,1],[65361,1],[65361,0],[65511,0]],24:[[65511,1],[65363,1],[65363,0],[65511,0]]};
|
|
function deskSendKeys(){if(!Q(54).checked){var b=Q("deskkeys").value;if(null!=b&&null!=deskkeysset[b]&&0!=desktop.State)for(var c=0;c<deskkeysset[b].length;c++)desktop.m.sendkey(deskkeysset[b][c][0],deskkeysset[b][c][1])}}
|
|
function deskSaveImage(){if(!(xxdialogMode||3!=desktop.State||urlvars&&urlvars.norecord)){var b="Desktop",c=new Date;amtsysstate&&(b+="-"+amtsysstate.AMT_GeneralSettings.response.HostName);b+="-"+c.getFullYear()+"-"+("0"+(c.getMonth()+1)).slice(-2)+"-"+("0"+c.getDate()).slice(-2)+"-"+("0"+c.getHours()).slice(-2)+"-"+("0"+c.getMinutes()).slice(-2);Q("Desk").toBlob(function(a){saveAs(a,b+".jpg")})}}
|
|
function dmousedown(b){xxdialogMode||Q(54).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousedown(b),desktop.m.sendKeepAlive()):desktop.m.mousedown(b))}function dmouseup(b){xxdialogMode||Q(54).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mouseup(b),desktop.m.sendKeepAlive()):desktop.m.mouseup(b))}
|
|
function dmousemove(b){xxdialogMode||Q(54).checked||(null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop?(webRtcDesktop.softdesktop.m.mousemove(b),desktop.m.sendKeepAlive()):desktop.m.mousemove(b))}function dmousewheel(b){xxdialogMode||Q(54).checked||null==webRtcDesktop||null==webRtcDesktop.softdesktop||(webRtcDesktop.softdesktop.m.mousewheel(b),desktop.m.sendKeepAlive())}
|
|
function drotate(b){xxdialogMode||(b=desktop.m.rotation+b,desktop.m.setRotation(b),null!=webRtcDesktop&&null!=webRtcDesktop.softdesktop&&null!=webRtcDesktop.softdesktop.m&&webRtcDesktop.softdesktop.m.setRotation(b),center())}var p24files=null,p24filetree=null,p24targetpath=null,p24filetreelocation=[];
|
|
function onFilesControlData(b){if(0<b.length&&123!=b.charCodeAt(0))p24gotDownloadBinaryData(b);else if(b=JSON.parse(b),"download"==b.action)p24gotDownloadCommand(b);else if("upload"==b.action)p24gotUploadData(b);else if("pong"!=b.action)if(b.path=b.path.replace(/\//g,"\\"),null!=p24filetree&&b.path==p24filetree.path){var c=p24getCheckedNames();p24filetree=b;p24updateFiles(c)}else{for(var c=b.path.split("/").join("\\"),a=p24targetpath.split("/").join("\\");0<c.length&&"\\"==c[0];)c=c.substring(1);
|
|
for(;0<a.length&&"\\"==a[0];)a=a.substring(1);if(c==a||"\\"==b.path&&""==p24targetpath)p24filetree=b,p24updateFiles()}}function p24getCheckedNames(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);return b}
|
|
function p24updateFiles(b){var c="",a="",d="<a style=cursor:pointer onclick=p24folderup(0)>Root</a>",e=p24filetree.path.split("\\");p24filetreelocation=[];for(var r in e)""!=e[r]&&p24filetreelocation.push(e[r]);for(r in p24filetreelocation)d+=" / <a style=cursor:pointer onclick=p24folderup("+(parseInt(r)+1)+")>"+p24filetreelocation[r]+"</a>";var e=p24filetreelocation.join("/"),p=p24sort_files(p24filetree.dir);for(r in p){var k=p[r],q=k.n,m;m=70<q.length?'<span title="'+EscapeHtml(q)+'">'+EscapeHtml(q.substring(0,
|
|
70))+"...</span>":EscapeHtml(q);var q=EscapeHtml(q),w="";null!=k.d&&(w=new Date(k.d),w=w.getMonth()+1+"/"+w.getDate()+"/"+w.getFullYear()+" "+w.toLocaleTimeString()+" ");var l="";null!=k.s&&(l=getFileSizeStr(k.s));var x="";3>k.t?x='<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+k.nx+'"> <span style=float:right title=""></span><span><div class=fileIcon'+k.t+'></div><a style=cursor:pointer onclick=p24folderset("'+
|
|
encodeURIComponent(k.nx)+'")>'+m+"</a></span></div>":(x=m,0<k.s&&(x='<a rel="noreferrer noopener" target="_blank" style=cursor:pointer onclick=\'p24downloadfile("'+encodeURIComponent(e+"/"+q)+'","'+encodeURIComponent(q)+'",'+k.s+")'>"+m+"</a>"),x='<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="'+k.nx+'"> <span class=fsize>'+w+"</span><span style=float:right>"+l+"</span><span><div class=fileIcon"+k.t+"></div>"+x+"</span></div>");
|
|
3>k.t?c+=x:a+=x}QH("p24files",c+a);QH("p24currentpath",d);QE("p24FolderUp",0!=p24filetreelocation.length);if(null!=b)for(c=document.getElementsByName("fd"),r=0;r<c.length;r++)0<=b.indexOf(p24filetree.dir[c[r].value].n)&&(c[r].checked=!0);p24setActions()}function p24folderset(b){p24targetpath=joinPaths(p24filetree.path,p24filetree.dir[b].n).split("\\").join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}
|
|
function p24folderup(b){if(null==b)p24filetreelocation.pop();else for(;p24filetreelocation.length>b;)p24filetreelocation.pop();p24targetpath=p24filetreelocation.join("/");p24files.sendCtrlMsg(JSON.stringify({action:"ls",reqid:1,path:p24targetpath}))}var p24sortorder;function p24sort_filename(b,c){return b.ln>c.ln?1*p24sortorder:b.ln<c.ln?-1*p24sortorder:0}function p24sort_timestamp(b,c){return b.d>c.d?1*p24sortorder:b.d<c.d?-1*p24sortorder:0}
|
|
function p24sort_bysize(b,c){return b.s==c.s?p24sort_filename(b,c):(b.s-c.s)*p24sortorder}function p24sort_files(b){var c=[],a=Q("p24sortdropdown").value,d;for(d in b)b[d].nx=d,null==b[d].s&&(b[d].s=0),null==b[d].n&&(b[d].n=d),b[d].ln=b[d].n.toLowerCase(),c.push(b[d]);p24sortorder=1;3<a&&(p24sortorder=-1,a-=3);1==a?c.sort(p24sort_filename):2==a?c.sort(p24sort_bysize):3==a&&c.sort(p24sort_timestamp);return c}
|
|
function p24setActions(){if(null==p24filetree)QE("p24DeleteFileButton",!1),QE("p24NewFolderButton",!1),QE("p24UploadButton",!1),QE("p24RenameFileButton",!1),QE("p24SelectAllButton",!1),Q("p24SelectAllButton").value="Select All",QE("p24RefreshButton",!1),QE("p24CutButton",!1),QE("p24CopyButton",!1),QE("p24PasteButton",!1);else{var b=p24getFileSelCount(),c=p24getFileCount(),a=p24getFileSelCount(!1),d="win32"==webRtcDesktop.platform;QE("p24DeleteFileButton",0<b&&(0<p24filetreelocation.length||0==d));
|
|
QE("p24NewFolderButton",0<p24filetreelocation.length||0==d);QE("p24UploadButton",0<p24filetreelocation.length||0==d);QE("p24RenameFileButton",1==b&&(0<p24filetreelocation.length||0==d));QE("p24SelectAllButton",0<c);Q("p24SelectAllButton").value=0<b?"Select None":"Select All";QE("p24RefreshButton",!0);QE("p24CutButton",0<b&&b==a&&(0<p24filetreelocation.length||0==d));QE("p24CopyButton",0<b&&b==a&&(0<p24filetreelocation.length||0==d));QE("p24PasteButton",(0<p24filetreelocation.length||0==d)&&null!=
|
|
p24clipboard&&0<p24clipboard.length)}}function p24getFileSelCount(b){for(var c=0,a=document.getElementsByName("fd"),d=0;d<a.length;d++)!a[d].checked||0==b&&"3"!=a[d].attributes.file.value||c++;return c}function p24getFileCount(){return document.getElementsByName("fd").length}function p24selectallfile(){for(var b=0==p24getFileSelCount(),c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked=b;p24setActions()}
|
|
function p24createfolder(){setDialogMode(11,"New Folder",3,p24createfolderEx,"<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% />");focusTextBox("p24renameinput");p24fileNameCheck()}function p24createfolderEx(){p24files.sendCtrlMsg(JSON.stringify({action:"mkdir",reqid:1,path:p24filetreelocation.join("/")+"/"+Q("p24renameinput").value}));p24folderup(999)}
|
|
function p24deletefile(){var b=p24getFileSelCount();setDialogMode(11,"Delete",3,p24deletefileEx,1<b?"Delete "+b+" selected items?":"Delete selected item?")}function p24deletefileEx(){for(var b=[],c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&b.push(p24filetree.dir[c[a].value].n);p24files.sendCtrlMsg(JSON.stringify({action:"rm",reqid:1,path:p24filetreelocation.join("/"),delfiles:b}));p24folderup(999)}
|
|
function p24renamefile(){for(var b,c=document.getElementsByName("fd"),a=0;a<c.length;a++)c[a].checked&&(b=p24filetree.dir[c[a].value].n);setDialogMode(11,"Rename",3,p24renamefileEx,'<input type=text id=p24renameinput maxlength=64 onkeyup=p24fileNameCheck(event) style=width:100% value="'+b+'" />',{action:"rename",path:p24filetreelocation.join("/"),oldname:b});focusTextBox("p24renameinput");p24fileNameCheck()}
|
|
function p24renamefileEx(b,c){c.newname=Q("p24renameinput").value;p24files.sendCtrlMsg(JSON.stringify(c));p24folderup(999)}function p24fileNameCheck(b){var c=isFilenameValid(Q("p24renameinput").value);QE("c49",c);1==c&&null!=b&&24==b.keyCode&&dialogclose(1)}
|
|
function p24uploadFile(){setDialogMode(11,"Upload File",3,p24uploadFileEx,"<input type=file name=files id=p24uploadinput style=width:100% multiple=multiple onchange=\"updateUploadDialogOk('p24uploadinput')\" />");updateUploadDialogOk("p24uploadinput")}function p24uploadFileEx(){p24doUploadFiles(Q("p24uploadinput").files)}function updateUploadDialogOk(b){QE("c49",""!=Q(b).value)}var p24clipboard=null,p24clipboardFolder=null,p24clipboardCut=0;
|
|
function p24copyFile(b){var c=document.getElementsByName("fd");p24clipboard=[];p24clipboardCut=b;p24clipboardFolder=p24targetpath;for(b=0;b<c.length;b++)c[b].checked&&"3"==c[b].attributes.file.value&&p24clipboard.push(p24filetree.dir[c[b].value].n);p24updateClipview()}
|
|
function p24pasteFile(){var b="";null!=p24clipboard&&0<p24clipboard.length&&(b="Confim "+(0==p24clipboardCut?"copy":"move")+" of "+p24clipboard.length+" entrie"+(1<p24clipboard.length?"s":"")+" to this location?");setDialogMode(11,"Paste",3,p24pasteFileEx,b)}
|
|
function p24pasteFileEx(){p24files.sendCtrlMsg(JSON.stringify({action:0==p24clipboardCut?"copy":"move",reqid:1,scpath:p24clipboardFolder,dspath:p24targetpath,names:p24clipboard}));p24folderup(999);1==p24clipboardCut&&(p24clipboardFolder=p24clipboard=null,p24clipboardCut=0,p24updateClipview())}
|
|
function p24updateClipview(){var b="";null!=p24clipboard&&0<p24clipboard.length&&(b="Holding "+p24clipboard.length+" entrie"+(1<p24clipboard.length?"s":"")+" for "+(0==p24clipboardCut?"copy":"move")+", <a onclick=p24clearClip() style=cursor:pointer>Clear</a>.");QH("p24bottomstatus",b);p24setActions()}function p24clearClip(){p24clipboardFolder=p24clipboard=null;p24clipboardCut=0;p24updateClipview()}
|
|
function p24fileDragDrop(b){haltEvent(b);QV("p24bigfail",!1);QV("p24bigok",!1);null!=b.dataTransfer&&0!=b.dataTransfer.files.length&&null!=p24filetree&&(0==p24filetreelocation.length&&"win32"==webRtcDesktop.platform||p24doUploadFiles(b.dataTransfer.files))}var p24dragtimer=null;
|
|
function p24fileDragOver(b){haltEvent(b);null!=p24dragtimer&&(clearTimeout(p24dragtimer),p24dragtimer=null);b=null!=p24filetree;0==p24filetreelocation.length&&"win32"==webRtcDesktop.platform&&(b=!1);QV("p24bigok",b);QV("p24bigfail",!b)}function p24fileDragLeave(b){haltEvent(b);"p24filetable"!=b.target.id?(QV("p24bigfail",!1),QV("p24bigok",!1)):p24dragtimer=setTimeout(function(){QV("p24bigfail",!1);QV("p24bigok",!1);p24dragtimer=null},200)}
|
|
function getFileSizeStr(b){return 1==b?"1 byte":format("{0} bytes",b)}function joinPaths(){var b=[],c;for(c in arguments){var a=arguments[c];if(null!=a&&""!=a){for(;a.endsWith("/")||a.endsWith("\\");)a=a.substring(0,a.length-1);for(;a.startsWith("/")||a.startsWith("\\");)a=a.substring(1);b.push(a)}}return b.join("/")}var isFilenameValid=function(){var b=/^[^\\/:\*\?"<>\|]+$/,c=/^\./,a=/^(nul|prn|con|lpt[0-9]|com[0-9])(\.|$)/i;return function(d){return b.test(d)&&!c.test(d)&&!a.test(d)&&"."!=d[0]}}();
|
|
function focusTextBox(b){setTimeout(function(){Q(b).selectionStart=Q(b).selectionEnd=65535;Q(b).focus()},0)}var downloadFile;
|
|
function p24downloadfile(b,c,a){xxdialogMode||downloadFile||!p24files||(downloadFile={path:decodeURIComponent(b),file:decodeURIComponent(c),size:a,tsize:0,data:"",state:0,id:Math.random()},p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"start",id:downloadFile.id,path:downloadFile.path})),setDialogMode(11,"Download File",10,p24downloadFileCancel,"<div>"+downloadFile.file+"</div><br /><progress id=d2progressBar style=width:100% value=0 max="+a+" />"))}
|
|
function p24downloadFileCancel(){null!=downloadFile&&(setDialogMode(0),null!=p24files&&p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"cancel",id:downloadFile.id})),downloadFile=null)}function p24gotDownloadCommand(b){null!=downloadFile&&b.id==downloadFile.id&&("start"==b.sub?(downloadFile.state=1,p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"startack",id:downloadFile.id}))):"cancel"==b.sub&&(downloadFile=null,setDialogMode(0)))}
|
|
function p24gotDownloadBinaryData(b){if(downloadFile&&0!=downloadFile.state){try{b=atob(b)}catch(c){return}null==b||4>b.length||(4<b.length&&(downloadFile.tsize+=b.length-4,downloadFile.data+=b.substring(4),Q("d2progressBar").value=downloadFile.tsize),0!=(ReadInt(b,0)&1)?(saveAs(data2blob(downloadFile.data),downloadFile.file),downloadFile=null,setDialogMode(0)):p24files.sendCtrlMsg(JSON.stringify({action:"download",sub:"ack",id:downloadFile.id})))}}var uploadFile;
|
|
function p24doUploadFiles(b){xxdialogMode||(uploadFile={xpath:p24filetreelocation.join("/"),xfiles:b,xfilePtr:-1},setDialogMode(11,"Upload File",10,p24uploadFileCancel,"<div id=p24dfileName>Setting up...</div><br /><progress id=d2progressBar style=width:100% value=0 max=0 />",99),p24uploadNextFile())}
|
|
function p24uploadNextFile(){uploadFile.xfilePtr++;if(uploadFile.xfiles.length>uploadFile.xfilePtr){uploadFile.xptr=0;var b=uploadFile.xfiles[uploadFile.xfilePtr];QH("p24dfileName",b.name);Q("d2progressBar").max=b.size;Q("d2progressBar").value=0;uploadFile.xreader=new FileReader;uploadFile.xreader.onload=function(){uploadFile.xdata=uploadFile.xreader.result;p24files.sendCtrlMsg(JSON.stringify({action:"upload",sub:"start",reqid:uploadFile.xfilePtr,path:uploadFile.xpath,name:b.name,size:uploadFile.xdata.byteLength}))};
|
|
uploadFile.xreader.onerror=function(){p24uploadNextFile()};uploadFile.xreader.readAsArrayBuffer(b)}else p24uploadFileCancel(),p24folderup(9999)}function p24uploadFileCancel(b,c){null!=uploadFile&&(uploadFile=null,setDialogMode(0),99==c&&null!=p24files&&p24files.sendCtrlMsg(JSON.stringify({action:"upload",sub:"cancel"})))}
|
|
function p24gotUploadData(b){if(null!=uploadFile&&parseInt(uploadFile.xfilePtr)==parseInt(b.reqid))if("start"==b.sub)for(p24uploadNextPart(!1),b=0;8>b;b++)p24uploadNextPart(!0);else"ack"==b.sub?p24uploadNextPart(!1):"error"==b.sub&&p24uploadFileCancel()}function ab2str(b){return String.fromCharCode.apply(null,new Uint8Array(b))}
|
|
function p24uploadNextPart(b){var c=uploadFile.xdata,a=uploadFile.xptr,d=uploadFile.xptr+4096;if(d>c.byteLength){if(1==b)return;d=c.byteLength}a==c.byteLength?p24uploadNextFile():(p24files.sendCtrlMsg(btoa(IntToStr(d!=c.byteLength?16777216:16777217)+ab2str(c.slice(a,d)))),uploadFile.xptr=d,Q("d2progressBar").value=d)}var ider,iderCodeBlock,iderTimer;
|
|
function iderStart(b){if(!xxdialogMode){b="<div>Mount disk images on a Intel® AMT computer - Experimental.</div><br />"+('<div style=height:26px><input id=floppyImageInput type=file style=float:right;width:250px accept=".img"><div>'+NoBreak("Floppy (.img)")+"</div></div>");b+='<div style=height:26px><input id=cdromImageInput type=file style=float:right;width:250px accept=".iso"><div>'+NoBreak("CDROM (.iso)")+"</div></div>";setDialogMode(11,"Storage Redirection",3,iderStart2,b+"<div style=height:26px><select id=iderStartType style=float:right;width:250px><option value=0>On next boot<option value=1>Graceful<option value=2>Immediate</select><div>Session Start</div></div>");
|
|
b=null;try{b=localStorage.getItem("iderurl")}catch(c){}b&&(Q("storageserverurl").value=b.substring(1,b.length-1))}}
|
|
function iderStart2(){if(1!=Q("floppyImageInput").files.length&&1!=Q("cdromImageInput").files.length)messagebox("Storage Redirection Error","At least one disk image file must be selected.");else if(1==Q("floppyImageInput").files.length&&0!=Q("floppyImageInput").files[0].size%512)messagebox("Storage Redirection Error","Invalid .img file.");else if(1==Q("cdromImageInput").files.length&&0!=Q("cdromImageInput").files[0].size%2048)messagebox("Storage Redirection Error","Invalid .iso file.");else{var b=
|
|
null,c=null;1==Q("floppyImageInput").files.length&&(b=Q("floppyImageInput").files[0]);1==Q("cdromImageInput").files.length&&(c=Q("cdromImageInput").files[0]);null==b&&null==c||iderStart3(b,c,Q("iderStartType").value)}}
|
|
function iderStart3(b,c,a){iderStop();ider=CreateAmtRedirect(CreateAmtRemoteIder());ider.onStateChanged=onIderStateChange;ider.m.floppy=b;ider.m.cdrom=c;ider.m.iderStart=a;ider.m.sectorStats=iderSectorStats;ider.tlsv1only=amtstack.wsman.comm.tlsv1only;ider.Start(currentMeshNode._id,16994,"*","*",0);QV("IDERDiskMapButton",!0)}
|
|
function iderStop(){ider&&(ider.m.Stop(),ider.onStateChanged=null,ider.m.onDialogPrompt=null,delete ider);iderTimer&&(clearInterval(iderTimer),delete iderTimer);iderToggleDiskMap(!1)}function onIderStateChange(b,c){QE("c2",3!=c);QE("c8",3!=c);QE("c1",3!=c);QE("c7",3!=c);QV(9,3==c);center();3==c?(urlvars.norefresh||(iderTimer=setInterval(onIderTimer,500)),onIderTimer()):iderTimer&&(clearInterval(iderTimer),delete iderTimer)}
|
|
function onIderTimer(){ider.m.Update&&ider.m.Update();-1==ider.m.bytesFromAmt?iderStop():QH(10,"<b>"+(ider.m.server?"Server ":"")+"IDE-R Session</b>, Connected, "+ider.m.bytesFromAmt+" in, "+ider.m.bytesToAmt+" out.")}var heatMapWidth=600,heatMapDividor={};
|
|
function iderSectorStats(b,c,a,d,e){var r=c?Q("cdromHeatMapCanvas"):Q("floppyHeatMapCanvas"),p=r.getContext("2d");if(0==b){heatMapDividor[c]=1;if(0<a)for(;8E3<a/heatMapDividor[c];)heatMapDividor[c]*=2;c?(QV("cdromHeatMap",a),QH("cdromHeatMapText",format("<b>CDROM</b>, blocks are {0} bytes.",2048*heatMapDividor[c]))):(QV("floppyHeatMap",a),QH("floppyHeatMapText",format("<b>Floppy</b>, blocks are {0} bytes.",512*heatMapDividor[c])))}c=heatMapDividor[c];a/=c;d/=c;e/=c;if(0==b)r.height=6*(Math.floor(a/
|
|
(heatMapWidth/6))+(a%heatMapWidth?1:0)),p.fillStyle="rgba(225,250,225,1)",p.fillRect(0,0,heatMapWidth,6*Math.floor(a/(heatMapWidth/6))),a%heatMapWidth&&p.fillRect(0,6*Math.floor(a/(heatMapWidth/6)),a%(heatMapWidth/6)*6,6),p.fillStyle="rgba(0,0,0,0.3)";else for(b=d;b<d+e;b++)sectorHeat(p,b,6,c)}function sectorHeat(b,c,a,d){b.fillRect(c%(heatMapWidth/a)*a,Math.floor(c/(heatMapWidth/a))*a,a,a)}
|
|
function iderToggleDiskMap(b){var c="none"!=QS("iderHeatmap").display;null==b&&(b=!c);xxdialogMode&&(b=!1);QS("iderHeatmap").display=b?"":"none"}function onIderDialogPrompt(b,c,a){iderCodeBlock&&(document.body.removeChild(iderCodeBlock),delete iderCodeBlock);c.js&&(b=document.createElement("script"),b.text=c.js,iderCodeBlock=document.body.appendChild(b));setDialogMode(11,"Storage Redirection",a?a:3,onIderDialogPromptOk,c.html)}
|
|
function onIderDialogPromptOk(b){1==b?window.iderServerCall?ider.m.dialogPrompt(window.iderServerCall()):ider.m.dialogPrompt():iderStop()}function iderServerStart(){xxdialogMode||(iderStop(),ider=CreateAmtRemoteServerIder(),null!=ider&&(ider.onStateChanged=onIderStateChange,ider.m.sectorStats=iderSectorStats,ider.m.onDialogPrompt=onIderDialogPrompt,ider.tlsv1only=amtstack.wsman.comm.tlsv1only,ider.Start(currentMeshNode._id,16994,"*","*",0)))}
|
|
var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
|
|
function PullRemoteAccess(){var b="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11<amtversion&&b.push("*IPS_HTTPProxyService","IPS_HTTPProxyAccessPoint");amtstack.BatchEnum(null,b,processRemote1)}
|
|
function processRemote1(b,c,a,d){if(11<amtversion&&400==d){d=200;400==a.IPS_HTTPProxyAccessPoint.status&&delete a.IPS_HTTPProxyAccessPoint;400==a.IPS_HTTPProxyService.status&&delete a.IPS_HTTPProxyService;for(var e in a)200!=a[e].status&&(d=a[e].status)}if(400!=d&&!errcheck(d,b)&&void 0!=a.AMT_UserInitiatedConnectionService&&void 0!=a.AMT_UserInitiatedConnectionService.response){QV("go17",!0);xxRemoteAccess=a;xxEnvironementDetection=a.AMT_EnvironmentDetectionSettingData.response;xxEnvironementDetection.DetectionStrings=
|
|
MakeToArray(xxEnvironementDetection.DetectionStrings);xxCiraServers=a.AMT_ManagementPresenceRemoteSAP.responses;xxUserInitiatedCira=a.AMT_UserInitiatedConnectionService.response;xxRemoteAccessCredentiaLinks=a.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=a.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(e in a.AMT_RemoteAccessPolicyAppliesToMPS.responses)c=a.AMT_RemoteAccessPolicyAppliesToMPS.responses[e],b=Clone(getItem(xxCiraServers,"Name",getItem(c.ManagedElement.ReferenceParameters.SelectorSet.Selector,
|
|
"@Name","Name").Value)),b.MpsType=c.MpsType,c=getItem(c.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],xxPolicies[c].push(b);updateRemoteAccess()}}
|
|
function updateRemoteAccess(){if(null!=xxEnvironementDetection){var b,c="Disabled",a=xxRemoteAccess.IPS_HTTPProxyService&&xxRemoteAccess.IPS_HTTPProxyAccessPoint;xxEnvironementDetection.DetectionStrings&&0<xxEnvironementDetection.DetectionStrings.length&&(c="Enabled, "+xxEnvironementDetection.DetectionStrings.length+" "+(1<xxEnvironementDetection.DetectionStrings.length?"domains":"domain"));b=""+TableStart();b+=TableEntry("Environment detection",addLink(c,"editEnvironmentDetection()"));b+=TableEntry("User initiation options",
|
|
addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));c="<i>None</i>";if(0<xxPolicies.User.length){var c="",d;for(d in xxPolicies.User)0<c.length&&(c+=", "),c+=xxPolicies.User[d].AccessInfo,1==xxPolicies.User[d].MpsType&&(c+=" (CILA)")}b+=TableEntry("User initiated connection",addLinkConditional(c,'editMpsPolicy("User")',xxAccountAdminName));c="<i>None</i>";if(0<xxPolicies.Alert.length)for(d in c="",xxPolicies.Alert)0<c.length&&
|
|
(c+=", "),c+=xxPolicies.Alert[d].AccessInfo,1==xxPolicies.Alert[d].MpsType&&(c+=" (CILA)");b+=TableEntry("Alert initiated connection",addLinkConditional(c,'editMpsPolicy("Alert")',xxAccountAdminName));c="<i>None</i>";if(0<xxPolicies.Periodic.length)for(d in c="",xxPolicies.Periodic)0<c.length&&(c+=", "),c+=xxPolicies.Periodic[d].AccessInfo,1==xxPolicies.Periodic[d].MpsType&&(c+=" (CILA)");var e=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","Periodic");if(e){var r=atob(e.ExtendedData);
|
|
0==ReadInt(r,0)&&(c+=format(", each {0} seconds",ReadInt(r,4)));1==ReadInt(r,0)&&(e=ReadInt(r,4),r=ReadInt(r,8),10>r&&(r="0"+r),c+=", at "+e+":"+r+" daily")}b+=TableEntry("Periodic connection",addLinkConditional(c,'editMpsPolicy("Periodic")',xxAccountAdminName));b+=TableEnd();b=b+"<br>"+TableStart2();b+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT remote management servers.<br><br>";if(0==xxCiraServers.length)b+="<div style=padding-left:15px><br><i>No remote servers found.</i></div><br>";
|
|
else for(d in xxCiraServers)c=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(c+=", "+xxCiraServers[d].CN),b+="<div class=itemBar onclick=showServerDetails("+d+")><div style=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(c)+"</div></div>";if(a)if(b+="<br>Manage HTTP proxies used for management connections.<br><br>",c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==c.length)b+="<div style=padding-left:15px><br><i>No proxies configured.</i></div><br>";else for(d in c)b+="<div class=itemBar onclick=showProxyDetails("+
|
|
d+")><div style=padding-top:3px><b>"+EscapeHtml(c[d].AccessInfo)+":"+c[d].Port+"</b> / "+EscapeHtml(c[d].NetworkDnsSuffix)+"</div></div>";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),a&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));b+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(58,b)}}var xxEditMpsPolicyType;
|
|
function editMpsPolicy(b){var c="",a=11<amtversion||11==amtversion&&6<=amtversion,d=xxEditMpsPolicyType=b;"User"==d&&(d="User Initiated");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",d),c=c+"<div style=height:26px><select id=d2server1 style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=-1>(None)",e;for(e in xxCiraServers)c+="<option value="+e+""+(xxPolicies[b][0]&&xxPolicies[b][0].Name==xxCiraServers[e].Name?" selected":"")+">"+xxCiraServers[e].AccessInfo;
|
|
c+="</select><div>Primary server</div></div>";a&&(c+="<div style=height:26px><select id=d2server1cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[b][0]&&1==xxPolicies[b][0].MpsType?" selected":"")+">CILA - Internal</select><div>Primary MPS Type</div></div>");if(1<xxCiraServers.length){c+="<div style=height:26px><select id=d2server2 style=float:right;width:206px onchange=editMpsPolicyUpdate()>";c+="<option value=-1>(None)";
|
|
for(e in xxCiraServers)c+="<option value="+e+""+(xxPolicies[b][1]&&xxPolicies[b][1].Name==xxCiraServers[e].Name?" selected":"")+">"+xxCiraServers[e].AccessInfo;c+="</select><div>Secondary server</div></div>";a&&(c+="<div style=height:26px><select id=d2server2cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[b][1]&&1==xxPolicies[b][1].MpsType?" selected":"")+">CILA - Internal</select><div>Secondary MPS Type</div></div>")}e=
|
|
0;d&&(e=d.TunnelLifeTime);c+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+e+">";c+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==b&&(a=0,e=3600,d&&(d=atob(d.ExtendedData),a=ReadInt(d,0),e=ReadInt(d,4),1==a&&(d=ReadInt(d,8),10>d&&(d="0"+d),e+=":"+d)),c+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",c+="<option value=0"+(0==a?" selected":"")+">Periodic, time interval<option value=1"+
|
|
(1==a?" selected":"")+">Time of day, once a day",c+="</select><div>Trigger type</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+e+"><div id=ttypelabel></div></div>");setDialogMode(11,format("{0} Connection",b),3,editMpsPolicyOk,c);editMpsPolicyUpdate()}
|
|
function editMpsPolicyUpdate(){var b=11<amtversion||11==amtversion&&6<=amtversion,c=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==c&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var a=Q("d2timer").value.split(":");if(2!=a.length)c=!1;else{var d=parseInt(a[0]),a=parseInt(a[1]);if(0>d||23<d||0>a||59<a)c=!1}}QE("c49",c);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
|
|
-1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (HH:MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value);b&&(QE("d2server1cira",-1<Q("d2server1").value),1<xxCiraServers.length&&QE("d2server2cira",-1<Q("d2server1").value&&-1<Q("d2server2").value))}
|
|
function editMpsPolicyOk(){var b=xxEditMpsPolicyType;"User"==b&&(b="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",b)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:b},editMpsPolicyOk2):editMpsPolicyOk2()}
|
|
function editMpsPolicyOk2(b,c,a,d){b=11<amtversion||11==amtversion&&6<=amtversion;if(-1==Q("d2server1").value)PullRemoteAccess();else{c=0;"Alert"==xxEditMpsPolicyType&&(c=1);"Periodic"==xxEditMpsPolicyType&&(c=2);a=null;2==c&&(a=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==a&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),a=btoa(IntToStr(a)+d));var e,r;0<=Q("d2server1").value&&(e='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
|
|
xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>");0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&(r='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
|
|
xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var p=[];b?e&&(0==Q("d2server1cira").value?d.push(e):p.push(e),r&&(0==Q("d2server2cira").value?d.push(r):p.push(r))):e&&(d.push(e),r&&d.push(r));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(c,Q("d2lifetime").value,a,d,p,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
|
|
function editEnvironmentDetection(b){1!=b&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var c="";xxAccountAdminName&&(c+="Enter up to 5 intranet domain suffix. If the computer is outside these domains, Intel® AMT local ports will be closed and remote server connections will be active.<br><br>");0==editEnvironmentDetectionTmp.length&&(c+="<i>No intranet domains, Environement detection disabled.</i><br>");for(var a in editEnvironmentDetectionTmp)c+=
|
|
"<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","editEnvironmentDetectionRemove("+a+")")+'</div><div style=padding-top:3px;max-width:260px;overflow:hidden title="'+editEnvironmentDetectionTmp[a]+'"><b>'+editEnvironmentDetectionTmp[a]+"</b></div></div>";xxAccountAdminName&&5>editEnvironmentDetectionTmp.length&&(c+="<br><input id=edInput placeholder=intranet.org style=width:276px onkeyup=edInputChg() maxlength=63><input type=button id=edAdd value=Add style=width:80px;margin-left:5px onclick=editEnvironmentDetectionAdd()>");
|
|
1==b?QH(69,c):setDialogMode(11,"Environment Detection",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,c);edInputChg()}function editEnvironmentDetectionDlg(){if(xxAccountAdminName){var b=Clone(xxEnvironementDetection);b.DetectionStrings=editEnvironmentDetectionTmp;amtstack.Put("AMT_EnvironmentDetectionSettingData",b,editEnvironmentDetectionDlg2,0,1)}}
|
|
function editEnvironmentDetectionDlg2(b,c,a,d){200!=d?messagebox("Environment Detection",format("Failed to add server, status {0}",d)):a.Body.ReturnValue&&0!=a.Body.ReturnValue?messagebox("Environment Detection",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}function edInputChg(){5>editEnvironmentDetectionTmp.length&&QE("edAdd",0<Q("edInput").value.length)}function editEnvironmentDetectionAdd(){editEnvironmentDetectionTmp.push(Q("edInput").value);editEnvironmentDetection(1)}
|
|
function editEnvironmentDetectionRemove(b){editEnvironmentDetectionTmp.splice(b,1);editEnvironmentDetection(1)}function editUserInitiatedCira(){if(!xxdialogMode){var b="",c;for(c in xxUserInitiatedEnabledState)b+="<input type=radio name=d11 id=wl"+c+" value="+c+" "+(xxUserInitiatedCira.EnabledState==c?"checked":"")+">"+xxUserInitiatedEnabledState[c]+"<br>";setDialogMode(11,"User Initiated Tunnel",3,editUserInitiatedCiraDlg,b)}}
|
|
function editUserInitiatedCiraDlg(){amtstack.AMT_UserInitiatedConnectionService_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,editUserInitiatedCiraDlg2)}function editUserInitiatedCiraDlg2(b,c,a,d){200==d&&amtstack.Get("AMT_UserInitiatedConnectionService",editUserInitiatedCiraDlg3,0,1)}function editUserInitiatedCiraDlg3(b,c,a,d){200==d&&(xxUserInitiatedCira=a.Body,updateRemoteAccess())}var xxShowServerDetailsHandle;
|
|
function showServerDetails(b){xxShowServerDetailsHandle=b;var c=xxCiraServers[b],a;a=""+addHtmlValue("Access Name",c.AccessInfo);c.Port&&(a+=addHtmlValue("Port",c.Port));c.CN&&(a+=addHtmlValue("Common Name",c.CN));if(c=getElementWithContextSelectorValue(xxRemoteAccessCredentiaLinks,c.Name))c=c.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,0<c.indexOf("Username")?(a+=addHtmlValue("Authentication Type","User & Pass / Server-Auth TLS"),a+=addHtmlValue("Remote ID",getInstance(xxMPSUserPass,
|
|
c).RemoteID)):(a+=addHtmlValue("Authentication Type","Certificate / Mutual-Auth TLS"),c=getInstance(xxCertificates,c),a+=addHtmlValue("Certificate Name",parseCertName(c.Subject).CN));c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"Remote Server #"+(b+1),c,showServerDetailsOk,a)}
|
|
function getElementWithContextSelectorValue(b,c){for(var a in b){b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector=MakeToArray(b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector);for(var d in b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector)if(b[a].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector[d].Value==c)return b[a]}return null}
|
|
function showServerDetailsOk(b){2==b&&amtstack.Delete("AMT_ManagementPresenceRemoteSAP",{Name:xxCiraServers[xxShowServerDetailsHandle].Name},showServerDetailsOk2)}function showServerDetailsOk2(b,c,a,d){408==d?messagebox("Remote Server Removal","Unable to remove server, access denied."):PullRemoteAccess()}function parseCertName(b){var c={},a=b.split(","),d;for(d in a)b=a[d].indexOf("="),c[a[d].substring(0,b)]=a[d].substring(b+1);return c}
|
|
function showProxyDetails(b){var c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[b],a=addHtmlValue("Access name",c.AccessInfo+":"+c.ProxyPort),a=a+addHtmlValue("DNS suffex",c.NetworkDnsSuffix),a=a+addHtmlValue("Proxy type",["Administrator","Operating system"][c.Type]),c=1;xxAccountAdminName&&(c=5);setDialogMode(11,"HTTP Proxy #"+(b+1),c,showProxyDetailsOk,a,b)}
|
|
function showProxyDetailsOk(b,c){var a=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[c];2==b&&amtstack.Delete("IPS_HTTPProxyAccessPoint",{Name:a.Name},showProxyDetailsOk2)}function showProxyDetailsOk2(b,c,a,d){408==d?messagebox("HTTP Proxy Removal","Unable to remove HTTP proxy, access denied."):PullRemoteAccess()}
|
|
function AddRemoteAccessProxy(){var b;b='<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessProxyUpdate()><option value=2>Hostname FQDN<option value=3>IPv4 address<option value=4>IPv6 address</select><div>Connection type</div></div><div style=height:26px><input id=d2host style=float:right;width:200px maxlength=255 onkeyup=AddRemoteAccessProxyUpdate()><div id=d2typespan></div></div><div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px onkeyup=AddRemoteAccessProxyUpdate()><div>Port</div></div>';b+=
|
|
"<div style=height:26px><input id=d2domain style=float:right;width:200px maxlength=191 onkeyup=AddRemoteAccessProxyUpdate()><div>DNS suffix</div></div>";setDialogMode(11,"Add HTTP Proxy",3,AddRemoteAccessProxyOk,b);AddRemoteAccessProxyUpdate()}
|
|
function AddRemoteAccessProxyUpdate(){var b=0!=Q("d2host").value.length&&0!=Q("d2domain").value.length;if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;QE("c49",b);QH("d2typespan",["","","FQDN / hostname","IPv4 address","IPv6 address"][Q("d2type").value])}function AddRemoteAccessProxyOk(){amtstack.IPS_HTTPProxyService_AddProxyAccessPoint(Q("d2host").value,Q("d2type").value,parseInt(Q("d2port").value),Q("d2domain").value,AddRemoteAccessProxyOk2)}
|
|
function AddRemoteAccessProxyOk2(b,c,a,d){200!=d?messagebox("Add Proxy Server","Failed to add proxy, status "+d):0!=a.Body.ReturnValue?messagebox("Add Proxy Server",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
|
|
function AddRemoteAccessServer(){var b=[],c;for(c in xxCertificates)xxCertificates[c].XPrivateKey&&b.push(xxCertificates[c]);var a;a="<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()><option value=201>Hostname FQDN<option value=3>IPv4 address</select><div>Connection type</div></div><div style=height:26px><input id=d2name style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div id=d2lname></div></div>";a+='<div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px value=4433 onkeyup=AddRemoteAccessServerUpdate()><div>Server port</div></div>';
|
|
a+="<div style=height:26px id=d2ucn><input id=d2cn style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Server Common Name</div></div>";a+="<div style=height:26px><select id=d2auth style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";0<b.length&&(a+="<option value=1>Certificate");a+="<option value=2>Username/Password</select><div>Authentication type</div></div>";a+="<span id=d2utype>";a+="<div style=height:26px><input id=d2user style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Username</div></div>";
|
|
a+="<div style=height:26px><input id=d2pass style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Strong Password</div></div>";a+="</span>";a+="<span id=d2ctype>";a+="<div style=height:26px><select id=d2cert style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";for(c in b)a+="<option value="+b[c].InstanceID.substring(34)+">"+parseCertName(b[c].Subject).CN;a+="</select><div>Certificate</div></div></span>";setDialogMode(11,"Add Remote Server",3,AddRemoteAccessServerOk,
|
|
a);AddRemoteAccessServerUpdate()}
|
|
function AddRemoteAccessServerOk(){var b,c,a,d;1==Q("d2auth").value?b='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT Certificate: Handle: '+Q("d2cert").value+
|
|
"</Selector></SelectorSet></ReferenceParameters>":(c=Q("d2user").value,a=Q("d2pass").value);0<Q("d2cn").value.length&&(d=Q("d2cn").value);amtstack.AMT_RemoteAccessService_AddMpServer(Q("d2name").value,Q("d2type").value,Q("d2port").value,Q("d2auth").value,b,c,a,d,AddRemoteAccessServerOk2)}
|
|
function AddRemoteAccessServerOk2(b,c,a,d){200!=d?messagebox("Add Internet Server",format("Failed to add server, status {0}",d)):0!=a.Body.ReturnValue?messagebox("Add Internet Server",a.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
|
|
function AddRemoteAccessServerUpdate(){var b=0!=Q("d2name").value.length;3==Q("d2type").value&&1==b&&(b=0!=Q("d2cn").value.length);2==Q("d2auth").value&&1==b&&(b=0!=Q("d2user").value.length&&passwordcheck(Q("d2pass").value));if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))b=!1;if(-1!=Q("d2name").value.indexOf(":")||3==Q("d2type").value&&-1!=Q("d2cn").value.indexOf(":"))b=!1;QH("d2lname",201==Q("d2type").value?"Hostname":"IPv4 Address");QV("d2utype",2==Q("d2auth").value);QV("d2ucn",
|
|
3==Q("d2type").value);QV("d2ctype",1==Q("d2auth").value);QE("c49",b)}
|
|
function showEditNameDlg(b){if(!xxdialogMode){var c=amtsysstate.AMT_GeneralSettings.response.HostName,a=amtsysstate.AMT_GeneralSettings.response.DomainName;null!=a&&0<a.length&&(c+="."+a);c='<br><div style=height:26px><input id=d11name value="'+c+'" style=float:right;width:200px><div>Name & Domain</div></div>';1==b&&(b=1==amtsysstate.AMT_GeneralSettings.response.SharedFQDN,c+="<div style=height:26px><select id=d11fqdn style=float:right;width:200px><option value=true "+(b?"selected":"")+'>Shared, same as OS<option value="false" '+
|
|
(b?"":"selected")+">Dedicated, different from OS</select><div>Name Sharing</div></div>");setDialogMode(11,"Computer Name",3,editNameDlgOk,c)}}function editNameDlgOk(){var b=Q("d11name").value,c=b.indexOf("."),a="";0<=c&&(a=b.substring(c+1),b=b.substring(0,c));c=Clone(amtsysstate.AMT_GeneralSettings.response);c.HostName=b;c.DomainName=a;Q("d11fqdn")&&(c.SharedFQDN=d11fqdn.value);amtstack.Put("AMT_GeneralSettings",c,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
|
|
function computerNameGet(b,c,a,d){200==d&&(amtsysstate.AMT_GeneralSettings.response=a.Body,updateSystemStatus())}function showEditDnsDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,c=0;1==b.DDNSUpdateByDHCPServerEnabled&&(c=1);1==b.DDNSUpdateEnabled&&(c=2);c35.value=c;c36.value=b.DDNSPeriodicUpdateInterval;c37.value=b.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Dynamic DNS client",3,showEditDnsDlgOk)}}
|
|
function showEditDnsDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response);b.DDNSUpdateEnabled=2==c35.value?!0:!1;b.DDNSUpdateByDHCPServerEnabled=1==c35.value?!0:!1;2==c35.value&&(b.DDNSPeriodicUpdateInterval=c36.value,b.DDNSTTL=c37.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
|
|
function showEditDnsDlgChange(){QE("c36",2==c35.value);QE("c37",2==c35.value)}function showFeaturesDlg(){!xxdialogMode&&xxAccountAdminName&&(c14.checked=amtfeatures[0],c16.checked=amtfeatures[3],c17.checked=amtfeatures[2],c18.checked=amtfeatures[1],QV("c15",null!=amtfeatures[3]),setDialogMode(9,"Intel® AMT Features",3,featuresDlgOk))}
|
|
function featuresDlgOk(){var b=amtsysstate.AMT_RedirectionService.response;b.ListenerEnabled=c14.checked;b.EnabledState=32768+((c17.checked?1:0)+(c18.checked?2:0));amtstack.AMT_RedirectionService_RequestStateChange(b.EnabledState,function(c,a,d,e){200!=e?messagebox("Error","RedirectionService, RequestStateChange Error "+e):null!=amtfeatures[3]&&amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c16.checked?2:3,0,function(a,c,d,e){200!=e?messagebox("Error","KVMRedirectionSAP, RequestStateChange Error "+
|
|
e):amtstack.Put("AMT_RedirectionService",b,function(a,b,c,d){200!=d?messagebox("Error","RedirectionService PUT Error "+d):(amtstack.Get("AMT_RedirectionService",featuresDlgGet1,0,1),amtstack.Get("CIM_KVMRedirectionSAP",featuresDlgGet2,0,1))},0,1)})})}function featuresDlgGet1(b,c,a,d){200==d&&(amtsysstate.AMT_RedirectionService.response=a.Body,updateSystemStatus())}function featuresDlgGet2(b,c,a,d){200==d&&(amtsysstate.CIM_KVMRedirectionSAP.response=a.Body,updateSystemStatus())}
|
|
function showConsentDlg(){if(!xxdialogMode){var b=amtsysstate.IPS_OptInService.response.OptInRequired;c19.checked=0==b;c20.checked=1==b;c21.checked=4294967295==b;setDialogMode(10,"User Consent",3,consentDlgOk)}}function consentDlgOk(){amtsysstate.IPS_OptInService.response.OptInRequired=document.querySelector("input[name=d10]:checked").value;amtstack.Put("IPS_OptInService",amtsysstate.IPS_OptInService.response,function(){amtstack.Get("IPS_OptInService",consentGet,0,1)},0,1)}
|
|
function consentGet(b,c,a,d){200==d&&PullSystemStatus()}var ipv6addrtype="Link local address;Network local address;Global address;User configured;Not allowed;DAD in progress;valid;deprecated;preferred/deprecated;expired;collision;not allowed".split(";");
|
|
function showIPv6AddrDlg(b,c){if(!xxdialogMode){var a=TableStart();t=c.split(",");for(var d=0;d<t.length;d+=3)a+=TableEntry("<b>"+t[d]+"</b><br><span style=font-size:10px>"+ipv6addrtype[t[d+1]]+", "+ipv6addrtype[+t[d+2]+5]+"</span>","");setDialogMode(11,0==b?"IPv6 addresses for wired interface":"IPv6 addresses for wireless interface",1,null,a+TableEnd())}}
|
|
function showIPv6StateDlg(b,c){if(!xxdialogMode&&amtsysstate){var a=amtsysstate.IPS_IPv6PortSettings.responses[b];ipv6manual=0==b&&(isIpAddress(a.IPv6Address)||isIpAddress(a.DefaultRouter)||isIpAddress(a.PrimaryDNS)||isIpAddress(a.SecondaryDNS));QV(75,0==b);QV(76,!1);QV("d21o0",!0);QV("d21l0",!0);QH("d21l0","IPv6 disabled");QH("d21l1","IPv6 enabled, automatic");QH("d21l2","IPv6 enabled, automatic + manual addresse");d21o0.checked=!c;d21o1.checked=c&&!ipv6manual;d21o2.checked=
|
|
c&&ipv6manual;c30.value=isIpAddress(a.IPv6Address,"");c32.value=isIpAddress(a.DefaultRouter,"");c33.value=isIpAddress(a.PrimaryDNS,"");c34.value=isIpAddress(a.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,0==b?"IPv6 support for wired interface":"IPv6 support for wireless interface",3,function(){showIPv6StateDlgOk(b)})}}
|
|
function showIPv6StateDlgOk(b){var c=amtsysstate.IPS_IPv6PortSettings.responses[b];0==b&&(d21o1.checked&&(c.IPv6Address=c.DefaultRouter=c.PrimaryDNS=c.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)),d21o2.checked&&(c.IPv6Address=c30.value,c.DefaultRouter=c32.value,c.PrimaryDNS=c33.value,c.SecondaryDNS=c34.value,amtstack.Put("IPS_IPv6PortSettings",c,showIPv6StateDlgDone)));for(var c=amtsysstate.CIM_ElementSettingData.responses,a=
|
|
0;a<c.length;a++)if(c[a].SettingData&&c[a].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+b){var d=Clone(c[a]);d.IsCurrent=d21o0.checked?2:1;amtstack.Put("CIM_ElementSettingData",d,showIPv6StateDlgDone)}}function showIPv6StateDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv6 support",format("Unable to set IPv6 state, error {0}",d))}
|
|
function showPingActionDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response,b=(1==b.PingResponseEnabled)+((1==b.RmcpPingResponseEnabled)<<1);d20a.checked=0==b;d20b.checked=1==b;d20c.checked=2==b;d20d.checked=3==b;setDialogMode(20,"Intel® AMT Ping Response",3,showPingActionDlgOk)}}
|
|
function showPingActionDlgOk(){var b=Clone(amtsysstate.AMT_GeneralSettings.response),c=document.querySelector("input[name=d20]:checked").value;b.PingResponseEnabled=0!=(c&1);b.RmcpPingResponseEnabled=0!=(c&2);amtstack.Put("AMT_GeneralSettings",b,PullSystemStatus,0,1)}
|
|
function showIPSetupDlg(){if(!xxdialogMode){var b=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(74,6<amtversion);6<amtversion&&(Q("d21ipsync").checked=b.IpSyncEnabled);QV(75,!0);QV(76,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","Automatic configuration using DHCP server");QH("d21l2","Static configuration using IPv4 settings below");d21o1.checked=1==b.DHCPEnabled;d21o2.checked=!d21o1.checked;c30.value=isIpAddress(b.IPAddress,"");c31.value=
|
|
isIpAddress(b.SubnetMask,"");c32.value=isIpAddress(b.DefaultGateway,"");c33.value=isIpAddress(b.PrimaryDNS,"");c34.value=isIpAddress(b.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv4 Settings",3,showIPSetupDlgOk)}}function updateIPSetupDlg(){c30.disabled=c31.disabled=c32.disabled=c33.disabled=c34.disabled=!(d21o2.checked&&(7>amtversion||0==Q("d21ipsync").checked))}
|
|
function showIPSetupDlgOk(){var b=Clone(amtsysstate.AMT_EthernetPortSettings.responses[0]);b.DHCPEnabled=d21o1.checked;delete b.IPAddress;delete b.SubnetMask;delete b.DefaultGateway;delete b.PrimaryDNS;delete b.SecondaryDNS;6<amtversion&&(b.IpSyncEnabled=Q("d21ipsync").checked);if(0==d21o1.checked||7>amtversion||0==Q("d21ipsync").checked)b.IPAddress=c30.value,b.SubnetMask=c31.value,b.DefaultGateway=c32.value,""!=c33.value&&(b.PrimaryDNS=c33.value),""!=
|
|
c34.value&&(b.SecondaryDNS=c34.value);amtstack.Put("AMT_EthernetPortSettings",b,showIPSetupDlgDone,0,1,b)}function showIPSetupDlgDone(b,c,a,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv4 Settings",format("Unable to set network parameters, error {0}",d))}amtPowerBootCapabilities=null;function showPowerActionDlg(){xxdialogMode||(statusbox("Power Actions","Checking capabilities..."),amtstack.Get("AMT_BootCapabilities",powerActionResponse00,0,1))}
|
|
function powerActionResponse00(b,c,a,d){if(200==d){b=3;try{b=2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?1:2}catch(e){}amtPowerBootCapabilities=a.Body;QH("d5actionSelect","");b&2&&addOption("d5actionSelect","Power up",2);b&1&&(addOption("d5actionSelect","Reset",10),addOption("d5actionSelect","Power cycle",5),addOption("d5actionSelect","Power down",8));1==amtPowerBootCapabilities.ForceDiagnosticBoot&&(b&2&&addOption("d5actionSelect","Power on to diagnostic",300),b&1&&addOption("d5actionSelect",
|
|
"Reset to diagnostic",301));9<amtversion&&b&1&&(addOption("d5actionSelect","OS Wake from Standby",500),addOption("d5actionSelect","OS Power Saving",501),addOption("d5actionSelect","Soft-off",12),addOption("d5actionSelect","Soft-reset",14),addOption("d5actionSelect","Sleep",4),addOption("d5actionSelect","Hibernate",7));1==amtPowerBootCapabilities.BIOSSetup&&(b&2&&addOption("d5actionSelect","Power up to BIOS",100),b&1&&addOption("d5actionSelect","Reset to BIOS",101));1==amtPowerBootCapabilities.SecureErase&&
|
|
(b&2&&addOption("d5actionSelect","Power up to Secure Erase",104),b&1&&addOption("d5actionSelect","Reset to Secure Erase",105));b&1&&addOption("d5actionSelect","Reset to IDE-R Floppy",200);b&2&&addOption("d5actionSelect","Power on to IDE-R Floppy",201);b&1&&addOption("d5actionSelect","Reset to IDE-R CDROM",202);b&2&&addOption("d5actionSelect","Power on to IDE-R CDROM",203);b&1&&addOption("d5actionSelect","Reset to PXE",400);b&2&&addOption("d5actionSelect","Power on to PXE",401);addOption("d5actionSelect",
|
|
"Custom action...",999);5<amtversion&&addOption("d5actionSelect","User consent...",998);setDialogMode(5,"Power Actions",3,powerActionDlgCheck)}else messagebox("Power Action",format("Unable to get system capabilities, error {0}",d))}
|
|
function powerActionDlgCheck(){AmtOcrPba=null;AmtOcrPbaLength=0;var b=d5actionSelect.value;500==b||501==b?amtstack.RequestOSPowerStateChange(501==b?3:2,function(b,a,d,e){200==e?QH(66,"Power action completed."):QH(66,format("Power action error #{0}.",e));setDialogMode(1,"Power Action",0);setTimeout(function(){setDialogMode(0)},1300)}):104==b||105==b?(b="Confirm execution of Intel® Remote Secure Erase?<br>Enter Secure Erase password if required.<br><br><div style=height:16px><input type=password id=rsepass maxlength=32 style=float:right;width:240px><div>Password</div></div><br><div style=color:red><b>WARNING:</b> This will wipe data on the remote system.</div>",
|
|
rsepass=1,setDialogMode(11,"Power Actions",3,powerActionDlg,b)):powerActionDlg()}
|
|
function powerActionDlg(){var b=d5actionSelect.value;if(999==b)showAdvPowerDlg();else if(998==b)amtstack.Get("IPS_OptInService",powerActionResponse0,0,1);else{10>b&&2<b&&(3==desktop.State&&connectDesktop(),3==terminal.State&&connectTerminal(),void 0!=ider&&3==ider.state&&iderStop());statusbox("Power Action","Checking state...");null!=rsepass&&1===rsepass&&(rsepass=Q("rsepass").value);var c=!0;6>amtversion&&(c=!1);13==currentView&&8==b&&(c=!1);13!=currentView&&10>=b&&(c=!1);c?amtstack.Get("IPS_OptInService",
|
|
powerActionResponse0,0,1):amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1)}}var AvdPowerDlg;
|
|
function showAdvPowerDlg(){try{Q("c38").value=2==amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState?10:2}catch(b){}QV("d24dBiosPause",1==amtPowerBootCapabilities.BIOSPause);QV("d24dBiosSecureBoot",1==amtPowerBootCapabilities.BIOSSecureBoot);QV("d24dReflashBios",1==amtPowerBootCapabilities.BIOSReflash);QV("d24dBiosSetup",1==amtPowerBootCapabilities.BIOSSetup);QV("ForceDVDBootOption",1==amtPowerBootCapabilities.ForceCDorDVDBoot);QV("ForceDiagBootOption",1==amtPowerBootCapabilities.ForceDiagnosticBoot);
|
|
QV("ForceHDBootOption",1==amtPowerBootCapabilities.ForceHardDriveBoot);QV("ForcePXEBootOption",1==amtPowerBootCapabilities.ForcePXEBoot);QV("d24dForceProgressEvents",1==amtPowerBootCapabilities.ForcedProgressEvents);QV("d24dUseIDER",1==amtPowerBootCapabilities.IDER);QV("d24dLockKeyboard",1==amtPowerBootCapabilities.KeyboardLock);QV("d24dLockPowerButton",1==amtPowerBootCapabilities.PowerButtonLock);QV("d24dLockResetButton",1==amtPowerBootCapabilities.ResetButtonLock);QV("d24dSerialOverLan",1==amtPowerBootCapabilities.SOL);
|
|
QV("d24dSecureErase",1==amtPowerBootCapabilities.SecureErase);QV("d24dLockSleepButton",1==amtPowerBootCapabilities.SleepButtonLock);QV("d24dUserPasswordBypass",1==amtPowerBootCapabilities.UserPasswordBypass);QV("c45",1==amtPowerBootCapabilities.VerbosityQuiet);QV("c46",1==amtPowerBootCapabilities.VerbosityVerbose);QV("c47",1==amtPowerBootCapabilities.VerbosityScreenBlank);QV("d24p500",9<amtversion);QV("d24p501",9<amtversion);setDialogMode(24,"Custom Power Action",
|
|
3,showAdvPowerDlgOk);showAdvPowerDlgChange()}function showAdvPowerDlgChange(){QV("idd_d24IDERBootDevice",Q("d24UseIDER").checked);QV("idd_d24RSEPass",Q("d24SecureErase")?Q("d24SecureErase").checked:!1);var b=500<=Q("c38").value&&600>Q("c38").value;QE("c40",!b);QE("c42",!b);QE("idd_d24IDERBootDevice",!b);QE("c44",!b);QE("idd_d24RSEPass",!b);QE("c49",!0)}
|
|
function showAdvPowerDlgOk(){var b=Q("c38").value;500==b||501==b?amtstack.RequestOSPowerStateChange(501==b?3:2,function(b,a,d,e){200==e?QH(66,"Power action completed."):QH(66,format("Power action error #{0}.",e));setDialogMode(1,"Power Action",0);setTimeout(function(){setDialogMode(0)},1300)}):(AvdPowerDlg={},AvdPowerDlg.Action=Q("c38").value,AvdPowerDlg.BIOSPause=Q("d24BiosPause").checked,AvdPowerDlg.BIOSSecureBoot=Q("d24BiosSecureBoot").checked,
|
|
AvdPowerDlg.BIOSSetup=Q("d24BiosSetup").checked,AvdPowerDlg.BootMediaIndex=Q("c42").value,AvdPowerDlg.FirmwareVerbosity=Q("c44").value,AvdPowerDlg.ForcedProgressEvents=Q("d24ForceProgressEvents").checked,AvdPowerDlg.IDERBootDevice=Q("c43").value,AvdPowerDlg.LockKeyboard=Q("d24LockKeyboard").checked,AvdPowerDlg.LockPowerButton=Q("d24LockPowerButton").checked,AvdPowerDlg.LockResetButton=Q("d24LockResetButton").checked,AvdPowerDlg.LockSleepButton=Q("d24LockSleepButton").checked,
|
|
AvdPowerDlg.ReflashBIOS=Q("d24ReflashBios").checked,AvdPowerDlg.UseIDER=Q("d24UseIDER").checked,AvdPowerDlg.UseSOL=Q("d24SerialOverLan").checked,AvdPowerDlg.UseSafeMode=Q("d24SafeMode").checked,AvdPowerDlg.UserPasswordBypass=Q("d24UserPasswordBypass").checked,AvdPowerDlg.SecureErase=Q("d24SecureErase").checked,!0===AvdPowerDlg.SecureErase&&0<Q("d24rsepass").value.length&&(AvdPowerDlg.RSEPassword=Q("d24rsepass").value),statusbox("Power Action","Checking state..."),amtstack.Get("IPS_OptInService",powerActionResponse0,
|
|
0,1))}
|
|
function powerActionResponse0(b,c,a,d){200!=d?connectDesktopConsent?connectDesktop(!0):messagebox("Power Action",format("Error #{0}",d)):4294967295==a.Body.OptInRequired&&3!=a.Body.OptInState&&4!=a.Body.OptInState?2==a.Body.OptInState?(d6ConsentText.value="",setDialogMode(6,"User Consent",11,powerActionSendConsent),checkConsentDisplay(),consentChanged()):(statusbox("Power Action","Starting opt-in..."),amtstack.IPS_OptInService_StartOptIn(powerActionResponseC1,0,1)):connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):
|
|
998==d5actionSelect.value?messagebox("User Consent","User consent not needed."):(statusbox("Power Action","Getting Boot Settings..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
|
|
function powerActionResponseC1(b,c,a,d){200!=d?connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):messagebox("Power Action",format("Error #",d)):0!=a.Body.ReturnValue?connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):messagebox("User Consent Error",a.Body.ReturnValueStr.replace(/_/g," ")):(d6ConsentText.value="",setDialogMode(6,"User Consent",11,powerActionSendConsent),checkConsentDisplay(),consentChanged(),amtstack.Enum("CIM_ServiceAvailableToElement",function(a,b,c,d){errcheck(d,
|
|
a)||(amtsysstate.CIM_ServiceAvailableToElement.responses=c,updateSystemStatus(),null!=amtsysstate.CIM_ServiceAvailableToElement&&null!=amtsysstate.CIM_ServiceAvailableToElement.responses&&0<amtsysstate.CIM_ServiceAvailableToElement.responses.length&&2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState&&amtstack.RequestPowerStateChange(2,function(a,b,c,d){}))}))}
|
|
function powerActionSendConsent(b){0==b?amtstack.IPS_OptInService_CancelOptIn(function(){}):(statusbox("Power Action","Sending user consent..."),amtstack.IPS_OptInService_SendOptInCode(d6ConsentText.value,powerActionResponseC2,0,1))}
|
|
function powerActionResponseC2(b,c,a,d){200!=d?messagebox("Power Action",format("Error #{0}",d)):0!=a.Body.ReturnValue?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):connectDesktopConsent?(setDialogMode(0),connectDesktop(!0)):998==d5actionSelect.value?messagebox("User Consent","User consent succesful."):(statusbox("Power Action","Checking state..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
|
|
function powerActionResponse1(b,c,a,d){if(200!=d)messagebox("Power Action",format("Error #{0}",d));else{b=d5actionSelect.value;var e=a.Body;e.ConfigurationDataReset=!1;999==b?(e.BIOSPause=AvdPowerDlg.BIOSPause,e.EnforceSecureBoot=AvdPowerDlg.BIOSSecureBoot,e.BIOSSetup=AvdPowerDlg.BIOSSetup,e.BootMediaIndex=AvdPowerDlg.BootMediaIndex,e.FirmwareVerbosity=AvdPowerDlg.FirmwareVerbosity,e.ForcedProgressEvents=AvdPowerDlg.ForcedProgressEvents,e.IDERBootDevice=AvdPowerDlg.IDERBootDevice,e.LockKeyboard=AvdPowerDlg.LockKeyboard,
|
|
e.LockPowerButton=AvdPowerDlg.LockPowerButton,e.LockResetButton=AvdPowerDlg.LockResetButton,e.LockSleepButton=AvdPowerDlg.LockSleepButton,e.ReflashBIOS=AvdPowerDlg.ReflashBIOS,e.UseIDER=AvdPowerDlg.UseIDER,e.UseSOL=AvdPowerDlg.UseSOL,e.UseSafeMode=AvdPowerDlg.UseSafeMode,e.UserPasswordBypass=AvdPowerDlg.UserPasswordBypass,null!=e.SecureErase&&(e.SecureErase=AvdPowerDlg.SecureErase&&1==amtPowerBootCapabilities.SecureErase,1==e.SecureErase&&AvdPowerDlg.RSEPassword&&(e.RSEPassword=AvdPowerDlg.RSEPassword))):
|
|
(e.BIOSPause=!1,e.EnforceSecureBoot=!1,e.BIOSSetup=99<b&&104>b,e.BootMediaIndex=0,e.FirmwareVerbosity=0,e.ForcedProgressEvents=!1,e.IDERBootDevice=202==b||203==b?1:0,e.LockKeyboard=!1,e.LockPowerButton=!1,e.LockResetButton=!1,e.LockSleepButton=!1,e.ReflashBIOS=!1,e.UseIDER=199<b&&300>b,e.UseSOL=13==currentView&&8!=b&&300>b,e.UseSafeMode=!1,e.UserPasswordBypass=!1,null!=e.SecureErase&&(e.SecureErase=(104==b||105==b)&&1==amtPowerBootCapabilities.SecureErase,!0===e.SecureErase&&0<rsepass.length&&(e.RSEPassword=
|
|
rsepass)),rsepass=null);delete e.WinREBootEnabled;delete e.UEFILocalPBABootEnabled;delete e.UEFIHTTPSBootEnabled;delete e.SecureBootControlEnabled;delete e.BootguardStatus;delete e.OptionsCleared;delete e.BIOSLastStatus;delete e.UefiBootParametersArray;null!=e.UefiBootNumberOfParams&&(e.UefiBootNumberOfParams=0);console.log("Boot Action: "+b);console.log("Setting Boot Settings: "+ObjectToString2(e));statusbox("Power Action","Setting boot settings...");amtstack.CIM_BootConfigSetting_ChangeBootOrder(null,
|
|
function(a,b,c,d){200!=d?messagebox("Power Action",format("PUT CIM_BootConfigSetting_ChangeBootOrder, Error #{0}",d)+(c.Header&&c.Header.WsmanError?", "+c.Header.WsmanError:"")):0!=c.Body.ReturnValue?messagebox("Change Boot Order","Change Boot Order returns "+c.Body.ReturnValueStr):amtstack.Put("AMT_BootSettingData",e,powerActionResponse2,0,1)},0,1)}}
|
|
function powerActionResponse2(b,c,a,d,e){200!=d?messagebox("Power Action",format("PUT AMT_BootSettingData, Error #{0}",d)+(a.Header&&a.Header.WsmanError?", "+a.Header.WsmanError:"")):(statusbox("Power Action","Setting next boot..."),amtstack.SetBootConfigRole(1,powerActionResponse3x,0,1))}
|
|
function powerActionResponse3x(b,c,a,d){b=d5actionSelect.value;c=null;if(999==b)0<c40.value&&(c=["Force CD/DVD Boot","Force PXE Boot","Force Hard-drive Boot","Force Diagnostic Boot"][c40.value-1]);else{if(300==b||301==b)c="Force Diagnostic Boot";if(400==b||401==b)c="Force PXE Boot";if(600==b||601==b)c="Force OCR UEFI HTTPS Boot"}Q("c40").value=0;console.log("ChangeBootOrder: "+c);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==c?c:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: '+
|
|
c+"</Selector></SelectorSet></ReferenceParameters>",powerActionResponse3)}var targetPowerAction=0;
|
|
function powerActionResponse3(b,c,a,d){console.log("powerActionResponse3("+c+","+a+","+d+")");if(!errcheck(d,b))if(0!=a.Body.ReturnValue)messagebox("Change Boot Order","Change Boot Order returns "+a.Body.ReturnValueStr);else{statusbox("Power Action","Performing power action...");b=d5actionSelect.value;if(100==b||201==b||203==b||300==b||401==b||601==b)b=2;if(101==b||200==b||202==b||301==b||400==b||600==b)b=10;104==b&&(b=2);105==b&&(b=10);999==b&&(b=AvdPowerDlg.Action);targetPowerAction=b;11==b&&(b=
|
|
10);999>b?(console.log("RequestPowerStateChange("+b+")"),amtstack.RequestPowerStateChange(b,powerActionResponse4)):messagebox("Power Action","Next boot action set.")}}function powerActionResponse4(b,c,a,d){200==d&&(QH(66,"Power action completed."),setDialogMode(1,"Power Action",0),setTimeout(function(){setDialogMode(0)},1300));amtstack.Get("CIM_AssociatedPowerManagementService",powerActionResponse5,0,1)}function powerActionResponse5(b,c,a,d){}
|
|
function consentChanged(){QE("c49",6==d6ConsentText.value.length)}function changeConsentDisplay(){xxchangeConsentDisplay=!0;checkConsentDisplay()}function checkConsentDisplay(){amtstack.Get("IPS_SecIOService",checkConsentDisplayResponse1)}var xxchangeConsentDisplay=!1;
|
|
function checkConsentDisplayResponse1(b,c,a,d){200==d&&(a.Body.DefaultScreen&&(a.Body.DefaultScreen=parseInt(a.Body.DefaultScreen)),a.Body.NumberOfScreens&&(a.Body.NumberOfScreens=parseInt(a.Body.NumberOfScreens)),1==xxchangeConsentDisplay?(xxchangeConsentDisplay=!1,a.Body.DefaultScreen=d6Display.value,amtstack.Put("IPS_SecIOService",a.Body,checkConsentDisplayResponse1)):(d6Display.value=a.Body.DefaultScreen,QV("d6ThirdDisplay",2<a.Body.NumberOfScreens)))}
|
|
var xxStorage=null,xxStorageVendors=[],xxStorageApplications=[];function PullStorage(){amtFirstPull|=8;wsstack.comm.PerformAjax("",PullStorageResponse,null,0,"/amt-storage/","GET")}
|
|
function PullStorageResponse(b,c,a){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==c){QV("go21",!0);for(c=0;32>c;c++){do a=b.length,b=b.replace(String.fromCharCode(c),"");while(a>b.length)}try{xxStorage=JSON.parse(b)}catch(x){return}xxStorageVendors=[];xxStorageApplications=[];b=xxStorage.content;if(Array.isArray(b)){a={};for(c in b){var d=b[c].vendor?b[c].vendor:"";a[d]||(a[d]={});var e=b[c].app?b[c].app:"";a[d][e]||(a[d][e]={});b[c].name&&(a[d][e][b[c].name]=b[c])}xxStorage.content=
|
|
b=a}else{if(b["index.htm"]||b["logon.htm"])b[""]={"":{}};b["index.htm"]&&(b[""][""]["index.htm"]=b["index.htm"],delete b["index.htm"]);b["logon.htm"]&&(b[""][""]["logon.htm"]=b["logon.htm"],delete b["logon.htm"])}a=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT storage for this computer.<br><br>",r,p,e="";for(c in b){var k=0,q;for(q in b[c]){k++;var m=0,w;for(w in b[c][q]){m++;if(c!=r||q!=p)""!=e&&(d+=e,e="<br>"),r=c,p=q,e=""!=c?e+EscapeHtml(c+" / "+q):e+
|
|
"Root";var l='"'+c+(""!=c?"/":"")+q+(""!=q?"/":"")+w+'"',e=e+('<div class=itemBar onclick=showStorageDetails("'+c+'","'+q+'","'+w+'",'+l+")><div style=float:right>"),e=e+(" "+AddButton2("Download","DownloadFromStorage("+l+',"'+w+'",event)')),e=e+("</div><div style=padding-top:3px><b>"+EscapeHtml(w)+"</b>, <i>"+b[c][q][w].size+" bytes</i></div></div>");a++;-1==xxStorageVendors.indexOf(c)&&xxStorageVendors.push(c);-1==xxStorageApplications.indexOf(q)&&xxStorageApplications.push(q)}0==m&&(wsstack.comm.PerformAjax("",
|
|
function(){},null,0,"/amt-storage/"+c+"/"+q,"DELETE"),wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE"))}0==k&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+c,"DELETE")}""!=e&&(d+=e);0==a&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(61,d)}else QH(61,"Unable to load storage data...<br/>"+
|
|
AddButton("Refresh","PullStorage()"))}function showStorageDetails(b,c,a,d){if(!xxdialogMode){var e="",r=xxStorage.content[b][c][a];""!=b&&(e+=addHtmlValue("Vendor",b));""!=c&&(e+=addHtmlValue("Application",c));e+=addHtmlValue("Name",a);e+=addHtmlValue("Size",r.size+" bytes");r.link&&(e+=addHtmlValue("Link",r.link));setDialogMode(11,"Storage Item",5,showStorageDetailsEx,e,d)}}
|
|
function showStorageDetailsEx(b,c){2==b&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+c,"DELETE")}function storageDeleteResponse(b,c){200!=c?messagebox("Storage",format("Unable to delete file (ERR{0}), check that the computer is powered on.",c)):PullStorage()}function DownloadFromStorage(b,c,a){xxdialogMode||(haltEvent(a),wsstack.comm.PerformAjax("",DownloadFromStorageEx,c,0,"/amt-storage/"+b,"GET"))}
|
|
function DownloadFromStorageEx(b,c,a){200!=c||null==b?console.log(c,"Data = null"):saveAs(data2blob(b),a)}function OpenFromStorage(b,c){if(!xxdialogMode){haltEvent(c);var a=window.open("http://"+wsstack.comm.host+":"+wsstack.comm.port+"/amt-storage/"+b,"_blank");a.opener=null;a.focus()}}function PushToStorage(b,c,a){var d=null;7E3<c.length&&(d=[b,c.substring(7E3)],c=c.substring(0,7E3));wsstack.comm.PerformAjax(c,PushToStorageResponse,d,0,"/amt-storage/"+b+(1==a?"?append=":""),"PUT")}
|
|
function PushToStorageResponse(b,c,a){200!=c?messagebox("Storage",format("Unable to push file (ERR{0}), check that the computer is powered on.",c)):null!=a?PushToStorage(a[0],a[1],!0):PullStorage()}
|
|
function UploadToStorage(b,c){if(!xxdialogMode){c||(c="");var a;a="<br>Select a small file to upload to storage and enter a vendor, application and filename.<br>";a=(b?a+('<br><div style=height:20px><input id=mstoragefile style=float:right;width:240px readonly disabled=disabled value="'+c+'" ><div>Upload file</div></div>'):a+"<br><div style=height:20px><input type=file id=mstoragefile style=float:right;width:240px onchange=SetStorageName()><div>Upload file</div></div>")+'<br><div style=height:16px><input id=mstoragevendor placeholder="Vendor" list=mstoragevendorlist maxlength=11 style=float:right;width:240px><div>Vendor name</div></div>';
|
|
a+='<br><div style=height:16px><input id=mstorageapplication placeholder="App" list=mstorageapplicationlist maxlength=11 style=float:right;width:240px><div>Application name</div></div>';a+='<br><div style=height:16px><input id=mstoragefilename placeholder="Filename" maxlength=11 style=float:right;width:240px><div>Filename</div></div>';a+="<br><div style=height:16px><input id=mstoragetype placeholder=application/octet-stream list=mstoragetypelist style=float:right;width:240px><div>MIME Type</div></div>";
|
|
a+='<br><div style=height:16px><input id=mstoragelink style=float:right;width:240px><div title="If set, creates a link to this content from the main web page">Link</div></div><br>';a+="<datalist id=mstoragevendorlist>";for(var d in xxStorageVendors)a+='<option value="'+xxStorageVendors[d]+'">';a+="</datalist>";a+="<datalist id=mstorageapplicationlist>";for(d in xxStorageApplications)a+='<option value="'+xxStorageApplications[d]+'">';a+='</datalist><datalist id=mstoragetypelist><option value="application/octet-stream"><option value="image/jpeg"><option value="text/html"><option value="text/plain"></datalist>';
|
|
setDialogMode(11,"Storage Upload",3,UploadToStorageEx,a,b);b&&SetStorageName(c)}}function UploadToStorageEx(b,c){if(c)d=new FileReader,d.onload=UploadToStorageEx2,d.filename=Q("mstoragefile").value,d.readAsBinaryString(c);else{var a=Q("mstoragefile");if(1==a.files.length){var d=new FileReader;d.onload=UploadToStorageEx2;d.filename=a.files[0].name;d.readAsBinaryString(a.files[0])}}}
|
|
function SetStorageName(b){b||(b=Q("mstoragefile"),b=1==b.files.length?b.files[0].name:"");b=b.split(" ").join("");var c=b.split("-");3==c.length&&12>c[0].length&&12>c[1].length&&(Q("mstoragevendor").value=c[0],Q("mstorageapplication").value=c[1],b=c[2]);b=b.split("-").join("");b.endsWith(".gz")&&(b=b.substring(0,b.length-3));b.endsWith(".htm")||b.endsWith(".html")?Q("mstoragetype").value="text/html":b.endsWith(".txt")&&(Q("mstoragetype").value="text/plain");11<b.length&&(b=b.substring(0,11));Q("mstoragefilename").value=
|
|
b}
|
|
function UploadToStorageEx2(b){var c;c=Q("mstoragevendor").value;var a=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var e=Q("mstoragetype").value;""==e&&(e="application/octet-stream");var r=Q("mstoragelink").value;""!=c||""!=a||"logon.htm"!=d.toLowerCase()&&"index.htm"!=d.toLowerCase()?(""==c&&(c="Vendor"),""==a&&(a="App"),c=c+"/"+a+"/"+d):c=d.toLowerCase();a="<metadata><headers>";d=b.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(a+=
|
|
"<h>Content-Encoding: gzip</h>");a+="<h>Content-Type: "+e+"</h></headers>";""!=r&&(a+="<link>"+r+"</link>");a+="</metadata>"+b.target.result;PushToStorage(c,a)}function _fmtdatetime(b){return b.replace("T"," ").replace("Z","")}
|
|
function _fmtinterval(b){b=b.replace("T","").substring(b.indexOf("P")+1);b=" "+b.replace("D"," days ").replace("H"," hours ").replace("M"," minutes ");b=b.replace(" 1 days "," 1 day ").replace(" 1 hours "," 1 hour ").replace(" 1 minutes "," 1 minute ");return b.substring(0,b.length-1)}function _fmttimepad(b){for(b=""+b;2>b.length;)b="0"+b;return b}
|
|
function convertAmtDataStr(b){b=b.split("Z").join("").split("T").join("-").split(":").join("-").split("-");return new Date(b[0],b[1]-1,b[2],b[3],b[4],b[5])}var xxAlarms=null;
|
|
function PullAlarms(){var b=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage wake alarms.<br><br>";amtstack.Enum("IPS_AlarmClockOccurrence",function(c,a,d,e){if(200==e){QV("go23",!0);if(0<d.length)for(xxAlarms=d,c=0;c<d.length;c++)a=convertAmtDataStr(d[c].StartTime.Datetime),a="<b>"+d[c].ElementName+"</b>, wake on "+a.toLocaleString().replace(", "," at "),void 0!=d[c].Interval&&(a+=" and each"+_fmtinterval(d[c].Interval.Interval)),1==d[c].DeleteOnCompletion&&(a+=", delete when done"),
|
|
b+="<div class=itemBar onclick=showAlertDetails("+c+")><div style=float:right>",xxAccountAdminName&&(b+=" "+AddButton2("Edit...",'showAddAlarm(" + i + ")')),b+="</div><div style=padding-top:3px;width:auto;float:left;overflow-x:hidden>"+a+"</div></div>";else xxAlarms=null,b+="<div style=padding-left:15px><br><i>No wake alarms registered.</i></div><br>";d="<div> "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Remove all alarms","RemoveAllAlarms()")+AddButton("Add","showAddAlarm()"));
|
|
b+="<br><td class=r1>"+TableEnd(d+"</div>");QH(63,b)}},null,!0)}
|
|
function prepareAlarmOccurenceTemplate(b,c,a,d,e){return'<d:AlarmTemplate xmlns:d="http://intel.com/wbem/wscim/1/amt-schema/1/AMT_AlarmClockService" xmlns:s="http://intel.com/wbem/wscim/1/ips-schema/1/IPS_AlarmClockOccurrence"><s:InstanceID>'+b+'</s:InstanceID><s:StartTime><p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+a+'</p:Datetime></s:StartTime><s:Interval><p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Interval></s:Interval><s:DeleteOnCompletion>"+
|
|
e+"</s:DeleteOnCompletion></d:AlarmTemplate>"}function RemoveAllAlarms(){setDialogMode(1,"Remove all wake alarms",3,RemoveAllAlarmsEx,"Confirm removal of all wake alarms?")}function RemoveAllAlarmsEx(){var b=xxAlarms.length,c;for(c in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,c,e,r){0==--b&&PullAlarms()})}
|
|
function showAddAlarm(b){if(!xxdialogMode){QE("d25alarm_name",!b);if(void 0!=b){var c=xxAlarms[b],a=convertAmtDataStr(c.StartTime.Datetime);Q("d25alarm_name").value=c.ElementName;Q("d25alarm_sdate").value=a.getFullYear()+"-"+_fmttimepad(a.getMonth()+1)+"-"+_fmttimepad(a.getDate());Q("d25alarm_stime").value=a.getHours()+":"+_fmttimepad(a.getMinutes())+":"+_fmttimepad(a.getSeconds());if(c.Interval){var a=c.Interval.Interval.replace("P","").replace("T","").replace("D","D,").replace("H","H,").replace("M",
|
|
"M,").split(","),d=[0,0,0],e;for(e in a){var r=a[e].length-1;"D"==a[e][r]&&(d[0]=parseInt(a[e].substring(0,r)));"H"==a[e][r]&&(d[1]=parseInt(a[e].substring(0,r)));"M"==a[e][r]&&(d[2]=parseInt(a[e].substring(0,r)))}Q("d25alarm_interval").value=d.join("-")}else Q("d25alarm_interval").value="";Q("d25alarm_doc").value=1==c.DeleteOnCompletion?1:0}else c=new Date,c.setDate((new Date).getDate()+1),Q("d25alarm_name").value="",Q("d25alarm_sdate").value=c.getFullYear()+"-"+_fmttimepad(c.getMonth()+1)+"-"+_fmttimepad(c.getDate()),
|
|
Q("d25alarm_stime").value=c.getHours()+":"+_fmttimepad(c.getMinutes())+":00",Q("d25alarm_interval").value="",Q("d25alarm_doc").value=0;setDialogMode(25,"Add new alarm",void 0!=b?7:3,showAddAlarmOk,"",b);alertDialogUpdate()}}function alertDialogUpdate(){var b=Q("d25alarm_interval").value.split("-").length,b=0<Q("d25alarm_name").value.length&&3==Q("d25alarm_sdate").value.split("-").length&&3==Q("d25alarm_stime").value.split(":").length&&(1==b||3==b);QE("c49",b)}
|
|
function showAddAlarmOk(b,c){if(2==b)showAlertDetailsDelete(b,c);else{var a=Q("d25alarm_name").value,d=Q("d25alarm_sdate").value.split("-"),e=Q("d25alarm_stime").value.split(":"),d=new Date(d[0],d[1]-1,d[2],e[0],e[1],e[2],0),d=_fmttimepad(d.getFullYear())+"-"+_fmttimepad(d.getMonth()+1)+"-"+_fmttimepad(d.getDate())+"T"+_fmttimepad(d.getHours())+":"+_fmttimepad(d.getMinutes())+":"+_fmttimepad(d.getSeconds())+"Z",e=Q("d25alarm_interval").value.split("-");3!=e.length&&(e=[0,0,0]);var e="P"+e[0]+"DT"+
|
|
e[1]+"H"+e[2]+"M",r=1==Q("d25alarm_doc").value,a=prepareAlarmOccurenceTemplate(a,a,d,e,r);void 0==c?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",a,function(a,b,c,d){200!=d?messagebox("Add alarm",format("Failed to add alarm. Status: {0}.<br/>Verify the alarm is for a future time.",d)):0!=c.Body.ReturnValue?messagebox("Add alarm",format("Failed to add alarm {0}.<br/>Verify the alarm is for a future time.",c.Body.ReturnValueStr)):PullAlarms()}):(a=Clone(xxAlarms[c]),
|
|
a.StartTime='<p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Datetime>",a.Interval='<p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+e+"</p:Interval>",a.DeleteOnCompletion=r,amtstack.Put("IPS_AlarmClockOccurrence",a,function(a,b,c,d){200!=d?messagebox("Edit alarm",format("Failed to change alarm. Status: {0}.<br/>Verify the alarm for at a future time.",d)):PullAlarms()},null,null,{InstanceID:a.InstanceID}))}}
|
|
function showAlertDetails(b){if(!xxdialogMode){var c=xxAlarms[b],a=convertAmtDataStr(c.StartTime.Datetime),a="<div style=text-align:left>"+addHtmlValue("Name",c.ElementName)+addHtmlValue("Wake time",a.toLocaleString().replace(", "," at "));void 0!=c.Interval&&(a+=addHtmlValue("Internal",_fmtinterval(c.Interval.Interval)));a+=addHtmlValue("After wake",1==c.DeleteOnCompletion?"Delete Alarm":"Keep Alarm")+"</div>";messagebox(format("Alarm {0}",c.ElementName),a);setDialogMode(11,"Alarm "+c.ElementName,
|
|
5,showAlertDetailsDelete,a,b)}}function showAlertDetailsDelete(b,c){2==b&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[c],function(a,b,c,r){PullAlarms()})}function script_runScriptDlg(){xxdialogMode||scriptstate||setDialogMode(11,"Run Script",3,script_runScriptDlgOk,"<br><input id=scriptopen type=file style=width:100% accept=.mescript>")}
|
|
function script_runScriptDlgOk(b){if(1==b&&(b=Q("scriptopen"),1==b.files.length)){var c=new FileReader;c.onload=script_onScriptRead;c.readAsBinaryString(b.files[0])}}
|
|
function script_onScriptRead(b){var c;try{c=JSON.parse(b.target.result)}catch(e){}if(20==currentView){c.scriptText&&(Q("scriptarea").value=c.scriptText);c.mescript&&(Q("compiledarea").value=rstr2hex(atob(c.mescript)));c.blocks?(script_setBuildBlocks(c.blocks),scriptViewButton(1)):(script_setBuildBlocks(),scriptViewButton(0));c.scriptBlocks?script_BlockScript=c.scriptBlocks:script_BuildingBlocks||(script_BlockScript=[]);for(var a in script_BlockScript)if(c=script_BlockScript[a],b=script_BuildingBlocks[c.xname]){b=
|
|
Clone(b);b.id=c.id;b.xname=c.xname;for(var d in b.vars)c.vars[d]&&(b.vars[d].value=c.vars[d].value);script_BlockScript[a]=b}fupdatescript();delete scriptstate;resetScriptButton()}else a={_interactive:1,_certificates:1,_mode:"Firmware"},c&&c.mescript&&(scriptstate=script_setup(atob(c.mescript),a)),scriptstate?(scriptstate.wsstack=wsstack,scriptstate.amtstack=amtstack,scriptstate.onStep=script_updateScriptState,scriptstate.onConsole=script_console,scriptstate.start(100)):messagebox("Run Script","Invalid script file.")}
|
|
function script_updateScriptState(){scriptstate&&(QV(11,0<scriptstate.state),center(),0==scriptstate.state&&(scriptstate=void 0))}function script_console(b){0==b.indexOf("INFO: ")&&(b=b.substring(6));0==b.indexOf("SUCCESS: ")&&(b=b.substring(9));0==b.indexOf("ERROR: ")&&(b=b.substring(7));QH(12,", "+b)}function script_Stop(){scriptstate&&(1==scriptstate.dialog&&setDialogMode(0),scriptstate.stop(),scriptstate.state=0,script_updateScriptState())}
|
|
var script_BuildingBlocks,script_StartingBuildingBlocks,script_BlockScript=[],script_BlockScriptSelectedId=null,script_BuilderView=0,editscriptstate;
|
|
function scriptLoadStartingBlocks(){var b=new XMLHttpRequest;b.onload=function(){if(200<=b.status&&400>b.status){var c;try{c=JSON.parse(b.responseText)}catch(a){}c&&c.blocks&&(script_StartingBuildingBlocks=c.blocks,script_setBuildBlocks(script_StartingBuildingBlocks))}};b.onerror=function(){console.log("Failed to get script blocks")};b.open("GET","scriptblocks.txt",!0);b.send()}
|
|
function scriptViewButton(b){script_BuilderView=b;QV("scripteditor",0==b);QV("scriptbuilder",1==b);QV("viewEditorButton",script_BuildingBlocks&&1==b);QV("viewBuilderButton",script_BuildingBlocks&&0==b)}
|
|
function script_setBuildBlocks(b){script_BuildingBlocks=b;var c="";if(b)for(var a in b)95!=a.charCodeAt(0)&&(c+="<div id=sblock_"+a+' style=cursor:pointer;background-color:#ccc;width:auto;padding:5px;margin:2px ondblclick=script_faddblock("'+a+'") draggable=true ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) title="'+b[a].desc+'"',c+=">"+b[a].name+"</div>");QH("blocks",c);script_fonfilterchanged();scriptViewButton(script_BuildingBlocks?1:0)}
|
|
function script_faddblock(b){var c=Clone(script_BuildingBlocks[b]);c.id=Math.random();c.xname=b;script_BlockScript.push(c);script_BlockScriptSelectedId=script_BlockScript.length-1;fupdatescript()}function script_feditblock(b){xxdialogMode||setDialogMode(11,format("Edit {0}",script_BuildingBlocks[b].name),3,script_feditblockEx,"Edit this block? This operation will reset the block editor and load the block code into the code editor.",b)}
|
|
function script_feditblockEx(b,c){script_newScriptDlgOk();scriptViewButton(0);var a,d=script_BuildingBlocks[c];a=""+("##!BLOCK!##\r\n#id="+c+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var e in d.vars){var r=d.vars[e];a+="##!VAR!##\r\n#id="+e+"\r\n#name="+r.name+"\r\n#desc="+r.desc+"\r\n#type="+r.type+"\r\n";r.maxlength&&(a+="#maxlength="+r.maxlength+"\r\n");if(r.values)for(var p in r.values)a+="#values-"+p+"="+r.values[p]+"\r\n";a+="#value="+r.value+"\r\n##SWAP %%%"+e+"%%% "+
|
|
r.value+"\r\n"}a+="##!VAR!##\r\n##SWAP %%%~%%% 0\r\n\r\n##!BLOCK!##\r\n"+d.code+"\r\n##!BLOCK!##\r\n";Q("scriptarea").value=a}
|
|
function script_fConvertScriptToJsonBlock(b){var c={};b=b.split("##!BLOCK!##\n");var a=b[1].split("\n"),d;for(d in a){var e=a[d].split("=");2==e.length&&(c[e[0].substring(1)]=e[1])}c.vars={};scriptvariables=b[2].split("##!VAR!##\n");for(d in scriptvariables){var a=scriptvariables[d].split("\n"),r={},p={},k=0,q;for(q in a)e=a[q].split("="),2==e.length&&e[1]&&e[0]&&0<e[0].length&&("#values-"==e[0].substring(0,8)?(p[e[0].substring(8)]=e[1],k++):r[e[0].substring(1)]=e[1]);r.id&&(0<k&&(r.values=p),a=r.id,
|
|
delete r.id,c.vars[a]=r)}c.code=b[3];a=c.id;delete c.id;d={};d[a]=c;return JSON.stringify(d,null," ")}function script_fonfilterchanged(){var b=Q("blockfilter").value.toLowerCase(),c;for(c in script_BuildingBlocks)95!=c.charCodeAt(0)&&QV("sblock_"+c,0<=script_BuildingBlocks[c].name.toLowerCase().indexOf(b)||0<=script_BuildingBlocks[c].desc.toLowerCase().indexOf(b))}var script_fonclickDblClickDetectIndex=null,script_fonclickDblClickDetectTime=null;
|
|
function script_fonclick(b,c){if(!xxdialogMode){script_BlockScriptSelectedId=null;c&&(c=fgetParentWithId(c),c.id.startsWith("xblock_")&&(script_BlockScriptSelectedId=c.id.substring(7)));fupdatescript();haltEvent(b);if(script_fonclickDblClickDetectIndex==script_BlockScriptSelectedId&&250>(new Date).getTime()-script_fonclickDblClickDetectTime)return script_foneditclick(script_BlockScriptSelectedId);script_fonclickDblClickDetectIndex=script_BlockScriptSelectedId;script_fonclickDblClickDetectTime=(new Date).getTime()}}
|
|
function script_fondragstart(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="0.4",b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("scriptbuilder/block",c.id))}function script_fondragend(b,c){xxdialogMode||(c=fgetParentWithId(c),c.style.opacity="1.0")}function script_fondragenter(b,c){xxdialogMode||(fgetParentWithId(c).style["border-top"]="solid 2px black")}
|
|
function script_fondragleave(b,c){if(!xxdialogMode){b=b.originalEvent||b;var a=document.elementFromPoint(b.pageX,b.pageY);c.contains(a)||(fgetParentWithId(c).style["border-top"]="none")}}
|
|
function script_fondrop(b,c){if(!xxdialogMode){c=fgetParentWithId(c);var a,d=b.dataTransfer.getData("scriptbuilder/block"),e=parseInt(c.id.substring(7));""==d?documentFileSelectHandler(b):(d.startsWith("sblock_")?(a=Clone(script_BuildingBlocks[d.substring(7)]),a.id=Math.random(),a.xname=d.substring(7)):(d=parseInt(d.substring(7)),a=script_BlockScript[d],script_BlockScript.splice(d,1),e>d&&e--),"scriptblocks"==c.id?(a&&script_BlockScript.push(a),script_BlockScriptSelectedId=script_BlockScript.length-
|
|
1):(script_BlockScript.splice(e,0,a),script_BlockScriptSelectedId=e),fupdatescript(),haltEvent(b))}}
|
|
function script_foneditclick(b){if(!xxdialogMode){var c=script_BlockScript[b];script_BlockScriptSelectedId=b;fupdatescript();if(null!=c){var a=c.vars?7:5,d=c.desc+"<br><br>";if(c.vars)for(var e in c.vars){var r=c.vars[e].value,p="";c.vars[e].maxlength&&(p+=" maxlength="+c.vars[e].maxlength);2==c.vars[e].type&&(p+=" onkeypress='return numbersOnly(event)'");if(1==c.vars[e].type||2==c.vars[e].type)r='<input title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+p+" style=width:100%></input>";
|
|
if(3==c.vars[e].type){var r="<select title='"+c.vars[e].desc+"' id=scriptXvalue_"+e+" style=width:100%;padding:0;margin:0>",k;for(k in c.vars[e].values)r+="<option value="+k+(k==c.vars[e].value?" selected":"")+">"+c.vars[e].values[k]+"</option>";r+="</select>"}4==c.vars[e].type&&(r='<input type=password autocomplete=off title="'+c.vars[e].desc+'" id=scriptXvalue_'+e+' value="'+c.vars[e].value+'" '+p+" style=width:100%></input>");5==c.vars[e].type&&(r="");6==c.vars[e].type&&(r='<input type=file title="'+
|
|
c.vars[e].desc+'" id=scriptXvalue_'+e+" "+p+" style=width:100%></input>");d+='<table style=width:100% title="'+c.vars[e].desc+'"><td style=width:120px>'+c.vars[e].name+"<td><b>"+r+"</b></table>";if(5==c.vars[e].type){var d=d+("<ul id=scriptXvalue_"+e+' style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">'),q;for(q in c.vars[e].values)r="",0<=c.vars[e].value.indexOf(q)&&(r=" checked"),d+="<li><label><input type=checkbox id=scriptXvaluex_"+
|
|
e+"-"+q+""+r+">"+c.vars[e].values[q]+"</label></li>";d+="</ul>"}}}setDialogMode(11,c.name,a,script_foneditclickEx,d,b)}}
|
|
function script_foneditclickEx(b,c){if(!xxdialogMode){if(2==b)script_BlockScript.splice(c,1),script_BlockScriptSelectedId==c&&(script_BlockScriptSelectedId=null);else{var a=script_BlockScript[c];if(a.vars)for(var d in a.vars)if(5==a.vars[d].type){a.vars[d].value=[];for(var e in a.vars[d].values)Q("scriptXvaluex_"+d+"-"+e).checked&&a.vars[d].value.push(e)}else if(6==a.vars[d].type){var r=Q("scriptXvalue_"+d);if(1==r.files.length){var p=new FileReader;p.onload=function(b){a.vars[d].value=btoa(b.target.result);
|
|
fupdatescript()};p.readAsBinaryString(r.files[0])}}else a.vars[d].value=Q("scriptXvalue_"+d).value}fupdatescript()}}function fgetParentWithId(b){for(;!b.id;)b=b.parentElement;return b}
|
|
function fupdatescript(){var b="",c;for(c in script_BlockScript){b+="<div id=xblock_"+c+" style=cursor:pointer;min-height:24px;background-color:#"+(script_BlockScriptSelectedId==c?"aaa":"ccc")+';width:auto;padding:5px;margin:2px draggable=true onclick=script_fonclick(event,this) ondragenter=script_fondragenter(event,this) ondragleave=script_fondragleave(event,this) ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) ondrop=script_fondrop(event,this) title="'+script_BlockScript[c].desc+
|
|
'"';b+="><input style=float:right type=button value=Edit... onclick=script_foneditclick("+c+")><div style=font-size:16px><b>"+script_BlockScript[c].name+"</b>";if(script_BlockScript[c].vars){var a=0,b=b+'<table class="scriptBlockVar us" cellpadding=0 cellspacing=0 style=width:100%;border-radius:5px;margin-top:8px>',d;for(d in script_BlockScript[c].vars){var e=script_BlockScript[c].vars[d].value;4==script_BlockScript[c].vars[d].type&&0<script_BlockScript[c].vars[d].value.length&&(e="*****");3==script_BlockScript[c].vars[d].type&&
|
|
(e=script_BlockScript[c].vars[d].values[script_BlockScript[c].vars[d].value]);6==script_BlockScript[c].vars[d].type&&(e=script_BlockScript[c].vars[d].value?"Binary file, "+script_BlockScript[c].vars[d].value.length+" bytes":"Not set");b+='<tr title="'+script_BlockScript[c].vars[d].desc+'"><td width=200px style="'+(0<a?"border-top:1px solid #a810a8":"")+'"><p>'+script_BlockScript[c].vars[d].name+'<td style="'+(0<a?"border-top:1px solid #a810a8":"")+'">'+e;a++}b+="<tr><td style=height:3px></table>"}b+=
|
|
"</div></div>"}""==b&&(b='<div style="padding:15px;color:gray">Start your script by drag & dropping blocks from the left side into this scripting box.<div>');QH("scriptblocks",b+"<div style=height:80px></div>");for(c in script_BlockScript)QS("xblock_"+c).borderLeft=script_CurrentHighlightBlock==c?"3px solid black":"";script_blocksToScript()}
|
|
function script_blocksToScript(){var b="";if(script_BuildingBlocks){script_BuildingBlocks._start&&(b+="##### Starting Block #####\r\n"+script_BuildingBlocks._start.code+"\r\n\r\n");for(var c in script_BlockScript){var a=script_BlockScript[c].code,a=a.split("%%%~%%%").join(c),d;for(d in script_BlockScript[c].vars)a=a.split("%%%"+d+"%%%").join(script_BlockScript[c].vars[d].value);b+="##### Block: "+script_BlockScript[c].name+" #####\r\nHighlightBlock __t "+c+"\r\n"+a+"\r\n\r\n"}script_BuildingBlocks._end&&
|
|
(b+="##### Ending Block #####\r\n"+script_BuildingBlocks._end.code+"\r\nHighlightBlock\r\n")}Q("scriptarea").value=b}var script_CurrentHighlightBlock;function script_HighlightBlock(b,c){if(b==editscriptstate){script_CurrentHighlightBlock=c;for(var a in script_BlockScript)QS("xblock_"+a).borderLeft=script_CurrentHighlightBlock==a?"3px solid black":""}}function script_newScriptDlg(){xxdialogMode||setDialogMode(11,"New Script",3,script_newScriptDlgOk,"<br>Reset & clear the script editor?")}
|
|
function script_newScriptDlgOk(){script_setBuildBlocks(script_StartingBuildingBlocks);script_BlockScript=[];script_BlockScriptSelectedId=null;delete editscriptstate;scriptViewButton(script_BuildingBlocks?1:0);QH("variables","");Q("scriptarea").value="";resetScriptButton()}
|
|
function resetScriptButton(){breakScriptButton();Q("compiledarea").value=rstr2hex(script_compile(Q("scriptarea").value,function(b){messagebox("Script Compile Error",b)}));delete editscriptstate;Q("console").value="";QH("variables","");QH("EditScriptStatus","Stopped");1==script_BuilderView&&fupdatescript();0!=Q("compiledarea").value.length&&(editscriptstate=script_setup(hex2rstr(Q("compiledarea").value),{_interactive:1,_certificates:1,_mode:"Firmware"}),editscriptstate.wsstack=wsstack,editscriptstate.amtstack=
|
|
amtstack,editscriptstate.onStep=editscript_updateScriptState,editscriptstate.onConsole=editscript_console,editscript_updateScriptState(editscriptstate))}function runScriptButton(){null==editscriptstate&&resetScriptButton();null!=editscriptstate&&editscriptstate.start(100)}function breakScriptButton(){null!=editscriptstate&&editscriptstate.stop()}function stepScriptButton(){null==editscriptstate&&resetScriptButton();null!=editscriptstate&&(breakScriptButton(),editscriptstate.step())}
|
|
function editscript_console(b){Q("console").value+=b+"\n"}var script_states=["Stopped","Running","Paused"];
|
|
function editscript_updateScriptState(b){var c="";if(b&&null!=b){var a=[],d;for(d in b.variables)d.startsWith("__")||a.push(d);a.sort();for(d in a)c="object"==typeof b.variables[a[d]]?c+("<b>"+a[d]+"</b> = "+ObjectToStringEx(b.variables[a[d]],2)+"<br>"):c+("<b>"+a[d]+"</b> = "+EscapeHtml(script_toString(b.variables[a[d]]))+"<br>")}QH("variables",c);c="Stopped, No Script";b&&null!=b&&(c=script_states[b.state],0<b.state&&(c+=", "+b.ip+" : "+script_decompile(b.script,b.ip)));50<c.length&&(c=c.substring(0,
|
|
50)+"...");QH("EditScriptStatus",c)}function script_toString(b){return"object"==typeof b?JSON.stringify(b):b}
|
|
function script_saveScript(b){xxdialogMode||scriptstate||(b&&1==b.shiftKey?(setDialogMode(11,"Script Block",1,null,"<br><textarea id=scriptSaveScriptJsonBlock style=width:100%;height:200px;resize:vertical />"),QH("scriptSaveScriptJsonBlock",script_fConvertScriptToJsonBlock(Q("scriptarea").value))):setDialogMode(11,"Save Script",3,script_saveScriptOk,"<br><input id=scriptsavename style=width:100% value=test.mescript >"))}
|
|
function script_saveScriptOk(){if(!xxdialogMode){var b=JSON.stringify({scriptText:Q("scriptarea").value,mescript:btoa(script_compile(Q("scriptarea").value)),blocks:script_StartingBuildingBlocks,scriptBlocks:script_BlockScript},null," ");saveAs(data2blob(b),Q("scriptsavename").value)}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag;
|
|
function setDialogMode(b,c,a,d,e,r){xxdialogMode=b;xxdialogFunc=d;xxdialogButtons=a;xxdialogTag=r;QE("c49",!0);QV("c49",a&1);QV("c48",a&2);QV(64,a&2);QV("c50",a&4);c&&QH(65,c);for(c=1;26>c;c++)QV("dialog"+c,c==b);QV("dialog",b);e&&(11==b?QH(69,e):QH(66,e));0!=xxdialogMode&&iderToggleDiskMap(!1)}
|
|
function dialogclose(b){var c=xxdialogFunc,a=xxdialogButtons,d=xxdialogTag;setDialogMode();(a&8||b)&&c&&c(b,d)}
|
|
function center(){QS("dialog").left=(getDocWidth()-400)/2+"px";var b=0,c=Q(8).offsetHeight-(0==fullscreen?126:53);""==QS(11).display&&(b+=32);""==QS(9).display&&(b+=32);QS(16).height=Q(8).offsetHeight-b-(0==fullscreen?16:0)+"px";QS("Desk")["max-height"]=c-b+"px";QS("Desk")["max-width"]=Q(8).offsetWidth-(0==fullscreen?32:0)+"px";0!=Q(47).offsetWidth&&(QS("Desk")["max-width"]=Q(47).offsetWidth);
|
|
fullscreen?(QS(16)["overflow-y"]="hidden",b=(c-b-Q("Desk").offsetHeight)/2,QS("Desk")["margin-top"]=b+"px",QS("Desk")["margin-bottom"]=b+"px"):(QS(16)["overflow-y"]="scroll",QS("Desk")["margin-top"]="0",QS("Desk")["margin-bottom"]="0")}function messagebox(b,c){QH(66,c);setDialogMode(1,b,1)}function statusbox(b,c){QH(66,c);setDialogMode(1,b)}
|
|
function SaveJsonFile(b,c,a,d){var e="",r={},p=new Date;amtsysstate&&(e="-"+amtsysstate.AMT_GeneralSettings.response.HostName,r={webappversion:version,description:a,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(r.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));e+="-"+p.getFullYear()+"-"+("0"+(p.getMonth()+1)).slice(-2)+"-"+("0"+
|
|
p.getDate()).slice(-2)+"-"+("0"+p.getHours()).slice(-2)+"-"+("0"+p.getMinutes()).slice(-2);r[c]=d;saveAs(data2blob(JSON.stringify(r,null," ").replace(/\n/g,"\r\n")),b+e+".json")}var httpErrorTable={200:"OK",401:"Authentication Error",408:"Timeout Error",601:"WSMAN Parsing Error",602:"Unable to parse HTTP response header",603:"Unexpected HTTP enum response",604:"Unexpected HTTP pull response",997:"Invalid Digest Realm"};
|
|
function errcheck(b,c){if(null==wsstack||amtstack!=c)return!0;200!=b&&9!=b&&(setDialogMode(),wsstack.comm.FailAllError=999,amtstack.CancelAllQueries(999),QH(5,httpErrorTable[b]?httpErrorTable[b]:format("Error #{0}",b)),401==b&&QH(5,'Authentication Error<br /><br /><input type=button value="Set new credentials" onclick=meshcentral2credCallback(true)></input>'),go(100),QS(3).width=0);return 200!=b}
|
|
function goiFrame(b,c,a){if(!xxdialogMode){go(c);if(1==b.shiftKey||0==Q(15).src.endsWith(a))Q(15).src=a;QV(16,!1);QV(14,!0)}}function go(b,c){if(!xxdialogMode||1==c){QV(14,!1);QV(16,!0);QV(4,100==b);QV(6,100>b);for(var a=0;80>a;a++){QV("p"+a,a==b);var d=QS("go"+a);d&&(d["background-color"]=a==b?"#abcae1":"");d&&(d["background-color"]=a==b?"gray":"")}currentView=b;center()}}
|
|
function portsFromHost(b,c){var a=decodeURIComponent(b).split(":"),d=0==c?16992:16993,e=0==c?16994:16995;1<a.length&&(d=parseInt(a[1]));2<a.length&&(e=parseInt(a[2]));return{host:a[0],http:d,redir:e}}function addLink(b,c){return"<a style=cursor:pointer;color:blue onclick='"+c+"'>♦ "+b+"</a>"}function addLinkConditional(b,c,a){return a?addLink(b,c):b}function haltEvent(b){b.preventDefault&&b.preventDefault();b.stopPropagation&&b.stopPropagation();return!1}
|
|
function addOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;Q(b).add(d)}function addDisabledOption(b,c,a){var d=document.createElement("option");d.text=c;d.value=a;d.disabled=1;Q(b).add(d)}function passwordcheck(b){if(8>b.length)return!1;var c=0,a=0,d=0,e=0,r;for(r in b){var p=b.charCodeAt(r);64<p&&91>p?c=1:96<p&&123>p?a=1:47<p&&58>p?d=1:e=1}return 4==c+a+d+e}
|
|
function methodcheck(b){return b&&null!=b&&b.Body&&0!=b.Body.ReturnValue?(messagebox("Call Error",b.Header.Method+": "+(b.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}
|
|
function TableEntry(b,c){return"<tr><td class=r1><p>"+b+"<td class=r1>"+c}function FullTable(b,c){var a=TableStart();for(i in b)i&&b[i]&&(a+=TableEntry(i,b[i]));return a+TableEnd(c)}function TableEnd(b){return"<tr><td colspan=2><p>"+(b?b:"")+"</table>"}function AddButton(b,c){return"<input type=button value='"+b+"' onclick='"+c+"' style=margin:4px>"}function AddButton2(b,c,a){return"<input type=button value='"+b+"' onclick='"+c+"' "+a+">"}
|
|
function AddRefreshButton(b){return'<input type=button name=refreshbtn value="Refresh" onclick=\'refreshButtons(false);'+b+"' style=margin:4px "+(0==refreshButtonsState?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>'}
|
|
function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(b){for(var c=[],a,d=0,e=b.options.length;d<e;d++)a=b.options[d],a.selected&&c.push(a.value);return c}function getInstance(b,c){for(var a in b)if(b[a].InstanceID==c)return b[a];return null}function getItem(b,c,a){for(var d in b)if(b[d][c]==a)return b[d];return null}
|
|
function guidToStr(b){return b.substring(6,8)+b.substring(4,6)+b.substring(2,4)+b.substring(0,2)+"-"+b.substring(10,12)+b.substring(8,10)+"-"+b.substring(14,16)+b.substring(12,14)+"-"+b.substring(16,20)+"-"+b.substring(20)}function getUrlVars(){for(var b,c=[],a=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<a.length;d++)b=a[d].indexOf("="),0<b&&(c[a[d].substring(0,b)]=a[d].substring(b+1,a[d].length));return c}
|
|
function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}
|
|
function getDocHeight(){return window.innerHeight?window.innerHeight:document.documentElement&&document.documentElement.clientHeight&&0!=document.documentElement.clientHeight?document.documentElement.clientHeight:document.getElementsByTagName("body")[0].clientHeight}function addHtmlValue(b,c){return'<div style=height:20px><div style=float:right;width:220px;overflow:hidden><b title="'+c+'">'+c+"</b></div><div>"+b+"</div></div>"}
|
|
function addHtmlValueNoTitle(b,c){return"<div style=height:20px><div style=float:right;width:220px;overflow:hidden>"+c+"</b></div><div>"+b+"</div></div>"}function numbersOnly(b,c){return 0==event.charCode||event.charCode==c||48<=event.charCode&&57>=event.charCode}function format(b){var c=Array.prototype.slice.call(arguments,1);return b.replace(/{(\d+)}/g,function(a,b){return"undefined"!=typeof c[b]?c[b]:a})}startup();
|
|
</script> |